patch: add information about the icon to gvfs-info
- From: Richard Hughes <hughsient gmail com>
- To: gvfs-list gnome org
- Subject: patch: add information about the icon to gvfs-info
- Date: Fri, 17 Oct 2008 16:27:41 +0100
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 :-)
Patch attached makes it something like this:
standard::icon: (fallbacks:false)
1. name:package-x-generic
2. name:application-x-servicepack
3. name:gnome-mime-application-x-servicepack
4. name:application-x-generic
5. name:text-x-generic
Comment welcome. Thanks.
Richard.
Index: gvfs-info.c
===================================================================
--- gvfs-info.c (revision 2058)
+++ gvfs-info.c (working copy)
@@ -109,9 +109,30 @@
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)
+ {
+ GThemedIcon *icon;
+ gboolean fallbacks;
+ int j, len;
+ char **names = NULL;
+ icon = G_THEMED_ICON(g_file_info_get_icon (info));
+ 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]);
+ }
+ }
+ 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]