[tomboy] Add a new mimetype for note: application/x-note



commit 5ce85056730158c348fb3a21224caa189a9dbfa0
Author: Olivier Le Thanh Duong <olivier lethanh be>
Date:   Fri Mar 5 03:43:54 2010 +0100

    Add a new mimetype for note: application/x-note
    
    Add a new mimetype for note file via the XDG shared mime info spec.
    Run update-mime-database as a post-install hook to register the new
    type and add a --disable-update-mimedb configure flag to disable that.
    Autofoo code shamefully stolen from Nautilus.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=611865

 Makefile.am      |    2 +-
 configure.in     |   12 ++++++++++++
 data/Makefile.am |   17 ++++++++++++++++-
 data/tomboy.xml  |    6 ++++++
 4 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7363723..c64a771 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@ DISTCLEANFILES = 			\
 	intltool-update         	\
 	po/.intltool-merge-cache
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install --disable-scrollkeeper
+DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install --disable-scrollkeeper --disable-update-mimedb
 
 # Ignore scrollkeeper issues for now.  @#*$& scrollkeeper (from Evince)
 distuninstallcheck_listfiles = find . -type f -print | grep -v scrollkeeper | grep -v /share/gnome/help/ | grep -v \.omf
diff --git a/configure.in b/configure.in
index 9c61559..6e17b03 100644
--- a/configure.in
+++ b/configure.in
@@ -104,6 +104,18 @@ PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.9, FIXED_GTKSPELL="yes", FIXED_G
 AM_CONDITIONAL(FIXED_GTKSPELL, test "$FIXED_GTKSPELL" = "yes")
 
 #
+# Check if we should update the mime database
+#
+
+AC_PATH_PROG(UPDATE_MIME_DATABASE, update-mime-database, no)
+
+AC_ARG_ENABLE(update-mimedb,
+   AC_HELP_STRING([--disable-update-mimedb],
+                   [disable the update-mime-database after install [default=no]]),,
+    enable_update_mimedb=yes)
+AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
+
+#
 # Check for Mac/Windows/GNOME Support
 #
 AC_ARG_ENABLE(windows, 
diff --git a/data/Makefile.am b/data/Makefile.am
index 5971a4d..097b2ce 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -54,6 +54,8 @@ $(server_in_files): $(server_in_files:.server.in=.server.in.in) Makefile
 
 man_MANS = tomboy.1
 
+mimedir = $(datadir)/mime/packages
+mime_DATA = tomboy.xml
 
 noinst_DATA = 			\
 	GNOME_TomboyApplet.xml
@@ -68,7 +70,9 @@ EXTRA_DIST = 					\
 	GNOME_TomboyApplet.server.in.in		\
 	$(dbusservice_in_files)				\
 	tomboy-note-clipboard-html.xsl		\
-	UIManagerLayout.xml
+	UIManagerLayout.xml		\
+	tomboy.xml
+
 
 DISTCLEANFILES = 				\
 	$(desktop_files)       			\
@@ -77,3 +81,14 @@ DISTCLEANFILES = 				\
 	$(server_in_files) 			\
 	$(server_DATA)				\
 	$(dbusservice_DATA)
+
+install-data-hook:
+if ENABLE_UPDATE_MIMEDB
+	$(UPDATE_MIME_DATABASE) "$(DESTDIR)$(datadir)/mime"
+endif
+
+uninstall-hook:
+if ENABLE_UPDATE_MIMEDB
+	$(UPDATE_MIME_DATABASE) "$(DESTDIR)$(datadir)/mime"
+endif
+
diff --git a/data/tomboy.xml b/data/tomboy.xml
new file mode 100644
index 0000000..7bf0c55
--- /dev/null
+++ b/data/tomboy.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8'?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
+    <mime-type type="application/x-note">
+        <glob pattern="*.note"/>
+    </mime-type>
+</mime-info>



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