aboutsummaryrefslogtreecommitdiff
path: root/tests/json-loader.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-28 17:13:32 -0500
committerTed Gould <ted@gould.cx>2010-06-28 17:13:32 -0500
commitccd36f867b28766e708ab7bdbbd36fda3492a8fd (patch)
tree399adaa4aaafcb82c2f3f2a3f7d4d8c8050ac593 /tests/json-loader.c
parentced63228a6304953dcd57adcc6a1f9906b2d9a21 (diff)
downloadlibdbusmenu-ccd36f867b28766e708ab7bdbbd36fda3492a8fd.tar.gz
libdbusmenu-ccd36f867b28766e708ab7bdbbd36fda3492a8fd.tar.bz2
libdbusmenu-ccd36f867b28766e708ab7bdbbd36fda3492a8fd.zip
Okay, so now we're handling the complex areas.
Diffstat (limited to 'tests/json-loader.c')
-rw-r--r--tests/json-loader.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/json-loader.c b/tests/json-loader.c
index e61a49a..64e1579 100644
--- a/tests/json-loader.c
+++ b/tests/json-loader.c
@@ -17,6 +17,31 @@ node2value (JsonNode * node)
}
if (JSON_NODE_TYPE(node) == JSON_NODE_ARRAY) {
+ JsonArray * array = json_node_get_array(node);
+ JsonNode * first = json_array_get_element(array, 0);
+
+ if (JSON_NODE_TYPE(first) == JSON_NODE_VALUE) {
+
+ } else {
+ GValue * subvalue = node2value(first);
+ GType type = dbus_g_type_get_collection("GPtrArray", G_VALUE_TYPE(subvalue));
+ gpointer * wrapper = dbus_g_type_specialized_construct(type);
+
+ g_value_init(value, type);
+ g_value_take_boxed(value, wrapper);
+
+ DBusGTypeSpecializedAppendContext ctx;
+ dbus_g_type_specialized_init_append(value, &ctx);
+
+ dbus_g_type_specialized_collection_append(&ctx, subvalue);
+ int i;
+ for (i = 1; i < json_array_get_length(array); i++) {
+ GValue * subvalue = node2value(node);
+ dbus_g_type_specialized_collection_append(&ctx, subvalue);
+ }
+
+ dbus_g_type_specialized_collection_end_append(&ctx);
+ }
}
if (JSON_NODE_TYPE(node) == JSON_NODE_OBJECT) {
@@ -50,11 +75,9 @@ node2value (JsonNode * node)
g_free(value);
}
}
-
}
- g_free(value);
- return NULL;
+ return value;
}
static void