[gvfs/gnome-3-14] daemon: register mount tracker skeleton by bus_acquired_handler



commit 07356a7f3e08e35033b76dcc34de74bcfa27465f
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Jan 28 12:45:47 2015 +0100

    daemon: register mount tracker skeleton by bus_acquired_handler
    
    Mount tracker skeleton is registered by name_acquired_handler
    currently, however it is too late. Therefore e.g. mount operation
    could fail for the first time with the following error:
    No such interface `org.gtk.vfs.MountTracker' on object at path
    /org/gtk/vfs/mounttracker

 daemon/main.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/daemon/main.c b/daemon/main.c
index 9c8eba5..4f7c327 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -71,14 +71,6 @@ on_name_acquired (GDBusConnection *connection,
 
   already_acquired = TRUE;
 
-  if (! mount_init ())
-    {
-      /* we were not able to properly initialize ourselves, bail out */
-      g_main_loop_quit (loop);
-      return;
-    }
-
-  
 #ifdef HAVE_FUSE
   if (!no_fuse)
     {
@@ -121,6 +113,19 @@ on_name_acquired (GDBusConnection *connection,
 }
 
 static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
+{
+  if (!mount_init ())
+    {
+      /* we were not able to properly initialize ourselves, bail out */
+      g_main_loop_quit (loop);
+      return;
+    }
+}
+
+static void
 daemon_shutdown (GVfsDaemon *daemon,
                  GMainLoop  *loop)
 {
@@ -209,7 +214,7 @@ main (int argc, char *argv[])
   name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                   G_VFS_DBUS_DAEMON_NAME,
                                   flags,
-                                  NULL,
+                                  on_bus_acquired,
                                   on_name_acquired,
                                   on_name_lost,
                                   GUINT_TO_POINTER (no_fuse),


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