gvfs r2068 - in trunk: . programs



Author: rhughes
Date: Mon Oct 20 11:15:36 2008
New Revision: 2068
URL: http://svn.gnome.org/viewvc/gvfs?rev=2068&view=rev

Log:
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


Modified:
   trunk/ChangeLog
   trunk/programs/gvfs-info.c

Modified: trunk/programs/gvfs-info.c
==============================================================================
--- trunk/programs/gvfs-info.c	(original)
+++ trunk/programs/gvfs-info.c	Mon Oct 20 11:15:36 2008
@@ -109,9 +109,42 @@
   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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]