diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-12-01 09:39:10 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-12-01 09:39:10 +0000 |
commit | b1133cc662259843b6ec5c314b389f9a5cc9d84a (patch) | |
tree | bc6b54570b9ea6c3e7fd5e1feb3a5ddd31cde899 /common | |
parent | f8875b2649a0f85624e0da7df96fa6d47840c4a9 (diff) | |
download | gvfs-b1133cc662259843b6ec5c314b389f9a5cc9d84a.tar.gz |
Make mounts/backends have a GIcon not a icon name
2008-12-01 Alexander Larsson <alexl@redhat.com>
* client/gdaemonmount.c:
* common/gmounttracker.[ch]:
* daemon/gvfsbackend.[ch]:
Make mounts/backends have a GIcon not a icon name
* daemon/gvfsbackendsftp.c:
Support /etc/favicon.png
* daemon/gvfsbackendsmbbrowse.c:
Simplify some code with the new GIcon support
Patch from David Zeuthen (#557540)
svn path=/trunk/; revision=2113
Diffstat (limited to 'common')
-rw-r--r-- | common/gmounttracker.c | 23 | ||||
-rw-r--r-- | common/gmounttracker.h | 3 |
2 files changed, 20 insertions, 6 deletions
diff --git a/common/gmounttracker.c b/common/gmounttracker.c index eba29ef5..28550681 100644 --- a/common/gmounttracker.c +++ b/common/gmounttracker.c @@ -90,7 +90,7 @@ g_mount_info_dup (GMountInfo *info) copy->display_name = g_strdup (info->display_name); copy->stable_name = g_strdup (info->stable_name); copy->x_content_types = g_strdup (info->x_content_types); - copy->icon = g_strdup (info->icon); + copy->icon = g_object_ref (info->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,7 +116,7 @@ g_mount_info_unref (GMountInfo *info) g_free (info->display_name); g_free (info->stable_name); g_free (info->x_content_types); - g_free (info->icon); + g_object_unref (info->icon); g_free (info->dbus_id); g_free (info->object_path); g_mount_spec_unref (info->mount_spec); @@ -161,11 +161,13 @@ g_mount_info_from_dbus (DBusMessageIter *iter) char *display_name; char *stable_name; char *x_content_types; - char *icon; + char *icon_str; char *prefered_filename_encoding; char *dbus_id; char *obj_path; char *fuse_mountpoint; + GIcon *icon; + GError *error; if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_STRUCT) return NULL; @@ -178,7 +180,7 @@ g_mount_info_from_dbus (DBusMessageIter *iter) DBUS_TYPE_STRING, &display_name, DBUS_TYPE_STRING, &stable_name, DBUS_TYPE_STRING, &x_content_types, - DBUS_TYPE_STRING, &icon, + DBUS_TYPE_STRING, &icon_str, DBUS_TYPE_STRING, &prefered_filename_encoding, DBUS_TYPE_BOOLEAN, &user_visible, G_DBUS_TYPE_CSTRING, &fuse_mountpoint, @@ -191,12 +193,23 @@ g_mount_info_from_dbus (DBusMessageIter *iter) return NULL; } + if (icon_str == NULL || strlen (icon_str) == 0) + icon_str = "drive-removable-media"; + error = NULL; + icon = g_icon_new_for_string (icon_str, &error); + if (icon == NULL) + { + g_warning ("Malformed icon string '%s': %s", icon_str, error->message); + g_error_free (error); + icon = g_themed_icon_new ("gtk-missing-image"); /* TODO: maybe choose a better name */ + } + 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 = g_strdup (icon); + info->icon = 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 67c91ff1..efad24a9 100644 --- a/common/gmounttracker.h +++ b/common/gmounttracker.h @@ -24,6 +24,7 @@ #define __G_MOUNT_TRACKER_H__ #include <glib-object.h> +#include <gio/gio.h> #include <gmountspec.h> G_BEGIN_DECLS @@ -43,7 +44,7 @@ typedef struct { char *display_name; char *stable_name; char *x_content_types; - char *icon; + GIcon *icon; char *dbus_id; char *object_path; gboolean user_visible; |