Re: patch: add information about the icon to gvfs-info
- From: Richard Hughes <hughsient gmail com>
- To: Christian Kellner <ck xatom net>
- Cc: gvfs-list gnome org
- Subject: Re: patch: add information about the icon to gvfs-info
- Date: Fri, 17 Oct 2008 17:41:09 +0100
On Fri, 2008-10-17 at 17:38 +0200, Christian Kellner wrote:
> One comment: Shouldn't we be checking if the icon actually is a
> G_THEMED_ICON? I think it also can be a Loadable icon theoretically.
New patch attached. Thanks for the review.
Richard.
Index: programs/gvfs-info.c
===================================================================
--- programs/gvfs-info.c (revision 2058)
+++ programs/gvfs-info.c (working copy)
@@ -109,9 +109,41 @@
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]);
+ }
+ }
+ 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]