From ebc8632133d5eb8c0a8119bdbef09e12e5d49f69 Mon Sep 17 00:00:00 2001
From: Hicham HAOUARI <hicham.haouari@gmail.com>
Date: Tue, 15 Feb 2011 14:36:20 +0000
Subject: [PATCH 3/3] Add desktop file

---
 Makefile.am                 |    1 +
 configure.ac                |    3 +-
 desktop/Makefile.am         |   63 +++++++++++++++++++++++++++++++++++++++++++
 desktop/gnash-splash.swf    |  Bin 0 -> 12799 bytes
 desktop/gnash.desktop       |   10 +++++++
 desktop/klash.desktop       |    9 ++++++
 gui/Makefile.am             |    6 ++--
 gui/gnash.in                |    6 +++-
 gui/klash.in                |   27 ++++++++++++++++++
 9 files changed, 120 insertions(+), 5 deletions(-)
 create mode 100644 desktop/Makefile.am
 create mode 100644 desktop/gnash-splash.swf
 create mode 100644 desktop/gnash.desktop
 create mode 100644 desktop/klash.desktop
 create mode 100644 gui/klash.in

diff --git a/Makefile.am b/Makefile.am
index d3037a7..1843ce8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,6 +49,7 @@ CYGNAL_DIR = cygnal
 endif
 
 STD_DIRS = \
+	desktop \
 	libbase \
 	libmedia \
 	libsound \
diff --git a/configure.ac b/configure.ac
index b614c1f..9905a8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2952,10 +2959,15 @@ AC_CONFIG_LINKS(cygnal/testsuite/cygnal.
 AC_CONFIG_LINKS(testsuite/libbase.all/gnashrc:testsuite/libbase.all/gnashrc.in)
 AC_CONFIG_LINKS(testsuite/libbase.all/gnashrc-local:testsuite/libbase.all/gnashrc-local.in)
 
-AC_CONFIG_FILES(gnash.pc:gnash.pc.in)
+AC_CONFIG_FILES(
+gnash.pc:gnash.pc.in
+gui/gnash:gui/gnash.in
+gui/klash:gui/klash.in
+)
 
 AC_OUTPUT(Makefile
-po/Makefile
+desktop/Makefile
+po/Makefile
 libltdl/Makefile
 libmedia/Makefile
 libsound/Makefile
diff --git a/desktop/Makefile.am b/desktop/Makefile.am
new file mode 100644
index 0000000..147d4ea
--- /dev/null
+++ b/desktop/Makefile.am
@@ -0,0 +1,36 @@
+desktopdir = $(datadir)/applications
+desktop_DATA =
+
+icons32dir = $(datadir)/icons/hicolor/32x32/apps
+icons32_DATA =
+
+splashdir = $(pkgdatadir)
+splash_DATA = gnash-splash.swf
+
+if BUILD_GTK_GUI
+desktop_DATA += gnash.desktop
+icons32_DATA += ../packaging/gnash.xpm
+endif
+
+if BUILD_KDE4_GUI
+desktop_DATA += klash.desktop
+icons32_DATA += ../packaging/klash.xpm
+endif
+
+validate-gnash-desktop: gnash.desktop
+	( dfvalidate=`which desktop-file-validate`; \
+	  if test x$$dfvalidate != x && test -x $$dfvalidate; then \
+              $$dfvalidate $< || ( echo "* $< INVALID *"; exit 1 ) \
+	  else \
+	      echo "Can't find desktop-file-validate to validate $<; proceed with fingers crossed..."; \
+          fi )
+
+validate-klash-desktop: klash.desktop
+	( dfvalidate=`which desktop-file-validate`; \
+	  if test x$$dfvalidate != x && test -x $$dfvalidate; then \
+              $$dfvalidate $< || ( echo "* $< INVALID *"; exit 1 ) \
+	  else \
+	      echo "Can't find desktop-file-validate to validate $<; proceed with fingers crossed..."; \
+          fi )
+
+install-data-hook: validate-gnash-desktop validate-klash-desktop
diff --git a/desktop/gnash-splash.swf b/desktop/gnash-splash.swf
new file mode 100644
index 0000000000000000000000000000000000000000..52a4c17af6d2f506e83ac908d77b0f63d366cd9d
GIT binary patch
diff --git a/desktop/gnash.desktop b/desktop/gnash.desktop
new file mode 100644
index 0000000..0687931
--- /dev/null
+++ b/desktop/gnash.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Name=Gnash SWF Viewer
+GenericName=SWF Viewer
+Comment=View SWF Files
+Icon=gnash
+Exec=gnash %U
+Terminal=false
+Categories=AudioVideo;Video;Player;GTK;
+MimeType=application/x-shockwave-flash;application/futuresplash;
diff --git a/desktop/klash.desktop b/desktop/klash.desktop
new file mode 100644
index 0000000..8955ac1
--- /dev/null
+++ b/desktop/klash.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Gnash SWF Viewer for KDE
+GenericName=SWF Viewer
+Comment=View SWF Files
+Icon=klash
+Exec=klash %U
+Terminal=false
+Categories=AudioVideo;Qt;KDE;
diff --git a/gui/Makefile.am b/gui/Makefile.am
index 4e997b7..57d2ac1 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -187,9 +187,9 @@ imagesdir = $(pkgdatadir)
 bin_SCRIPTS = gnash
 bin_PROGRAMS = 
 
-gnash: gnash.in
-	cp $(srcdir)/gnash.in $@
-	chmod +x $@
+if BUILD_KDE4_GUI
+bin_SCRIPTS += klash
+endif
 
 # Always include the device files in the source tarball
 EXTRA_DIST += \
diff --git a/gui/gnash.in b/gui/gnash.in
index ca0f16d..4583ba1 100755
--- a/gui/gnash.in
+++ b/gui/gnash.in
@@ -57,7 +57,11 @@ fi
 for gui in ${gui} ${GUIS}; do
 	exe=${THIS_DIR}/${gui}-gnash
 	if test -e ${exe}; then
-		exec ${exe} "$@"
+		if test "x$1" = "x" -a -f @datadir@/gnash/gnash-splash.swf -a "${gui}" = "gtk";then
+			exec ${exe} @datadir@/gnash/gnash-splash.swf
+		else
+			exec ${exe} "$@"
+		fi
 	fi
 done
 
diff --git a/gui/klash.in b/gui/klash.in
new file mode 100644
index 0000000..2936564
--- /dev/null
+++ b/gui/klash.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#
+# klash:  Wrapper script for running the KDE version of gnash
+#
+#   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+if test "x\$1" = "x" -a -f @datadir@/gnash/gnash-splash.swf; then
+  kde4-gnash @datadir@/gnash-splash.swf
+else
+  kde4-gnash "\$@"
+fi
-- 
1.7.4

