[Xfce4-commits] r29460 - xfconf/trunk/xfconf-query
Stephan Arts
stephan at xfce.org
Sat Feb 7 14:52:04 CET 2009
Author: stephan
Date: 2009-02-07 13:52:04 +0000 (Sat, 07 Feb 2009)
New Revision: 29460
Modified:
xfconf/trunk/xfconf-query/main.c
Log:
Now it supports showing array contents inside the verbose-list view.
Modified: xfconf/trunk/xfconf-query/main.c
===================================================================
--- xfconf/trunk/xfconf-query/main.c 2009-02-07 12:53:21 UTC (rev 29459)
+++ xfconf/trunk/xfconf-query/main.c 2009-02-07 13:52:04 UTC (rev 29460)
@@ -156,14 +156,54 @@
GSList *li;
gchar *format = verbose ? g_strdup_printf ("%%-%ds%%s\n", size + 2) : NULL;
GValue *property_value;
- gchar *string;
+ gchar *string, *_string = NULL;
+ gchar *str_val;
for (li = sorted_contents; li != NULL; li = li->next)
{
if (verbose)
{
property_value = g_hash_table_lookup (channel_contents, li->data);
- string = _xfconf_string_from_gvalue (property_value);
+ if(XFCONF_TYPE_G_VALUE_ARRAY != G_VALUE_TYPE(property_value))
+ {
+ string = _xfconf_string_from_gvalue (property_value);
+ }
+ else
+ {
+ GPtrArray *arr = g_value_get_boxed(property_value);
+ guint i;
+ string = g_strdup ("{");
+
+ for(i = 0; i < arr->len; ++i)
+ {
+ GValue *item_value = g_ptr_array_index(arr, i);
+
+ if(item_value)
+ {
+ if(XFCONF_TYPE_G_VALUE_ARRAY != G_VALUE_TYPE(property_value))
+ {
+ str_val = _xfconf_string_from_gvalue(item_value);
+ }
+ else
+ {
+ str_val = "<ARRAY>";
+ }
+ if (i > 0)
+ _string = g_strconcat (string, ",", str_val, NULL);
+ else
+ _string = g_strconcat (string, str_val, NULL);
+
+ g_free (string);
+ g_free(str_val);
+
+ string = _string;
+ }
+ }
+ _string = g_strconcat (string, "}", NULL);
+ g_free (string);
+ string = _string;
+
+ }
g_print (format, (gchar *) li->data, string);
g_free (string);
}
More information about the Xfce4-commits
mailing list