[gvfs] Report back error_code on spawn fail due to bus name already owned



commit c3309dfdf5c3d60c6666a8a8883990ccdab383ae
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Aug 23 22:00:02 2012 +0200

    Report back error_code on spawn fail due to bus name already owned
    
    We return the not-quite-right ALREADY_MOUNTED. Its not strictly right
    because just because the name is owned does not mean the mount
    has been registred yet.

 common/org.gtk.vfs.xml |    1 +
 daemon/daemon-main.c   |   11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/common/org.gtk.vfs.xml b/common/org.gtk.vfs.xml
index e13347c..fc68d59 100644
--- a/common/org.gtk.vfs.xml
+++ b/common/org.gtk.vfs.xml
@@ -55,6 +55,7 @@
     <method name="Spawned">
       <arg type='b' name='succeeded' direction='in'/>
       <arg type='s' name='error_message' direction='in'/>
+      <arg type='u' name='error_code' direction='in'/>
     </method>
   </interface>
 
diff --git a/daemon/daemon-main.c b/daemon/daemon-main.c
index 4aa8556..c52253d 100644
--- a/daemon/daemon-main.c
+++ b/daemon/daemon-main.c
@@ -159,6 +159,7 @@ call_spawned_cb (GVfsDBusSpawner *proxy,
 static void
 send_spawned (gboolean succeeded, 
               char *error_message,
+              guint32 error_code,
               GDestroyNotify callback,
               gpointer user_data)
 {
@@ -202,6 +203,7 @@ send_spawned (gboolean succeeded,
   gvfs_dbus_spawner_call_spawned (proxy, 
                                   succeeded,
                                   error_message,
+                                  error_code,
                                   NULL,
                                   (GAsyncReadyCallback) call_spawned_cb,
                                   data);
@@ -303,10 +305,9 @@ on_name_lost (GDBusConnection *connection,
       else
         {
           s = g_strdup_printf (_("mountpoint for %s already running"), data->mountable_name);
-          g_printerr (_("Error: %s"), s);
-          g_printerr ("\n");
+          send_spawned (FALSE, s, G_IO_ERROR_ALREADY_MOUNTED, spawned_failed_cb, data);
           g_free (s);
-          process_result = 1;
+          return;
         }
     }
   g_main_loop_quit (loop);
@@ -324,13 +325,13 @@ on_name_acquired (GDBusConnection *connection,
   data->daemon = g_vfs_daemon_new (FALSE, FALSE);
   if (data->daemon == NULL)
     {
-      send_spawned (FALSE, _("error starting mount daemon"), spawned_failed_cb, data);
+      send_spawned (FALSE, _("error starting mount daemon"), G_IO_ERROR_FAILED, spawned_failed_cb, data);
       return;
     }
 
   g_vfs_daemon_set_max_threads (data->daemon, data->max_job_threads);
 
-  send_spawned (TRUE, NULL, spawned_succeeded_cb, data);
+  send_spawned (TRUE, NULL, 0, spawned_succeeded_cb, data);
 }
 
 static gboolean



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