[gvfs/gdbus-core] gdbus: Fix mount tracker signals emitting
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gdbus-core] gdbus: Fix mount tracker signals emitting
- Date: Fri, 22 Jun 2012 17:17:23 +0000 (UTC)
commit 647d34a090c5ad15f968f1cb473f42b0c5e4eac4
Author: Tomas Bzatek <tbzatek redhat com>
Date: Fri Jun 22 19:12:34 2012 +0200
gdbus: Fix mount tracker signals emitting
This allows clients to react on GVfs mounts appearing and disappearing.
daemon/mount.c | 46 +++++-----------------------------------------
1 files changed, 5 insertions(+), 41 deletions(-)
---
diff --git a/daemon/mount.c b/daemon/mount.c
index 9b0cfb2..118f1bf 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]