diff options
author | Christian Kellner <gicmo@gnome.org> | 2009-10-09 17:07:46 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2009-11-26 16:28:26 +0100 |
commit | 6ad0cb9175acc635057232fec96d32eaad4e0237 (patch) | |
tree | ad86e457ec7f60c2da98bf837a31b0b7e7a6ec9f /daemon/mount.c | |
parent | f2f50e72569406cfd974dcef6f293ebff3378f61 (diff) | |
download | gvfs-6ad0cb9175acc635057232fec96d32eaad4e0237.tar.gz |
Add "default location" support for mounts
The "default location" of the given mount is a path that reflects
the main entry point for the user (e.g. the home directory, or the
root of the volume).
Backends can use g_vfs_backend_set_default_location () to set the
default location (before registering the mount).
https://bugzilla.gnome.org/show_bug.cgi?id=561998
Diffstat (limited to 'daemon/mount.c')
-rw-r--r-- | daemon/mount.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/daemon/mount.c b/daemon/mount.c index 172728f1..31d6cb27 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -43,6 +43,7 @@ typedef struct { char *icon; char *prefered_filename_encoding; gboolean user_visible; + char *default_location; char *fuse_mountpoint; /* Always set, even if fuse not availible */ /* Daemon object ref */ @@ -189,6 +190,7 @@ vfs_mount_free (VfsMount *mount) g_free (mount->icon); g_free (mount->fuse_mountpoint); g_free (mount->prefered_filename_encoding); + g_free (mount->default_location); g_free (mount->dbus_id); g_free (mount->object_path); g_mount_spec_unref (mount->mount_spec); @@ -250,7 +252,6 @@ vfs_mount_to_dbus (VfsMount *mount, DBUS_TYPE_BOOLEAN, &user_visible)) _g_dbus_oom (); - fuse_mountpoint = ""; if (fuse_available && mount->fuse_mountpoint) @@ -259,6 +260,8 @@ vfs_mount_to_dbus (VfsMount *mount, g_mount_spec_to_dbus (&struct_iter, mount->mount_spec); + _g_dbus_message_iter_append_cstring (&struct_iter, mount->default_location); + if (!dbus_message_iter_close_container (iter, &struct_iter)) _g_dbus_oom (); } @@ -671,7 +674,8 @@ register_mount (DBusConnection *connection, VfsMount *mount; DBusMessage *reply; DBusError error; - const char *display_name, *stable_name, *x_content_types, *icon, *obj_path, *id, *prefered_filename_encoding; + const char *display_name, *stable_name, *x_content_types, *icon, *obj_path; + const char *id, *prefered_filename_encoding, *default_location; dbus_bool_t user_visible; DBusMessageIter iter; GMountSpec *mount_spec; @@ -717,6 +721,13 @@ register_mount (DBusConnection *connection, mount->object_path = g_strdup (obj_path); mount->mount_spec = mount_spec; + if (_g_dbus_message_iter_get_args (&iter, NULL, + G_DBUS_TYPE_CSTRING, &default_location, + 0)) + mount->default_location = default_location; + else + mount->default_location = g_strdup (""); + if (user_visible) { char *fs_name; @@ -918,7 +929,7 @@ list_mounts (DBusConnection *connection, dbus_message_iter_init_append (reply, &iter); - + if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_STRUCT_BEGIN_CHAR_AS_STRING @@ -932,6 +943,7 @@ list_mounts (DBusConnection *connection, DBUS_TYPE_BOOLEAN_AS_STRING DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING G_MOUNT_SPEC_TYPE_AS_STRING + DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING DBUS_STRUCT_END_CHAR_AS_STRING, &array_iter)) _g_dbus_oom (); |