diff options
author | Stephan Arts <stephan@xfce.org> | 2009-02-07 13:52:04 +0000 |
---|---|---|
committer | Stephan Arts <stephan@xfce.org> | 2009-02-07 13:52:04 +0000 |
commit | 50d1ed69f87db77822fbd4abf53814034114a94b (patch) | |
tree | 7152242724c9ca128de260d0601e7bd6fac5e579 /xfconf-query/main.c | |
parent | 07f962b794d2d94c5ca8575fe4436833376afd36 (diff) | |
download | xfconf-50d1ed69f87db77822fbd4abf53814034114a94b.tar.gz |
Now it supports showing array contents inside the verbose-list view.
(Old svn revision: 29460)
Diffstat (limited to 'xfconf-query/main.c')
-rw-r--r-- | xfconf-query/main.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/xfconf-query/main.c b/xfconf-query/main.c index 34cd637..054a791 100644 --- a/xfconf-query/main.c +++ b/xfconf-query/main.c @@ -156,14 +156,54 @@ xfconf_query_list_contents (GSList *sorted_contents, GHashTable *channel_content 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); } |