aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-28 11:45:56 -0500
committerTed Gould <ted@gould.cx>2010-06-28 11:45:56 -0500
commit84437fefcfda6157063210bbd9677298d62899b8 (patch)
tree31777a64384e6d3fa2fade2341bbebaf6122a3c5
parenta359a31ffc36630c385ac9ebdf06b6f20e8401f6 (diff)
downloadlibdbusmenu-84437fefcfda6157063210bbd9677298d62899b8.tar.gz
libdbusmenu-84437fefcfda6157063210bbd9677298d62899b8.tar.bz2
libdbusmenu-84437fefcfda6157063210bbd9677298d62899b8.zip
Handling the printing of strv's as well.
-rw-r--r--tools/dbusmenu-dumper.c19
1 files changed, 18 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>.
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) {