summaryrefslogtreecommitdiff
path: root/common
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 /common
parent96daf6359e857818c3255d49c0c7d9375870aaa5 (diff)
downloadgvfs-c47f093895ceb648429ef4ab85004b9c3941438d.tar.gz
Add support for getting symbolic icons
https://bugzilla.gnome.org/show_bug.cgi?id=681458
Diffstat (limited to 'common')
-rw-r--r--common/gmounttracker.c19
-rw-r--r--common/gmounttracker.h1
-rw-r--r--common/org.gtk.vfs.xml11
3 files changed, 25 insertions, 6 deletions
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>