[gnome-settings-daemon] automount: turn the automount plugin in a separate binary



commit 796958e94a72691fce1fcb50211895e5b9a4d646
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jun 27 13:19:14 2011 -0400

    automount: turn the automount plugin in a separate binary
    
    It will get autostarted only in fallback mode.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653521

 ...gnome.settings-daemon.plugins.gschema.xml.in.in |   13 ---
 plugins/automount/Makefile.am                      |   91 ++++------------
 .../automount/automount.gnome-settings-plugin.in   |    8 --
 ...t-automount.c => gnome-fallback-mount-helper.c} |   42 ++++----
 .../gnome-fallback-mount-helper.desktop.in.in      |   12 ++
 plugins/automount/gsd-automount-plugin.c           |  111 --------------------
 plugins/automount/gsd-automount-plugin.h           |   60 -----------
 po/POTFILES.in                                     |    3 +-
 po/POTFILES.skip                                   |    1 +
 9 files changed, 58 insertions(+), 283 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
index fa69f2a..1556050 100644
--- a/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
@@ -2,7 +2,6 @@
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins" path="/org/gnome/settings-daemon/plugins/">
     <child name="a11y-keyboard" schema="org.gnome.settings-daemon.plugins.a11y-keyboard"/>
     <child name="a11y-settings" schema="org.gnome.settings-daemon.plugins.a11y-settings"/>
-    <child name="automount" schema="org.gnome.settings-daemon.plugins.automount"/>
     <child name="background" schema="org.gnome.settings-daemon.plugins.background"/>
     <child name="clipboard" schema="org.gnome.settings-daemon.plugins.clipboard"/>
     <child name="cursor" schema="org.gnome.settings-daemon.plugins.cursor"/>
@@ -37,18 +36,6 @@
       <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
     </key>
   </schema>
-  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.automount" path="/org/gnome/settings-daemon/plugins/automount/">
-    <key name="active" type="b">
-      <default>true</default>
-      <_summary>Activation of this plugin</_summary>
-      <_description>Whether this plugin would be activated by gnome-settings-daemon or not</_description>
-    </key>
-    <key name="priority" type="i">
-      <default>97</default>
-      <_summary>Priority to use for this plugin</_summary>
-      <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
-    </key>
-  </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.background" path="/org/gnome/settings-daemon/plugins/background/">
     <key name="active" type="b">
       <default>true</default>
diff --git a/plugins/automount/Makefile.am b/plugins/automount/Makefile.am
index acafa2c..05424f9 100644
--- a/plugins/automount/Makefile.am
+++ b/plugins/automount/Makefile.am
@@ -1,81 +1,34 @@
-NULL =
+libexec_PROGRAMS = gnome-fallback-mount-helper
 
-plugin_name = automount
+gnome_fallback_mount_helper_SOURCES = \
+	gnome-fallback-mount-helper.c \
+	gsd-automount-manager.c \
+	gsd-automount-manager.h \
+	gsd-autorun.c \
+	gsd-autorun.h
 
-noinst_PROGRAMS = 			\
-	test-automount			\
-	$(NULL)
-
-test_automount_SOURCES = 		\
-	test-automount.c		\
-	gsd-automount-manager.h		\
-	gsd-automount-manager.c		\
-	gsd-autorun.c		\
-	gsd-autorun.h		\
-	$(NULL)
-
-test_automount_CPPFLAGS = \
-	-I$(top_srcdir)/gnome-settings-daemon		\
-	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
-	$(AM_CPPFLAGS)
-
-test_automount_CFLAGS = \
-	$(PLUGIN_CFLAGS)		\
-	$(SETTINGS_PLUGIN_CFLAGS)	\
-	$(AM_CFLAGS)
-
-test_automount_LDADD =			\
-	$(top_builddir)/gnome-settings-daemon/libgsd-profile.la	\
-	$(SETTINGS_PLUGIN_LIBS)		\
-	$(X11_LIBS)			\
-	$(NULL)
-
-plugin_LTLIBRARIES = \
-	libautomount.la		\
-	$(NULL)
-
-libautomount_la_SOURCES =		\
-	gsd-automount-plugin.h		\
-	gsd-automount-plugin.c		\
-	gsd-automount-manager.h		\
-	gsd-automount-manager.c		\
-	gsd-autorun.c		\
-	gsd-autorun.h		\
-	$(NULL)
-
-libautomount_la_CPPFLAGS = \
+gnome_fallback_mount_helper_CPPFLAGS = \
 	-I$(top_srcdir)/gnome-settings-daemon		\
 	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
 	$(AM_CPPFLAGS)
 
-libautomount_la_CFLAGS = \
-	$(SETTINGS_PLUGIN_CFLAGS)	\
-	$(AM_CFLAGS)
-
-libautomount_la_LDFLAGS =		\
-	$(GSD_PLUGIN_LDFLAGS)		\
-	$(NULL)
-
-libautomount_la_LIBADD  =		\
-	$(SETTINGS_PLUGIN_LIBS)		\
-	$(NULL)
+gnome_fallback_mount_helper_CFLAGS = \
+	$(SETTINGS_PLUGIN_CFLAGS)
 
-plugin_in_files =		\
-	automount.gnome-settings-plugin.in	\
-	$(NULL)
+gnome_fallback_mount_helper_LDADD = \
+	$(SETTINGS_PLUGIN_LIBS) \
+	$(X11_LIBS)
 
-plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
+autostartdir = $(sysconfdir)/xdg/autostart
+autostart_in_files = gnome-fallback-mount-helper.desktop.in
+autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
 
-EXTRA_DIST = 			\
-	$(plugin_in_files)	\
-	$(NULL)
+gnome-fallback-mount-helper.desktop.in: gnome-fallback-mount-helper.desktop.in.in
+	@sed -e "s|\ LIBEXECDIR\@|$(libexecdir)|" $< > $@
 
-CLEANFILES = 			\
-	$(plugin_DATA)		\
-	$(NULL)
+ INTLTOOL_DESKTOP_RULE@
 
-DISTCLEANFILES =		\
-	$(plugin_DATA)		\
-	$(NULL)
+EXTRA_DIST = $(autostart_in_files)
 
- GSD_INTLTOOL_PLUGIN_RULE@
+CLEANFILES = $(autostart_DATA) \
+	gnome-fallback-mount-helper.desktop.in
\ No newline at end of file
diff --git a/plugins/automount/test-automount.c b/plugins/automount/gnome-fallback-mount-helper.c
similarity index 68%
rename from plugins/automount/test-automount.c
rename to plugins/automount/gnome-fallback-mount-helper.c
index 23d8a41..ff5d192 100644
--- a/plugins/automount/test-automount.c
+++ b/plugins/automount/gnome-fallback-mount-helper.c
@@ -21,40 +21,42 @@
 
 #include "config.h"
 
-#include <stdlib.h>
-#include <locale.h>
-#include <string.h>
+#include <glib.h>
 #include <unistd.h>
 
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
 #include "gsd-automount-manager.h"
 
-static gboolean
-idle (GsdAutomountManager *manager)
-{
-        gsd_automount_manager_start (manager, NULL);
-        return FALSE;
-}
-
 int
-main (int argc, char *argv[])
+main (int argc,
+      char **argv)
 {
+        GMainLoop *loop;
         GsdAutomountManager *manager;
+        GError *error = NULL;
+
+        g_type_init ();
+        gtk_init (&argc, &argv);
 
         bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
-        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
         textdomain (GETTEXT_PACKAGE);
 
-        setlocale (LC_ALL, "");
+        loop = g_main_loop_new (NULL, FALSE);
+        manager = gsd_automount_manager_new ();
 
-        gtk_init (&argc, &argv);
+        gsd_automount_manager_start (manager, &error);
 
-        manager = gsd_automount_manager_new ();
-        g_idle_add ((GSourceFunc)idle, manager);
+        if (error != NULL) {
+                g_printerr ("Unable to start the mount manager: %s",
+                            error->message);
+
+                g_error_free (error);
+                _exit (1);
+        }
+
+        g_main_loop_run (loop);
 
-        gtk_main ();
+        gsd_automount_manager_stop (manager);
+        g_main_loop_unref (loop);
 
         return 0;
 }
diff --git a/plugins/automount/gnome-fallback-mount-helper.desktop.in.in b/plugins/automount/gnome-fallback-mount-helper.desktop.in.in
new file mode 100644
index 0000000..5131340
--- /dev/null
+++ b/plugins/automount/gnome-fallback-mount-helper.desktop.in.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+_Name=Mount Helper
+_Comment=Automount and autorun plugged devices
+Exec= LIBEXECDIR@/gnome-fallback-mount-helper
+Icon=drive-optical
+Terminal=false
+Type=Application
+Categories=
+NoDisplay=true
+OnlyShowIn=GNOME;
+X-GNOME-Autostart-Notify=true
+AutostartCondition=GNOME3 if-session gnome-fallback
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1a7f20b..f76e230 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -20,9 +20,8 @@ plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
 plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c
 [type: gettext/glade]plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui
 [type: gettext/ini]plugins/a11y-settings/a11y-settings.gnome-settings-plugin.in
-[type: gettext/ini]plugins/automount/automount.gnome-settings-plugin.in
+plugins/automount/gnome-fallback-mount-helper.desktop.in.in
 plugins/automount/gsd-automount-manager.c
-plugins/automount/gsd-automount-plugin.c
 plugins/automount/gsd-autorun.c
 [type: gettext/ini]plugins/background/background.gnome-settings-plugin.in
 [type: gettext/ini]plugins/clipboard/clipboard.gnome-settings-plugin.in
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 65622e0..dda31a6 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -21,3 +21,4 @@ data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
 data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in
 data/org.gnome.settings-daemon.plugins.color.gschema.xml.in
+plugins/automount/gnome-fallback-mount-helper.desktop.in



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