From 84437fefcfda6157063210bbd9677298d62899b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 11:45:56 -0500 Subject: Handling the printing of strv's as well. --- tools/dbusmenu-dumper.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 724ee25..4ce1374 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -29,6 +29,17 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; +static gchar * +strv_dumper(const GValue * value) +{ + gchar ** strv = (gchar **)g_value_get_boxed(value); + + gchar * joined = g_strjoinv("\", \"", strv); + gchar * retval = g_strdup_printf("[\"%s\"]", joined); + g_free(joined); + return retval; +} + typedef struct _collection_iterator_t collection_iterator_t; struct _collection_iterator_t { gchar * space; @@ -41,7 +52,13 @@ collection_iterate (const GValue * value, gpointer user_data) { collection_iterator_t * iter = (collection_iterator_t *)user_data; - gchar * str = g_strdup_value_contents(value); + gchar * str; + if (G_VALUE_TYPE(value) == G_TYPE_STRV) { + str = strv_dumper(value); + } else { + str = g_strdup_value_contents(value); + } + gchar * retval = NULL; if (iter->first) { -- cgit v1.2.3