[passepartout] added proper mime type support to the desktop



commit ba8bdbd0acaf1e73b7fbd8459301e9423e265350
Author: Sven Herzberg <herzi lanedo com>
Date:   Mon Apr 13 10:32:02 2009 +0200

    added proper mime type support to the desktop
    
    * .gitignore: ignore the generated file
    * configure.ac: check for update-mime-database and update-desktop-database
    * Makefile.am: added the build rules for the mime type; also update the mime
      related databases
    * passepartout.desktop.in: added a mime type and indicate how we'd like to get
      arguments passed
    * passepartout.xml.in: added the mime type description
    * po/POTFILES.in: added the translatable file
---
 .gitignore              |    1 +
 Makefile.am             |   20 ++++++++++++++++++++
 configure.ac            |   14 +++++++++++++-
 passepartout.desktop.in |    4 +++-
 passepartout.xml.in     |    9 +++++++++
 po/POTFILES.in          |    1 +
 6 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index b9d65b5..f129f28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 *.a
 *.desktop
 *.o
+*.xml
 *autom4te.cache
 .deps
 aclocal.m4
diff --git a/Makefile.am b/Makefile.am
index db9b982..dc2230a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,6 +10,11 @@ applications_DATA=$(applications_in_files:.in=)
 applicationsdir=$(datarootdir)/applications
 @INTLTOOL_DESKTOP_RULE@
 
+mime_in_files=passepartout.xml.in
+mime_DATA=$(mime_in_files:.in=)
+mimedir=$(datarootdir)/mime/packages
+ INTLTOOL_XML_RULE@
+
 check-local: $(applications_DATA)
 	@echo "[TEST] $<"
 	@tmpfile=`mktemp`; \
@@ -17,6 +22,21 @@ check-local: $(applications_DATA)
 		cat $$tmpfile >&2; \
 		false; \
 	fi
+# FIXME: add a check rule for the mime specification
+
+update-databases:
+	@if test -z "$(DESTDIR)"; then \
+		$(UPDATE_MIME_DATABASE) $(datadir)/mime; \
+		$(UPDATE_DESKTOP_DATABASE); \
+	else \
+		echo "******" >&2; \
+		echo "*** don't forget to run \"$(UPDATE_MIME_DATABASE) $(datadir)/mime\"" >&2; \
+		echo "*** don't forget to run \"$(UPDATE_DESKTOP_DATABASE)\"" >&2; \
+		echo "******" >&2; \
+	fi
+
+install-data-local: update-databases
+uninstall-local: update-databases
 
 intltool_in_files=\
 	intltool-extract.in \
diff --git a/configure.ac b/configure.ac
index 6028875..931da32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,9 +93,21 @@ AC_FUNC_STAT
 AC_CHECK_FUNCS([realpath strdup mkdtemp])
 
 dnl  -------------------
-dnl | test applications |
+dnl | freedesktop stuff |
 dnl  -------------------
 
+AC_PATH_PROGS(UPDATE_MIME_DATABASE,[update-mime-database],[no])
+if test "$UPDATE_MIME_DATABASE" = "no"; then
+	AC_MSG_ERROR([update-mime-database not found, please install shared-mime-info from
+		      http://www.freedesktop.org/software/shared-mime-info/releases/])
+fi
+
+AC_PATH_PROGS(UPDATE_DESKTOP_DATABASE,[update-desktop-database],[no])
+if test "${UPDATE_DESKTOP_DATABASE}" = "no"; then
+	AC_MSG_ERROR([desktop-file-validate not found, please install desktop-file-utils from
+		      http://www.freedesktop.org/software/desktop-file-utils/releases/])
+fi
+
 AC_PATH_PROGS(DESKTOP_FILE_VALIDATE,[desktop-file-validate],[no])
 if test "${DESKTOP_FILE_VALIDATE}" = "no"; then
 	AC_MSG_ERROR([desktop-file-validate not found, please install desktop-file-utils from
diff --git a/passepartout.desktop.in b/passepartout.desktop.in
index 463db30..41db795 100644
--- a/passepartout.desktop.in
+++ b/passepartout.desktop.in
@@ -3,7 +3,9 @@ _Name=Passepartout
 _GenericName=Desktop publishing application
 _Comment=Desktop publishing application
 Icon=pptout-icon
-Exec=passepartout
+# FIXME: make the %F a %U when we accept URIs
+Exec=passepartout %F
 Terminal=false
 Type=Application
 Categories=GTK;GNOME;Office;Publishing;
+MimeType=application/x-passepartout;
diff --git a/passepartout.xml.in b/passepartout.xml.in
new file mode 100644
index 0000000..cf39d12
--- /dev/null
+++ b/passepartout.xml.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
+  <mime-type type="application/x-passepartout">
+    <_comment>Passepartout Layout</_comment>
+    <sub-class-of type="application/xml" />
+    <root-XML localName="document" namespaceURI="" /> <!-- namespaceURI="http://www.stacken.kth.se/project/pptout/0.7.0"; /-->
+    <glob pattern="*.pp"/>
+  </mime-type>
+</mime-info>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ed50389..2d889ec 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
 passepartout.desktop.in
+passepartout.xml.in
 src/pptout/aboutdialog.cc
 src/pptout/main.cc
 src/pptout/window.cc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]