summaryrefslogtreecommitdiff
path: root/daemon/mount.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2012-06-22 19:12:34 +0200
committerTomas Bzatek <tbzatek@redhat.com>2012-07-31 11:59:37 +0200
commit17a008f395c438c0dad394523cc3d62261ceca4a (patch)
treef2988a6cc348bc5501c843889e28f7b18fe98a86 /daemon/mount.c
parent87a01d9658ad302d73bd22541183fa5e06cfd6f7 (diff)
downloadgvfs-17a008f395c438c0dad394523cc3d62261ceca4a.tar.gz
gdbus: Fix mount tracker signals emitting
This allows clients to react on GVfs mounts appearing and disappearing.
Diffstat (limited to 'daemon/mount.c')
-rw-r--r--daemon/mount.c46
1 files changed, 5 insertions, 41 deletions
diff --git a/daemon/mount.c b/daemon/mount.c
index 93d9324e..6349c26b 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -537,52 +537,16 @@ re_read_mountable_config (void)
* Support for keeping track of active mounts *
************************************************************************/
-typedef struct
-{
- GVariant *mount;
- gboolean mounted;
-} SignalMountedData;
-
-static void
-mount_tracker_proxy_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- GVfsDBusMountTracker *proxy;
- SignalMountedData *data = user_data;
-
- proxy = gvfs_dbus_mount_tracker_proxy_new_for_bus_finish (res, NULL);
- g_print ("mount_tracker_proxy_cb: signalling %s, proxy = %p\n", data->mounted ? "mount" : "umount", proxy);
-
- if (proxy != NULL)
- {
- if (data->mounted)
- gvfs_dbus_mount_tracker_emit_mounted (proxy, data->mount);
- else
- gvfs_dbus_mount_tracker_emit_unmounted (proxy, data->mount);
-
- g_object_unref (proxy);
- g_free (data);
- }
-}
-
static void
signal_mounted_unmounted (VfsMount *mount,
gboolean mounted)
{
- SignalMountedData *data;
-
- data = g_new0 (SignalMountedData, 1);
- data->mount = vfs_mount_to_dbus (mount);
- data->mounted = mounted;
+ g_print ("signal_mounted_unmounted: signalling %s\n", mounted ? "mount" : "umount");
- gvfs_dbus_mount_tracker_proxy_new_for_bus (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- G_VFS_DBUS_DAEMON_NAME,
- G_VFS_DBUS_MOUNTTRACKER_PATH,
- NULL,
- mount_tracker_proxy_cb,
- data);
+ if (mounted)
+ gvfs_dbus_mount_tracker_emit_mounted (mount_tracker, vfs_mount_to_dbus (mount));
+ else
+ gvfs_dbus_mount_tracker_emit_unmounted (mount_tracker, vfs_mount_to_dbus (mount));
}
static void