diff options
author | Alexander Larsson <alexl@redhat.com> | 2009-03-05 18:35:49 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2009-03-05 18:35:49 +0000 |
commit | 7c7657db14d93f6b41791c7358d38be7e2cf31d3 (patch) | |
tree | 18e8747eb1a4a0d891f9b4d2ffcde0fbdb987171 /common/gvfsmountinfo.c | |
parent | 7b05ef821218511f60d46ab40c890da0ed8791f3 (diff) | |
download | gvfs-7c7657db14d93f6b41791c7358d38be7e2cf31d3.tar.gz |
Updated .xdg-volume-info format as per bug 551403: + Group name is "Volume
2009-03-05 Alexander Larsson <alexl@redhat.com>
* common/gvfsmountinfo.c:
Updated .xdg-volume-info format as per bug 551403:
+ Group name is "Volume Info"
+ Icon is not translated
+ support IconFile key
svn path=/trunk/; revision=2291
Diffstat (limited to 'common/gvfsmountinfo.c')
-rw-r--r-- | common/gvfsmountinfo.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/common/gvfsmountinfo.c b/common/gvfsmountinfo.c index 585e3bc7..327929f5 100644 --- a/common/gvfsmountinfo.c +++ b/common/gvfsmountinfo.c @@ -27,6 +27,8 @@ #include "gvfsmountinfo.h" +#define VOLUME_INFO_GROUP "Volume Info" + static GFile * _g_find_file_insensitive_finish (GFile *parent, GAsyncResult *result, @@ -271,12 +273,14 @@ on_xdg_volume_info_loaded (GObject *source_object, GKeyFile *key_file; gchar *name; gchar *icon_name; + gchar *icon_file; GIcon *icon; content = NULL; key_file = NULL; name = NULL; icon_name = NULL; + icon_file = NULL; xdg_volume_info_file = G_FILE (source_object); @@ -298,28 +302,48 @@ on_xdg_volume_info_loaded (GObject *source_object, name = g_key_file_get_locale_string (key_file, - "XDG Volume Info", + VOLUME_INFO_GROUP, "Name", NULL, NULL); - icon_name = g_key_file_get_locale_string (key_file, - "XDG Volume Info", - "Icon", - NULL, - NULL); + icon_name = g_key_file_get_string (key_file, + VOLUME_INFO_GROUP, + "Icon", + NULL); + + icon_file = g_key_file_get_string (key_file, + VOLUME_INFO_GROUP, + "IconFile", + NULL); + + icon = NULL; + + if (icon_file != NULL) + { + GFile *dir, *f; - if (icon_name != NULL) + dir = g_file_get_parent (xdg_volume_info_file); + if (dir) + { + f = g_file_resolve_relative_path (dir, icon_file); + if (f) + { + icon = g_file_icon_new (f); + g_object_unref (f); + } + + g_object_unref (dir); + } + } + + if (icon == NULL && icon_name != NULL) { icon = g_themed_icon_new (icon_name); g_themed_icon_append_name (G_THEMED_ICON (icon), "drive-removable-media"); g_themed_icon_append_name (G_THEMED_ICON (icon), "drive-removable"); g_themed_icon_append_name (G_THEMED_ICON (icon), "drive"); } - else - { - icon = NULL; - } g_simple_async_result_set_op_res_gpointer (simple, icon, NULL); g_object_set_data_full (G_OBJECT (simple), "name", name, g_free); @@ -343,6 +367,7 @@ on_xdg_volume_info_loaded (GObject *source_object, g_free (name); g_free (icon_name); + g_free (icon_file); g_free (content); } |