summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2013-06-02 20:16:12 +0200
committerGiovanni Campagna <gcampagna@src.gnome.org>2013-06-13 21:04:42 +0200
commit7aa0c533a78dead59ea0c1a6bc132b8d8e051bcf (patch)
tree8a0fbb5d634b3faa28f29410ed34a2aeca484712
parent97a4246ba7f620ee348711b21cba8a1b67e8a056 (diff)
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
-rw-r--r--monitor/goa/goavolume.c33
-rw-r--r--monitor/goa/goavolumemonitor.c2
2 files changed, 22 insertions, 13 deletions
diff --git a/monitor/goa/goavolume.c b/monitor/goa/goavolume.c
index d8421a92..83f038e6 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 7c0fa5c6..0f05adaa 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 *