diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-01-26 15:59:05 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-01-26 18:16:00 +0100 |
commit | 2592a8ed424906528e90677ef47b040d2b4d8383 (patch) | |
tree | 63ab15e6aa11095a903560cda2c5190feaa98f87 /daemon/gvfsdaemon.c | |
parent | 623d6fd8e9912ccc0003fad97578d24f5a5e773a (diff) | |
download | gvfs-2592a8ed424906528e90677ef47b040d2b4d8383.tar.gz |
ProxyVolumeMonitor: Load list of installed remote monitors via dbus
We used to just load the files from this, but that does not work in
a sandboxed environment. For backwards compat we keep loading
the old files if the dbus api is not implemented yet.
Diffstat (limited to 'daemon/gvfsdaemon.c')
-rw-r--r-- | daemon/gvfsdaemon.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c index 0187223d..f0865b0a 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c @@ -42,6 +42,7 @@ #include <gvfsjobopenforread.h> #include <gvfsjobopenforwrite.h> #include <gvfsjobunmount.h> +#include <gvfsmonitorimpl.h> enum { PROP_0 @@ -110,6 +111,9 @@ static gboolean handle_cancel (GVfsDBusDaemon *objec GDBusMethodInvocation *invocation, guint arg_serial, gpointer user_data); +static gboolean handle_list_monitor_implementations (GVfsDBusDaemon *object, + GDBusMethodInvocation *invocation, + gpointer user_data); static gboolean daemon_handle_mount (GVfsDBusMountable *object, GDBusMethodInvocation *invocation, GVariant *arg_mount_spec, @@ -264,6 +268,7 @@ g_vfs_daemon_init (GVfsDaemon *daemon) daemon->daemon_skeleton = gvfs_dbus_daemon_skeleton_new (); g_signal_connect (daemon->daemon_skeleton, "handle-get-connection", G_CALLBACK (handle_get_connection), daemon); g_signal_connect (daemon->daemon_skeleton, "handle-cancel", G_CALLBACK (handle_cancel), daemon); + g_signal_connect (daemon->daemon_skeleton, "handle-list-monitor-implementations", G_CALLBACK (handle_list_monitor_implementations), daemon); error = NULL; if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon->daemon_skeleton), @@ -952,6 +957,34 @@ handle_cancel (GVfsDBusDaemon *object, } static gboolean +handle_list_monitor_implementations (GVfsDBusDaemon *object, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GList *impls, *l; + GVariantBuilder builder; + + impls = g_vfs_list_monitor_implementations (); + + g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY); + + for (l = impls; l != NULL; l = l->next) + { + GVfsMonitorImplementation *impl = l->data; + + g_variant_builder_add_value (&builder, g_vfs_monitor_implementation_to_dbus (impl)); + } + + g_list_free_full (impls, (GDestroyNotify)g_vfs_monitor_implementation_free); + + gvfs_dbus_daemon_complete_list_monitor_implementations (object, + invocation, + g_variant_builder_end (&builder)); + + return TRUE; +} + +static gboolean daemon_handle_mount (GVfsDBusMountable *object, GDBusMethodInvocation *invocation, GVariant *arg_mount_spec, |