diff options
author | Richard Hughes <richard@hughsie.com> | 2008-10-20 11:15:36 +0000 |
---|---|---|
committer | Richard Hughes <rhughes@src.gnome.org> | 2008-10-20 11:15:36 +0000 |
commit | a1bee70a1fcd53a6540b9d8198979306d6a4125b (patch) | |
tree | 132681285ee36a4d1666230fc1cfa532cee2607f /programs/gvfs-info.c | |
parent | 4701ffe4518bc367c9403f7adec85348cb3f71ff (diff) | |
download | gvfs-a1bee70a1fcd53a6540b9d8198979306d6a4125b.tar.gz |
reviewed by: Christian Kellner <ck@xatom.net>
2008-10-20 Richard Hughes <richard@hughsie.com>
reviewed by: Christian Kellner <ck@xatom.net>
* programs/gvfs-info.c: (show_attributes):
Whilst debugging an icon theme bug, I wanted to know what icon
would be chosen for a file. It turns out gvfs-info gets all the
properties and prints them, but for an icon prints:
standard::icon: GThemedIcon:0x8df7200
This isn't very helpful. I've fixed this to print out the icons and
the order they should be chosen like:
standard::icon: (fallbacks: FALSE)
1. name:application-x-cd-image
2. name:gnome-mime-application-x-cd-image
3. name:application-x-generic
4. name:text-x-generic
svn path=/trunk/; revision=2068
Diffstat (limited to 'programs/gvfs-info.c')
-rw-r--r-- | programs/gvfs-info.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/programs/gvfs-info.c b/programs/gvfs-info.c index 355f7d03..9f75ef1c 100644 --- a/programs/gvfs-info.c +++ b/programs/gvfs-info.c @@ -109,9 +109,42 @@ show_attributes (GFileInfo *info) g_print ("attributes:\n"); for (i = 0; attributes[i] != NULL; i++) { - s = g_file_info_get_attribute_as_string (info, attributes[i]); - g_print (" %s: %s\n", attributes[i], s); - g_free (s); + /* list the icons in order rather than displaying "GThemedIcon:0x8df7200" */ + if (strcmp (attributes[i], "standard::icon") == 0) + { + GIcon *icon; + gboolean fallbacks; + int j, len; + char **names = NULL; + icon = g_file_info_get_icon (info); + + /* only look up names if GThemedIcon */ + if (G_IS_THEMED_ICON(icon)) + { + g_object_get (G_OBJECT(icon), "names", &names, + "use-default-fallbacks", &fallbacks, NULL); + g_print (" %s: (fallbacks: %s)\n", attributes[i], + fallbacks ? "TRUE" : "FALSE"); + len = g_strv_length (names); + for (j = 0; j < len; j++) + { + g_print (" %i. name:%s\n", j+1, names[j]); + } + g_strfreev (names); + } + else + { + s = g_file_info_get_attribute_as_string (info, attributes[i]); + g_print (" %s: %s\n", attributes[i], s); + g_free (s); + } + } + else + { + s = g_file_info_get_attribute_as_string (info, attributes[i]); + g_print (" %s: %s\n", attributes[i], s); + g_free (s); + } } g_strfreev (attributes); } |