diff options
author | Sebastian Dröge <sdroege@src.gnome.org> | 2007-10-08 05:59:15 +0000 |
---|---|---|
committer | Sebastian Dröge <sdroege@src.gnome.org> | 2007-10-08 05:59:15 +0000 |
commit | 52e63ca2a3371cbaf24d8189ec80abd24dc0fd99 (patch) | |
tree | 2f8f7a2b877fcd2aeceefde37baf3322ad7ea4cb /daemon/mount.c | |
parent | cdc36a1c7d65f84cccbc24c2078b999ea7f060b6 (diff) | |
download | gvfs-52e63ca2a3371cbaf24d8189ec80abd24dc0fd99.tar.gz |
Implement get_supported_uri_schemes method and add a GVfsUriMapper method
* client/gdaemonvfs.c: (g_daemon_vfs_finalize),
(g_daemon_vfs_init), (fill_supported_uri_schemes),
(g_daemon_vfs_get_supported_uri_schemes),
(g_daemon_vfs_class_init):
* client/smburi.c: (smb_to_uri_scheme),
(g_vfs_uri_mapper_smb_class_init):
* common/gvfsdaemonprotocol.h:
* common/gvfsurimapper.c: (g_vfs_uri_mapper_to_uri_scheme):
* common/gvfsurimapper.h:
* daemon/mount.c: (list_mount_types), (dbus_message_function):
Implement get_supported_uri_schemes method and add a GVfsUriMapper
method to map a mount spec to an URI scheme.
svn path=/trunk/; revision=970
Diffstat (limited to 'daemon/mount.c')
-rw-r--r-- | daemon/mount.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/daemon/mount.c b/daemon/mount.c index 4e698ec0..9c29754c 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -820,6 +820,43 @@ mount_location (DBusConnection *connection, } +static void +list_mount_types (DBusConnection *connection, + DBusMessage *message) +{ + VfsMountable *mountable; + DBusMessage *reply; + DBusMessageIter iter, array_iter; + GList *l; + + reply = dbus_message_new_method_return (message); + if (reply == NULL) + _g_dbus_oom (); + + dbus_message_iter_init_append (reply, &iter); + + + if (!dbus_message_iter_open_container (&iter, + DBUS_TYPE_ARRAY, + DBUS_TYPE_STRING_AS_STRING, + &array_iter)) + _g_dbus_oom (); + + for (l = mountables; l != NULL; l = l->next) + { + mountable = l->data; + if (!dbus_message_iter_append_basic (&array_iter, + DBUS_TYPE_STRING, + &mountable->type)) + _g_dbus_oom (); + } + + if (!dbus_message_iter_close_container (&iter, &array_iter)) + _g_dbus_oom (); + + dbus_connection_send (connection, reply, NULL); +} + static DBusHandlerResult dbus_message_function (DBusConnection *connection, DBusMessage *message, @@ -844,6 +881,10 @@ dbus_message_function (DBusConnection *connection, G_VFS_DBUS_MOUNTTRACKER_INTERFACE, G_VFS_DBUS_MOUNTTRACKER_OP_MOUNT_LOCATION)) mount_location (connection, message); + else if (dbus_message_is_method_call (message, + G_VFS_DBUS_MOUNTTRACKER_INTERFACE, + G_VFS_DBUS_MOUNTTRACKER_OP_LIST_MOUNT_TYPES)) + list_mount_types (connection, message); else res = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -913,3 +954,4 @@ mount_init (void) dbus_error_free (&error); } } + |