summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2012-08-28 18:13:59 -0400
committerWilliam Jon McCann <jmccann@redhat.com>2012-08-30 11:24:19 -0400
commitc47f093895ceb648429ef4ab85004b9c3941438d (patch)
treea1b4f406e29f5206743b015c77d85d81f0df9454
parent96daf6359e857818c3255d49c0c7d9375870aaa5 (diff)
downloadgvfs-c47f093895ceb648429ef4ab85004b9c3941438d.tar.gz
Add support for getting symbolic icons
https://bugzilla.gnome.org/show_bug.cgi?id=681458
-rw-r--r--client/gdaemonmount.c9
-rw-r--r--common/gmounttracker.c19
-rw-r--r--common/gmounttracker.h1
-rw-r--r--common/org.gtk.vfs.xml11
-rw-r--r--daemon/gvfsbackend.c33
-rw-r--r--daemon/gvfsbackend.h5
-rw-r--r--daemon/mount.c9
-rw-r--r--monitor/afc/afcvolume.c17
-rw-r--r--monitor/proxy/dbus-interfaces.xml30
-rw-r--r--monitor/proxy/gproxydrive.c28
-rw-r--r--monitor/proxy/gproxymount.c29
-rw-r--r--monitor/proxy/gproxyshadowmount.c13
-rw-r--r--monitor/proxy/gproxyvolume.c27
-rw-r--r--monitor/proxy/gvfsproxyvolumemonitordaemon.c39
-rw-r--r--programs/gvfs-mount.c37
15 files changed, 273 insertions, 34 deletions
diff --git a/client/gdaemonmount.c b/client/gdaemonmount.c
index 78439cb7..53f22b50 100644
--- a/client/gdaemonmount.c
+++ b/client/gdaemonmount.c
@@ -121,6 +121,14 @@ g_daemon_mount_get_icon (GMount *mount)
return g_object_ref (daemon_mount->mount_info->icon);
}
+static GIcon *
+g_daemon_mount_get_symbolic_icon (GMount *mount)
+{
+ GDaemonMount *daemon_mount = G_DAEMON_MOUNT (mount);
+
+ return g_object_ref (daemon_mount->mount_info->symbolic_icon);
+}
+
static char *
g_daemon_mount_get_name (GMount *mount)
{
@@ -413,6 +421,7 @@ g_daemon_mount_mount_iface_init (GMountIface *iface)
iface->get_root = g_daemon_mount_get_root;
iface->get_name = g_daemon_mount_get_name;
iface->get_icon = g_daemon_mount_get_icon;
+ iface->get_symbolic_icon = g_daemon_mount_get_symbolic_icon;
iface->get_uuid = g_daemon_mount_get_uuid;
iface->get_volume = g_daemon_mount_get_volume;
iface->get_drive = g_daemon_mount_get_drive;
diff --git a/common/gmounttracker.c b/common/gmounttracker.c
index bbca23e5..90b26222 100644
--- a/common/gmounttracker.c
+++ b/common/gmounttracker.c
@@ -89,6 +89,7 @@ g_mount_info_dup (GMountInfo *info)
copy->stable_name = g_strdup (info->stable_name);
copy->x_content_types = g_strdup (info->x_content_types);
copy->icon = g_object_ref (info->icon);
+ copy->symbolic_icon = g_object_ref (info->symbolic_icon);
copy->dbus_id = g_strdup (info->dbus_id);
copy->object_path = g_strdup (info->object_path);
copy->mount_spec = g_mount_spec_copy (info->mount_spec);
@@ -116,6 +117,7 @@ g_mount_info_unref (GMountInfo *info)
g_free (info->stable_name);
g_free (info->x_content_types);
g_object_unref (info->icon);
+ g_object_unref (info->symbolic_icon);
g_free (info->dbus_id);
g_free (info->object_path);
g_mount_spec_unref (info->mount_spec);
@@ -181,22 +183,25 @@ g_mount_info_from_dbus (GVariant *value)
const gchar *stable_name;
const gchar *x_content_types;
const gchar *icon_str;
+ const gchar *symbolic_icon_str;
const gchar *prefered_filename_encoding;
const gchar *dbus_id;
const gchar *obj_path;
const gchar *fuse_mountpoint;
const gchar *default_location;
GIcon *icon;
+ GIcon *symbolic_icon;
GVariant *iter_mount_spec;
GError *error;
- g_variant_get (value, "(&s&o&s&s&s&s&sb^&ay@(aya{sv})^&ay)",
+ g_variant_get (value, "(&s&o&s&s&s&s&s&sb^&ay@(aya{sv})^&ay)",
&dbus_id,
&obj_path,
&display_name,
&stable_name,
&x_content_types,
&icon_str,
+ &symbolic_icon_str,
&prefered_filename_encoding,
&user_visible,
&fuse_mountpoint,
@@ -224,12 +229,24 @@ g_mount_info_from_dbus (GVariant *value)
icon = g_themed_icon_new ("gtk-missing-image"); /* TODO: maybe choose a better name */
}
+ if (symbolic_icon_str == NULL || strlen (symbolic_icon_str) == 0)
+ symbolic_icon_str = "drive-removable-media-symbolic";
+ error = NULL;
+ symbolic_icon = g_icon_new_for_string (symbolic_icon_str, &error);
+ if (symbolic_icon == NULL)
+ {
+ g_warning ("Malformed icon string '%s': %s", symbolic_icon_str, error->message);
+ g_error_free (error);
+ symbolic_icon = g_themed_icon_new ("drive-removable-media-symbolic");
+ }
+
info = g_new0 (GMountInfo, 1);
info->ref_count = 1;
info->display_name = g_strdup (display_name);
info->stable_name = g_strdup (stable_name);
info->x_content_types = g_strdup (x_content_types);
info->icon = icon;
+ info->symbolic_icon = symbolic_icon;
info->dbus_id = g_strdup (dbus_id);
info->object_path = g_strdup (obj_path);
info->mount_spec = mount_spec;
diff --git a/common/gmounttracker.h b/common/gmounttracker.h
index 0b60c2cf..cbd76f8b 100644
--- a/common/gmounttracker.h
+++ b/common/gmounttracker.h
@@ -45,6 +45,7 @@ typedef struct {
char *stable_name;
char *x_content_types;
GIcon *icon;
+ GIcon *symbolic_icon;
char *dbus_id;
char *object_path;
gboolean user_visible;
diff --git a/common/org.gtk.vfs.xml b/common/org.gtk.vfs.xml
index fc68d592..b668352a 100644
--- a/common/org.gtk.vfs.xml
+++ b/common/org.gtk.vfs.xml
@@ -67,18 +67,18 @@
<interface name='org.gtk.vfs.MountTracker'>
<method name="LookupMount">
<arg type='(aya{sv})' name='mount_spec' direction='in'/>
- <arg type='(sosssssbay(aya{sv})ay)' name='mount' direction='out'/>
+ <arg type='(sossssssbay(aya{sv})ay)' name='mount' direction='out'/>
</method>
<method name="LookupMountByFusePath">
<arg type='ay' name='fuse_path' direction='in'/>
- <arg type='(sosssssbay(aya{sv})ay)' name='mount' direction='out'/>
+ <arg type='(sossssssbay(aya{sv})ay)' name='mount' direction='out'/>
</method>
<method name="MountLocation">
<arg type='(aya{sv})' name='mount_spec' direction='in'/>
<arg type='(so)' name='mount_source' direction='in'/>
</method>
<method name="ListMounts">
- <arg type='a(sosssssbay(aya{sv})ay)' name='mounts' direction='out'/>
+ <arg type='a(sossssssbay(aya{sv})ay)' name='mounts' direction='out'/>
</method>
<method name="RegisterMount">
<arg type='o' name='obj_path' direction='in'/>
@@ -86,6 +86,7 @@
<arg type='s' name='stable_name' direction='in'/>
<arg type='s' name='x_content_types' direction='in'/>
<arg type='s' name='icon' direction='in'/>
+ <arg type='s' name='symbolic_icon' direction='in'/>
<arg type='s' name='prefered_filename_encoding' direction='in'/>
<arg type='b' name='user_visible' direction='in'/>
<arg type='(aya{sv})' name='mount_spec' direction='in'/>
@@ -103,10 +104,10 @@
<method name="RegisterFuse">
</method>
<signal name="Mounted">
- <arg type='(sosssssbay(aya{sv})ay)' name='mount'/>
+ <arg type='(sossssssbay(aya{sv})ay)' name='mount'/>
</signal>
<signal name="Unmounted">
- <arg type='(sosssssbay(aya{sv})ay)' name='mount'/>
+ <arg type='(sossssssbay(aya{sv})ay)' name='mount'/>
</signal>
</interface>
diff --git a/daemon/gvfsbackend.c b/daemon/gvfsbackend.c
index bb39fa47..dbe44a0e 100644
--- a/daemon/gvfsbackend.c
+++ b/daemon/gvfsbackend.c
@@ -74,6 +74,7 @@ struct _GVfsBackendPrivate
char *stable_name;
char **x_content_types;
GIcon *icon;
+ GIcon *symbolic_icon;
char *prefered_filename_encoding;
gboolean user_visible;
char *default_location;
@@ -148,6 +149,7 @@ g_vfs_backend_finalize (GObject *object)
g_free (backend->priv->stable_name);
g_strfreev (backend->priv->x_content_types);
g_clear_object (&backend->priv->icon);
+ g_clear_object (&backend->priv->symbolic_icon);
g_free (backend->priv->prefered_filename_encoding);
g_free (backend->priv->default_location);
if (backend->priv->mount_spec)
@@ -197,6 +199,7 @@ g_vfs_backend_init (GVfsBackend *backend)
{
backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend, G_VFS_TYPE_BACKEND, GVfsBackendPrivate);
backend->priv->icon = NULL;
+ backend->priv->symbolic_icon = NULL;
backend->priv->prefered_filename_encoding = g_strdup ("");
backend->priv->display_name = g_strdup ("");
backend->priv->stable_name = g_strdup ("");
@@ -400,6 +403,22 @@ g_vfs_backend_set_icon (GVfsBackend *backend,
}
void
+g_vfs_backend_set_symbolic_icon_name (GVfsBackend *backend,
+ const char *icon_name)
+{
+ g_clear_object (&backend->priv->symbolic_icon);
+ backend->priv->symbolic_icon = g_themed_icon_new_with_default_fallbacks (icon_name);
+}
+
+void
+g_vfs_backend_set_symbolic_icon (GVfsBackend *backend,
+ GIcon *icon)
+{
+ g_clear_object (&backend->priv->symbolic_icon);
+ backend->priv->symbolic_icon = g_object_ref (icon);
+}
+
+void
g_vfs_backend_set_prefered_filename_encoding (GVfsBackend *backend,
const char *prefered_filename_encoding)
{
@@ -475,6 +494,12 @@ g_vfs_backend_get_icon (GVfsBackend *backend)
return backend->priv->icon;
}
+GIcon *
+g_vfs_backend_get_symbolic_icon (GVfsBackend *backend)
+{
+ return backend->priv->symbolic_icon;
+}
+
const char *
g_vfs_backend_get_default_location (GVfsBackend *backend)
{
@@ -635,6 +660,7 @@ register_mount_got_proxy_cb (GObject *source_object,
const char *stable_name;
char *x_content_types_string;
char *icon_str;
+ char *symbolic_icon_str;
proxy = gvfs_dbus_mount_tracker_proxy_new_for_bus_finish (res, &error);
if (proxy == NULL)
@@ -662,6 +688,11 @@ register_mount_got_proxy_cb (GObject *source_object,
else
icon_str = g_strdup ("");
+ if (backend->priv->symbolic_icon != NULL)
+ symbolic_icon_str = g_icon_to_string (backend->priv->symbolic_icon);
+ else
+ symbolic_icon_str = g_strdup ("");
+
if (backend->priv->stable_name != NULL &&
*backend->priv->stable_name != 0)
stable_name = backend->priv->stable_name;
@@ -674,6 +705,7 @@ register_mount_got_proxy_cb (GObject *source_object,
stable_name,
x_content_types_string,
icon_str,
+ symbolic_icon_str,
backend->priv->prefered_filename_encoding,
backend->priv->user_visible,
g_mount_spec_to_dbus (backend->priv->mount_spec),
@@ -683,6 +715,7 @@ register_mount_got_proxy_cb (GObject *source_object,
g_free (x_content_types_string);
g_free (icon_str);
+ g_free (symbolic_icon_str);
g_object_unref (proxy);
async_proxy_create_free (data);
}
diff --git a/daemon/gvfsbackend.h b/daemon/gvfsbackend.h
index 8ba3d038..a69912bd 100644
--- a/daemon/gvfsbackend.h
+++ b/daemon/gvfsbackend.h
@@ -467,6 +467,10 @@ void g_vfs_backend_set_icon_name (GVfsBackend *ba
const char *icon_name);
void g_vfs_backend_set_icon (GVfsBackend *backend,
GIcon *icon);
+void g_vfs_backend_set_symbolic_icon_name (GVfsBackend *backend,
+ const char *icon_name);
+void g_vfs_backend_set_symbolic_icon (GVfsBackend *backend,
+ GIcon *icon);
void g_vfs_backend_set_prefered_filename_encoding (GVfsBackend *backend,
const char *prefered_filename_encoding);
void g_vfs_backend_set_user_visible (GVfsBackend *backend,
@@ -486,6 +490,7 @@ const char *g_vfs_backend_get_display_name (GVfsBackend *ba
const char *g_vfs_backend_get_stable_name (GVfsBackend *backend);
char **g_vfs_backend_get_x_content_types (GVfsBackend *backend);
GIcon *g_vfs_backend_get_icon (GVfsBackend *backend);
+GIcon *g_vfs_backend_get_symbolic_icon (GVfsBackend *backend);
const char *g_vfs_backend_get_default_location (GVfsBackend *backend);
GMountSpec *g_vfs_backend_get_mount_spec (GVfsBackend *backend);
GVfsDaemon *g_vfs_backend_get_daemon (GVfsBackend *backend);
diff --git a/daemon/mount.c b/daemon/mount.c
index 7b58dc4f..edbba5aa 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -39,6 +39,7 @@ typedef struct {
char *stable_name;
char *x_content_types;
char *icon;
+ char *symbolic_icon;
char *prefered_filename_encoding;
gboolean user_visible;
char *default_location;
@@ -187,6 +188,7 @@ vfs_mount_free (VfsMount *mount)
g_free (mount->stable_name);
g_free (mount->x_content_types);
g_free (mount->icon);
+ g_free (mount->symbolic_icon);
g_free (mount->fuse_mountpoint);
g_free (mount->prefered_filename_encoding);
g_free (mount->default_location);
@@ -199,19 +201,20 @@ vfs_mount_free (VfsMount *mount)
/* Keep in sync with dbus-interfaces.xml */
-#define VFS_MOUNT_ARRAY_DBUS_STRUCT_TYPE "a(sosssssbay(aya{sv})ay)"
+#define VFS_MOUNT_ARRAY_DBUS_STRUCT_TYPE "a(sossssssbay(aya{sv})ay)"
#define VFS_MOUNTABLE_ARRAY_DBUS_STRUCT_TYPE "a(ssasib)"
static GVariant *
vfs_mount_to_dbus (VfsMount *mount)
{
- return g_variant_new ("(sosssssb^ay@(aya{sv})^ay)",
+ return g_variant_new ("(sossssssb^ay@(aya{sv})^ay)",
mount->dbus_id,
mount->object_path,
mount->display_name,
mount->stable_name,
mount->x_content_types,
mount->icon,
+ mount->symbolic_icon,
mount->prefered_filename_encoding,
mount->user_visible,
(fuse_available && mount->fuse_mountpoint) ? mount->fuse_mountpoint : "",
@@ -593,6 +596,7 @@ handle_register_mount (GVfsDBusMountTracker *object,
const gchar *arg_stable_name,
const gchar *arg_x_content_types,
const gchar *arg_icon,
+ const gchar *arg_symbolic_icon,
const gchar *arg_prefered_filename_encoding,
gboolean arg_user_visible,
GVariant *arg_mount_spec,
@@ -630,6 +634,7 @@ handle_register_mount (GVfsDBusMountTracker *object,
mount->stable_name = g_strdup (arg_stable_name);
mount->x_content_types = g_strdup (arg_x_content_types);
mount->icon = g_strdup (arg_icon);
+ mount->symbolic_icon = g_strdup (arg_symbolic_icon);
mount->prefered_filename_encoding = g_strdup (arg_prefered_filename_encoding);
mount->user_visible = arg_user_visible;
mount->dbus_id = g_strdup (id);
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index 3669b27c..9829077c 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -25,6 +25,7 @@ struct _GVfsAfcVolume {
char *name;
char *icon;
+ char *symbolic_icon;
char *icon_fallback;
};
@@ -45,6 +46,7 @@ g_vfs_afc_volume_finalize (GObject *object)
g_free (self->name);
g_free (self->icon);
+ g_free (self->symbolic_icon);
g_free (self->icon_fallback);
if (G_OBJECT_CLASS(g_vfs_afc_volume_parent_class)->finalize)
@@ -58,6 +60,7 @@ g_vfs_afc_volume_init (GVfsAfcVolume *self)
afc_volume->name = g_strdup ("iPhone");
afc_volume->icon = g_strdup ("phone-apple-iphone");
+ afc_volume->symbolic_icon = g_strdup ("phone-apple-iphone-symbolic");
}
static void
@@ -138,11 +141,13 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
{
g_free (self->icon);
self->icon = g_strdup ("multimedia-player-apple-ipod-touch");
+ self->symbolic_icon = g_strdup ("multimedia-player-apple-ipod-touch-symbolic");
}
else if (g_str_equal(model, "iPad") != FALSE)
{
g_free (self->icon);
self->icon = g_strdup ("computer-apple-ipad");
+ self->symbolic_icon = g_strdup ("computer-apple-ipad-symbolic");
}
g_free (model);
plist_free (value);
@@ -207,6 +212,17 @@ g_vfs_afc_volume_get_icon (GVolume *volume)
return icon;
}
+static GIcon *
+g_vfs_afc_volume_get_symbolic_icon (GVolume *volume)
+{
+ GVfsAfcVolume *afc_volume = G_VFS_AFC_VOLUME (volume);
+ GIcon *icon;
+
+ icon = g_themed_icon_new_with_default_fallbacks (afc_volume->symbolic_icon);
+
+ return icon;
+}
+
static char *
g_vfs_afc_volume_get_uuid (GVolume *volume)
{
@@ -355,6 +371,7 @@ g_vfs_afc_volume_iface_init (GVolumeIface *iface)
{
iface->get_name = g_vfs_afc_volume_get_name;
iface->get_icon = g_vfs_afc_volume_get_icon;
+ iface->get_symbolic_icon = g_vfs_afc_volume_get_symbolic_icon;
iface->get_uuid = g_vfs_afc_volume_get_uuid;
iface->get_drive = g_vfs_afc_volume_get_drive;
iface->get_mount = g_vfs_afc_volume_get_mount;
diff --git a/monitor/proxy/dbus-interfaces.xml b/monitor/proxy/dbus-interfaces.xml
index 6fb445c0..e9a9c29a 100644
--- a/monitor/proxy/dbus-interfaces.xml
+++ b/monitor/proxy/dbus-interfaces.xml
@@ -30,62 +30,62 @@
<signal name="DriveChanged">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
+ <arg type='(ssssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
</signal>
<signal name="DriveConnected">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
+ <arg type='(ssssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
</signal>
<signal name="DriveDisconnected">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
+ <arg type='(ssssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
</signal>
<signal name="DriveEjectButton">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
+ <arg type='(ssssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
</signal>
<signal name="DriveStopButton">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
+ <arg type='(ssssbbbbbbbbuasa{ss}sa{sv})' name='drive'/>
</signal>
<signal name="VolumeChanged">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbbssa{ss}sa{sv})' name='volume'/>
+ <arg type='(ssssssbbssa{ss}sa{sv})' name='volume'/>
</signal>
<signal name="VolumeAdded">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbbssa{ss}sa{sv})' name='volume'/>
+ <arg type='(ssssssbbssa{ss}sa{sv})' name='volume'/>
</signal>
<signal name="VolumeRemoved">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbbssa{ss}sa{sv})' name='volume'/>
+ <arg type='(ssssssbbssa{ss}sa{sv})' name='volume'/>
</signal>
<signal name="MountChanged">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbsassa{sv})' name='mount'/>
+ <arg type='(ssssssbsassa{sv})' name='mount'/>
</signal>
<signal name="MountAdded">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbsassa{sv})' name='mount'/>
+ <arg type='(ssssssbsassa{sv})' name='mount'/>
</signal>
<signal name="MountPreUnmount">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbsassa{sv})' name='mount'/>
+ <arg type='(ssssssbsassa{sv})' name='mount'/>
</signal>
<signal name="MountRemoved">
<arg type='s' name='dbus_name'/>
<arg type='s' name='id'/>
- <arg type='(sssssbsassa{sv})' name='mount'/>
+ <arg type='(ssssssbsassa{sv})' name='mount'/>
</signal>
<signal name="MountOpAskPassword">
<arg type='s' name='dbus_name'/>
@@ -126,9 +126,9 @@
<arg type='b' name='is_supported' direction='out'/>
</method>
<method name="List">
- <arg type='a(sssbbbbbbbbuasa{ss}sa{sv})' name='drives' direction='out'/>
- <arg type='a(sssssbbssa{ss}sa{sv})' name='volumes' direction='out'/>
- <arg type='a(sssssbsassa{sv})' name='mounts' direction='out'/>
+ <arg type='a(ssssbbbbbbbbuasa{ss}sa{sv})' name='drives' direction='out'/>
+ <arg type='a(ssssssbbssa{ss}sa{sv})' name='volumes' direction='out'/>
+ <arg type='a(ssssssbsassa{sv})' name='mounts' direction='out'/>
</method>
<method name="CancelOperation">
<arg type='s' name='cancellation_id' direction='in'/>
diff --git a/monitor/proxy/gproxydrive.c b/monitor/proxy/gproxydrive.c
index 32c54241..feaf6d51 100644
--- a/monitor/proxy/gproxydrive.c
+++ b/monitor/proxy/gproxydrive.c
@@ -47,6 +47,7 @@ struct _GProxyDrive {
char *id;
char *name;
GIcon *icon;
+ GIcon *symbolic_icon;
char **volume_ids;
gboolean can_eject;
gboolean can_poll_for_media;
@@ -82,6 +83,8 @@ g_proxy_drive_finalize (GObject *object)
g_free (drive->name);
if (drive->icon != NULL)
g_object_unref (drive->icon);
+ if (drive->symbolic_icon != NULL)
+ g_object_unref (drive->symbolic_icon);
g_strfreev (drive->volume_ids);
if (drive->identifiers != NULL)
g_hash_table_unref (drive->identifiers);
@@ -124,6 +127,7 @@ g_proxy_drive_new (GProxyVolumeMonitor *volume_monitor)
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* boolean can-eject
* boolean can-poll-for-media
* boolean has-media
@@ -138,7 +142,7 @@ g_proxy_drive_new (GProxyVolumeMonitor *volume_monitor)
* string sort_key
* a{sv} expansion
*/
-#define DRIVE_STRUCT_TYPE "(&s&s&sbbbbbbbbuasa{ss}&sa{sv})"
+#define DRIVE_STRUCT_TYPE "(&s&s&s&sbbbbbbbbuasa{ss}&sa{sv})"
void
g_proxy_drive_update (GProxyDrive *drive,
@@ -147,6 +151,7 @@ g_proxy_drive_update (GProxyDrive *drive,
const char *id;
const char *name;
const char *gicon_data;
+ const char *symbolic_gicon_data = NULL;
gboolean can_eject;
gboolean can_poll_for_media;
gboolean has_media;
@@ -168,6 +173,7 @@ g_proxy_drive_update (GProxyDrive *drive,
sort_key = NULL;
g_variant_get (iter, DRIVE_STRUCT_TYPE,
&id, &name, &gicon_data,
+ &symbolic_gicon_data,
&can_eject, &can_poll_for_media,
&has_media, &is_media_removable,
&is_media_check_automatic,
@@ -201,6 +207,8 @@ g_proxy_drive_update (GProxyDrive *drive,
g_free (drive->name);
if (drive->icon != NULL)
g_object_unref (drive->icon);
+ if (drive->symbolic_icon != NULL)
+ g_object_unref (drive->symbolic_icon);
g_strfreev (drive->volume_ids);
if (drive->identifiers != NULL)
g_hash_table_unref (drive->identifiers);
@@ -213,6 +221,10 @@ g_proxy_drive_update (GProxyDrive *drive,
drive->icon = NULL;
else
drive->icon = g_icon_new_for_string (gicon_data, NULL);
+ if (*symbolic_gicon_data == 0)
+ drive->symbolic_icon = NULL;
+ else
+ drive->symbolic_icon = g_icon_new_for_string (symbolic_gicon_data, NULL);
drive->can_eject = can_eject;
drive->can_poll_for_media = can_poll_for_media;
drive->has_media = has_media;
@@ -249,6 +261,19 @@ g_proxy_drive_get_icon (GDrive *drive)
return icon;
}
+static GIcon *
+g_proxy_drive_get_symbolic_icon (GDrive *drive)
+{
+ GProxyDrive *proxy_drive = G_PROXY_DRIVE (drive);
+ GIcon *icon;
+
+ G_LOCK (proxy_drive);
+ icon = proxy_drive->symbolic_icon != NULL ? g_object_ref (proxy_drive->symbolic_icon) : NULL;
+ G_UNLOCK (proxy_drive);
+
+ return icon;
+}
+
static char *
g_proxy_drive_get_name (GDrive *drive)
{
@@ -1124,6 +1149,7 @@ g_proxy_drive_drive_iface_init (GDriveIface *iface)
{
iface->get_name = g_proxy_drive_get_name;
iface->get_icon = g_proxy_drive_get_icon;
+ iface->get_symbolic_icon = g_proxy_drive_get_symbolic_icon;
iface->has_volumes = g_proxy_drive_has_volumes;
iface->get_volumes = g_proxy_drive_get_volumes;
iface->is_media_removable = g_proxy_drive_is_media_removable;
diff --git a/monitor/proxy/gproxymount.c b/monitor/proxy/gproxymount.c
index ab7e1a7a..64e128d6 100644
--- a/monitor/proxy/gproxymount.c
+++ b/monitor/proxy/gproxymount.c
@@ -52,6 +52,7 @@ struct _GProxyMount {
char **x_content_types;
GFile *root;
GIcon *icon;
+ GIcon *symbolic_icon;
gchar *sort_key;
};
@@ -75,6 +76,8 @@ g_proxy_mount_finalize (GObject *object)
g_strfreev (mount->x_content_types);
if (mount->icon != NULL)
g_object_unref (mount->icon);
+ if (mount->symbolic_icon != NULL)
+ g_object_unref (mount->symbolic_icon);
if (mount->root != NULL)
g_object_unref (mount->root);
@@ -136,14 +139,17 @@ g_proxy_mount_has_mount_path (GProxyMount *mount, const char *mount_path)
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* string uuid
* string root_uri
* boolean can-unmount
* string volume-id
* array:string x-content-types
+ * string sort_key
+ * a{sv} expansion
*/
-#define MOUNT_STRUCT_TYPE "(&s&s&s&s&sb&sas&sa{sv})"
+#define MOUNT_STRUCT_TYPE "(&s&s&s&s&s&sb&sas&sa{sv})"
void
g_proxy_mount_update (GProxyMount *mount,
@@ -152,6 +158,7 @@ g_proxy_mount_update (GProxyMount *mount,
const char *id;
const char *name;
const char *gicon_data;
+ const char *symbolic_gicon_data = NULL;
const char *uuid;
const char *root_uri;
gboolean can_unmount;
@@ -165,6 +172,7 @@ g_proxy_mount_update (GProxyMount *mount,
sort_key = NULL;
g_variant_get (iter, MOUNT_STRUCT_TYPE,
&id, &name, &gicon_data,
+ &symbolic_gicon_data,
&uuid, &root_uri,
&can_unmount, &volume_id,
&iter_content_types,
@@ -196,6 +204,8 @@ g_proxy_mount_update (GProxyMount *mount,
g_free (mount->volume_id);
if (mount->icon != NULL)
g_object_unref (mount->icon);
+ if (mount->symbolic_icon != NULL)
+ g_object_unref (mount->symbolic_icon);
g_strfreev (mount->x_content_types);
if (mount->root != NULL)
g_object_unref (mount->root);
@@ -208,6 +218,10 @@ g_proxy_mount_update (GProxyMount *mount,
mount->icon = NULL;
else
mount->icon = g_icon_new_for_string (gicon_data, NULL);
+ if (*symbolic_gicon_data == 0)
+ mount->symbolic_icon = NULL;
+ else
+ mount->symbolic_icon = g_icon_new_for_string (symbolic_gicon_data, NULL);
mount->uuid = g_strdup (uuid);
mount->root = g_file_new_for_uri (root_uri);
mount->can_unmount = can_unmount;
@@ -253,6 +267,18 @@ g_proxy_mount_get_icon (GMount *mount)
return icon;
}
+static GIcon *
+g_proxy_mount_get_symbolic_icon (GMount *mount)
+{
+ GProxyMount *proxy_mount = G_PROXY_MOUNT (mount);
+ GIcon *icon;
+
+ G_LOCK (proxy_mount);
+ icon = proxy_mount->symbolic_icon != NULL ? g_object_ref (proxy_mount->symbolic_icon) : NULL;
+ G_UNLOCK (proxy_mount);
+ return icon;
+}
+
static char *
g_proxy_mount_get_uuid (GMount *mount)
{
@@ -684,6 +710,7 @@ g_proxy_mount_mount_iface_init (GMountIface *iface)
iface->get_root = g_proxy_mount_get_root;
iface->get_name = g_proxy_mount_get_name;
iface->get_icon = g_proxy_mount_get_icon;
+ iface->get_symbolic_icon = g_proxy_mount_get_symbolic_icon;
iface->get_uuid = g_proxy_mount_get_uuid;
iface->get_drive = g_proxy_mount_get_drive;
iface->get_volume = g_proxy_mount_get_volume;
diff --git a/monitor/proxy/gproxyshadowmount.c b/monitor/proxy/gproxyshadowmount.c
index ecacd2f1..a16ce9c1 100644
--- a/monitor/proxy/gproxyshadowmount.c
+++ b/monitor/proxy/gproxyshadowmount.c
@@ -210,6 +210,18 @@ g_proxy_shadow_mount_get_icon (GMount *mount)
return icon;
}
+static GIcon *
+g_proxy_shadow_mount_get_symbolic_icon (GMount *mount)
+{
+ GProxyShadowMount *proxy_shadow_mount = G_PROXY_SHADOW_MOUNT (mount);
+ GIcon *icon;
+
+ G_LOCK (proxy_shadow_mount);
+ icon = g_volume_get_symbolic_icon (G_VOLUME (proxy_shadow_mount->volume));
+ G_UNLOCK (proxy_shadow_mount);
+ return icon;
+}
+
static char *
g_proxy_shadow_mount_get_uuid (GMount *mount)
{
@@ -494,6 +506,7 @@ g_proxy_shadow_mount_mount_iface_init (GMountIface *iface)
iface->get_root = g_proxy_shadow_mount_get_root;
iface->get_name = g_proxy_shadow_mount_get_name;
iface->get_icon = g_proxy_shadow_mount_get_icon;
+ iface->get_symbolic_icon = g_proxy_shadow_mount_get_symbolic_icon;
iface->get_uuid = g_proxy_shadow_mount_get_uuid;
iface->get_drive = g_proxy_shadow_mount_get_drive;
iface->get_volume = g_proxy_shadow_mount_get_volume;
diff --git a/monitor/proxy/gproxyvolume.c b/monitor/proxy/gproxyvolume.c
index 0995218f..4553ad99 100644
--- a/monitor/proxy/gproxyvolume.c
+++ b/monitor/proxy/gproxyvolume.c
@@ -55,6 +55,7 @@ struct _GProxyVolume {
char *uuid;
char *activation_uri;
GIcon *icon;
+ GIcon *symbolic_icon;
char *drive_id;
char *mount_id;
GHashTable *identifiers;
@@ -110,6 +111,8 @@ g_proxy_volume_finalize (GObject *object)
g_free (volume->activation_uri);
if (volume->icon != NULL)
g_object_unref (volume->icon);
+ if (volume->symbolic_icon != NULL)
+ g_object_unref (volume->symbolic_icon);
g_free (volume->drive_id);
g_free (volume->mount_id);
if (volume->identifiers != NULL)
@@ -342,6 +345,7 @@ update_shadow_mount_in_idle (GProxyVolume *volume)
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* string uuid
* string activation_uri
* boolean can-mount
@@ -353,7 +357,7 @@ update_shadow_mount_in_idle (GProxyVolume *volume)
* a{sv} expansion
*/
-#define VOLUME_STRUCT_TYPE "(&s&s&s&s&sbb&s&sa{ss}&sa{sv})"
+#define VOLUME_STRUCT_TYPE "(&s&s&s&s&s&sbb&s&sa{ss}&sa{sv})"
void g_proxy_volume_update (GProxyVolume *volume,
GVariant *iter)
@@ -361,6 +365,7 @@ void g_proxy_volume_update (GProxyVolume *volume,
const char *id;
const char *name;
const char *gicon_data;
+ const char *symbolic_gicon_data = NULL;
const char *uuid;
const char *activation_uri;
const char *drive_id;
@@ -375,6 +380,7 @@ void g_proxy_volume_update (GProxyVolume *volume,
sort_key = NULL;
g_variant_get (iter, VOLUME_STRUCT_TYPE,
&id, &name, &gicon_data,
+ &symbolic_gicon_data,
&uuid, &activation_uri,
&can_mount, &should_automount,
&drive_id, &mount_id,
@@ -406,6 +412,8 @@ void g_proxy_volume_update (GProxyVolume *volume,
g_free (volume->activation_uri);
if (volume->icon != NULL)
g_object_unref (volume->icon);
+ if (volume->symbolic_icon != NULL)
+ g_object_unref (volume->symbolic_icon);
g_free (volume->drive_id);
g_free (volume->mount_id);
if (volume->identifiers != NULL)
@@ -421,6 +429,10 @@ void g_proxy_volume_update (GProxyVolume *volume,
volume->icon = NULL;
else
volume->icon = g_icon_new_for_string (gicon_data, NULL);
+ if (*symbolic_gicon_data == 0)
+ volume->symbolic_icon = NULL;
+ else
+ volume->symbolic_icon = g_icon_new_for_string (symbolic_gicon_data, NULL);
volume->drive_id = g_strdup (drive_id);
volume->mount_id = g_strdup (mount_id);
volume->can_mount = can_mount;
@@ -457,6 +469,18 @@ g_proxy_volume_get_icon (GVolume *volume)
return icon;
}
+static GIcon *
+g_proxy_volume_get_symbolic_icon (GVolume *volume)
+{
+ GProxyVolume *proxy_volume = G_PROXY_VOLUME (volume);
+ GIcon *icon;
+
+ G_LOCK (proxy_volume);
+ icon = proxy_volume->symbolic_icon != NULL ? g_object_ref (proxy_volume->symbolic_icon) : NULL;
+ G_UNLOCK (proxy_volume);
+ return icon;
+}
+
static char *
g_proxy_volume_get_name (GVolume *volume)
{
@@ -970,6 +994,7 @@ g_proxy_volume_volume_iface_init (GVolumeIface *iface)
{
iface->get_name = g_proxy_volume_get_name;
iface->get_icon = g_proxy_volume_get_icon;
+ iface->get_symbolic_icon = g_proxy_volume_get_symbolic_icon;
iface->get_uuid = g_proxy_volume_get_uuid;
iface->get_drive = g_proxy_volume_get_drive;
iface->get_mount = g_proxy_volume_get_mount;
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index 83ff1909..446eb0f5 100644
--- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c
+++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
@@ -516,6 +516,7 @@ static void monitor_try_create (void);
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* boolean can-eject
* boolean can-poll-for-media
* boolean has-media
@@ -530,7 +531,7 @@ static void monitor_try_create (void);
* string sort_key
* a{sv} expansion
*/
-#define DRIVE_STRUCT_TYPE "(sssbbbbbbbbuasa{ss}sa{sv})"
+#define DRIVE_STRUCT_TYPE "(ssssbbbbbbbbuasa{ss}sa{sv})"
static GVariant *
drive_to_dbus (GDrive *drive)
@@ -538,7 +539,9 @@ drive_to_dbus (GDrive *drive)
char *id;
char *name;
GIcon *icon;
+ GIcon *symbolic_icon;
char *icon_data;
+ char *symbolic_icon_data;
gboolean can_eject;
gboolean can_poll_for_media;
gboolean has_media;
@@ -565,6 +568,11 @@ drive_to_dbus (GDrive *drive)
icon_data = g_icon_to_string (icon);
else
icon_data = g_strdup ("");
+ symbolic_icon = g_drive_get_symbolic_icon (drive);
+ if (symbolic_icon)
+ symbolic_icon_data = g_icon_to_string (symbolic_icon);
+ else
+ symbolic_icon_data = g_strdup ("");
can_eject = g_drive_can_eject (drive);
can_poll_for_media = g_drive_can_poll_for_media (drive);
has_media = g_drive_has_media (drive);
@@ -624,6 +632,7 @@ drive_to_dbus (GDrive *drive)
id,
name,
icon_data,
+ symbolic_icon_data,
can_eject,
can_poll_for_media,
has_media,
@@ -647,6 +656,8 @@ drive_to_dbus (GDrive *drive)
g_list_free (volumes);
g_free (icon_data);
g_object_unref (icon);
+ g_free (symbolic_icon_data);
+ g_object_unref (symbolic_icon);
g_free (name);
g_free (id);
@@ -656,6 +667,7 @@ drive_to_dbus (GDrive *drive)
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* string uuid
* string activation_uri
* boolean can-mount
@@ -666,7 +678,7 @@ drive_to_dbus (GDrive *drive)
* string sort_key
* a{sv} expansion
*/
-#define VOLUME_STRUCT_TYPE "(sssssbbssa{ss}sa{sv})"
+#define VOLUME_STRUCT_TYPE "(ssssssbbssa{ss}sa{sv})"
static GVariant *
volume_to_dbus (GVolume *volume)
@@ -675,6 +687,8 @@ volume_to_dbus (GVolume *volume)
char *name;
GIcon *icon;
char *icon_data;
+ GIcon *symbolic_icon;
+ char *symbolic_icon_data;
char *uuid;
GFile *activation_root;
char *activation_uri;
@@ -699,6 +713,11 @@ volume_to_dbus (GVolume *volume)
icon_data = g_icon_to_string (icon);
else
icon_data = g_strdup ("");
+ symbolic_icon = g_volume_get_symbolic_icon (volume);
+ if (symbolic_icon)
+ symbolic_icon_data = g_icon_to_string (symbolic_icon);
+ else
+ symbolic_icon_data = g_strdup ("");
uuid = g_volume_get_uuid (volume);
activation_root = g_volume_get_activation_root (volume);
if (activation_root == NULL)
@@ -749,6 +768,7 @@ volume_to_dbus (GVolume *volume)
id,
name,
icon_data,
+ symbolic_icon_data,
uuid,
activation_uri,
can_mount,
@@ -775,6 +795,8 @@ volume_to_dbus (GVolume *volume)
g_free (activation_uri);
g_free (icon_data);
g_object_unref (icon);
+ g_free (symbolic_icon_data);
+ g_object_unref (symbolic_icon);
g_free (name);
g_free (id);
@@ -784,6 +806,7 @@ volume_to_dbus (GVolume *volume)
/* string id
* string name
* string gicon_data
+ * string symbolic_gicon_data
* string uuid
* string root_uri
* boolean can-unmount
@@ -792,7 +815,7 @@ volume_to_dbus (GVolume *volume)
* string sort_key
* a{sv} expansion
*/
-#define MOUNT_STRUCT_TYPE "(sssssbsassa{sv})"
+#define MOUNT_STRUCT_TYPE "(ssssssbsassa{sv})"
static GVariant *
mount_to_dbus (GMount *mount)
@@ -801,6 +824,8 @@ mount_to_dbus (GMount *mount)
char *name;
GIcon *icon;
char *icon_data;
+ GIcon *symbolic_icon;
+ char *symbolic_icon_data;
char *uuid;
GFile *root;
char *root_uri;
@@ -821,6 +846,11 @@ mount_to_dbus (GMount *mount)
icon_data = g_icon_to_string (icon);
else
icon_data = g_strdup ("");
+ symbolic_icon = g_mount_get_symbolic_icon (mount);
+ if (symbolic_icon)
+ symbolic_icon_data = g_icon_to_string (symbolic_icon);
+ else
+ symbolic_icon_data = g_strdup ("");
uuid = g_mount_get_uuid (mount);
root = g_mount_get_root (mount);
root_uri = g_file_get_uri (root);
@@ -855,6 +885,7 @@ mount_to_dbus (GMount *mount)
id,
name,
icon_data,
+ symbolic_icon_data,
uuid,
root_uri,
can_unmount,
@@ -874,6 +905,8 @@ mount_to_dbus (GMount *mount)
g_free (uuid);
g_free (icon_data);
g_object_unref (icon);
+ g_free (symbolic_icon_data);
+ g_object_unref (symbolic_icon);
g_free (name);
g_free (id);
diff --git a/programs/gvfs-mount.c b/programs/gvfs-mount.c
index 1188ad93..2addcee7 100644
--- a/programs/gvfs-mount.c
+++ b/programs/gvfs-mount.c
@@ -351,12 +351,12 @@ iterate_gmain(void)
}
static void
-show_themed_icon_names (GThemedIcon *icon, int indent)
+show_themed_icon_names (GThemedIcon *icon, gboolean symbolic, int indent)
{
char **names;
char **iter;
- g_print ("%*sthemed icons:", indent, " ");
+ g_print ("%*s%sthemed icons:", indent, " ", symbolic ? "symbolic " : "");
names = NULL;
@@ -472,7 +472,16 @@ list_mounts (GList *mounts,
if (icon)
{
if (G_IS_THEMED_ICON (icon))
- show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);
+ show_themed_icon_names (G_THEMED_ICON (icon), FALSE, indent + 2);
+
+ g_object_unref (icon);
+ }
+
+ icon = g_mount_get_symbolic_icon (mount);
+ if (icon)
+ {
+ if (G_IS_THEMED_ICON (icon))
+ show_themed_icon_names (G_THEMED_ICON (icon), TRUE, indent + 2);
g_object_unref (icon);
}
@@ -576,7 +585,16 @@ list_volumes (GList *volumes,
if (icon)
{
if (G_IS_THEMED_ICON (icon))
- show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);
+ show_themed_icon_names (G_THEMED_ICON (icon), FALSE, indent + 2);
+
+ g_object_unref (icon);
+ }
+
+ icon = g_volume_get_symbolic_icon (volume);
+ if (icon)
+ {
+ if (G_IS_THEMED_ICON (icon))
+ show_themed_icon_names (G_THEMED_ICON (icon), TRUE, indent + 2);
g_object_unref (icon);
}
@@ -649,10 +667,19 @@ list_drives (GList *drives,
if (icon)
{
if (G_IS_THEMED_ICON (icon))
- show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);
+ show_themed_icon_names (G_THEMED_ICON (icon), FALSE, indent + 2);
g_object_unref (icon);
}
+ icon = g_drive_get_symbolic_icon (drive);
+ if (icon)
+ {
+ if (G_IS_THEMED_ICON (icon))
+ show_themed_icon_names (G_THEMED_ICON (icon), TRUE, indent + 2);
+
+ g_object_unref (icon);
+ }
+
g_print ("%*sis_media_removable=%d\n", indent + 2, "", g_drive_is_media_removable (drive));
g_print ("%*shas_media=%d\n", indent + 2, "", g_drive_has_media (drive));
g_print ("%*sis_media_check_automatic=%d\n", indent + 2, "", g_drive_is_media_check_automatic (drive));