[gvfs/gnome-3-8] goa: export the activation root for volumes



commit cbed5ec4c726844898103c3b87cfc823f29ec7b1
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Jun 2 20:16:12 2013 +0200

    goa: export the activation root for volumes
    
    Now that we can be in charge of mounts even if we have the shadow
    mount infrastructure, we should export it so that tracking
    of the associated GDaemonMount works correctly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696279
    (cherry picked from commit 7aa0c533a78dead59ea0c1a6bc132b8d8e051bcf)

 monitor/goa/goavolume.c        |   33 ++++++++++++++++++++-------------
 monitor/goa/goavolumemonitor.c |    2 ++
 2 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/monitor/goa/goavolume.c b/monitor/goa/goavolume.c
index d8421a9..83f038e 100644
--- a/monitor/goa/goavolume.c
+++ b/monitor/goa/goavolume.c
@@ -131,6 +131,16 @@ mount_operation_ask_password_cb (GMountOperation   *op,
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
+mount_unmounted_cb (GMount        *mount,
+                    GVfsGoaVolume *self)
+{
+  /* If this assert fails, we're leaking a reference to mount */
+  g_assert (self->mount == mount);
+
+  g_clear_object (&self->mount);
+}
+
+static void
 find_enclosing_mount_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
   GFile *root = G_FILE (source_object);
@@ -145,6 +155,8 @@ find_enclosing_mount_cb (GObject *source_object, GAsyncResult *res, gpointer use
   self->mount = g_file_find_enclosing_mount_finish (root, res, &error);
   if (self->mount == NULL)
     g_simple_async_result_take_error (simple, error);
+  else
+    g_signal_connect (self->mount, "unmounted", G_CALLBACK (mount_unmounted_cb), self);
 
   g_simple_async_result_complete_in_idle (simple);
 }
@@ -298,11 +310,7 @@ g_vfs_goa_volume_enumerate_identifiers (GVolume *_self)
 static GFile *
 g_vfs_goa_volume_get_activation_root (GVolume *_self)
 {
-  /* Even though we know the activation root before mounting the
-   * volume we can not reveal it, because we do not want it to be
-   * handled as a GProxyVolume.
-   */
-  return NULL;
+  return g_file_new_for_uri (G_VFS_GOA_VOLUME (_self)->uuid);
 }
 
 static GDrive *
@@ -334,15 +342,14 @@ g_vfs_goa_volume_get_identifier (GVolume *_self, const gchar *kind)
 static GMount *
 g_vfs_goa_volume_get_mount (GVolume *_self)
 {
-  GVfsGoaVolume *self = G_VFS_GOA_VOLUME (_self);
-  GMount *mount;
+  /* _self->mount is only used to unmount when we see
+     AttentionNeeded, it should not be exported by the
+     volume monitor, because we can't export a GDaemonMount
+     on the bus, and it's already handled as a shadow mount
+     anyway
+  */
 
-  mount = NULL;
-
-  if (self->mount != NULL)
-    mount = g_object_ref (self->mount);
-
-  return mount;
+  return NULL;
 }
 
 static char *
diff --git a/monitor/goa/goavolumemonitor.c b/monitor/goa/goavolumemonitor.c
index 7c0fa5c..0f05ada 100644
--- a/monitor/goa/goavolumemonitor.c
+++ b/monitor/goa/goavolumemonitor.c
@@ -466,6 +466,8 @@ g_vfs_goa_volume_monitor_init (GVfsGoaVolumeMonitor *self)
   g_signal_connect_swapped (self->client, "account-added", G_CALLBACK (update_all), self);
   g_signal_connect_swapped (self->client, "account-changed", G_CALLBACK (update_all), self);
   g_signal_connect_swapped (self->client, "account-removed", G_CALLBACK (update_all), self);
+
+  g_vfs_proxy_volume_monitor_daemon_set_always_call_mount (TRUE);
 }
 
 GVolumeMonitor *


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