From 27afed8dc89bf9562c3536f0a053d250e70eea4d Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 27 Oct 2009 10:30:27 +0000 Subject: gobject: Recurse in GParamSpecObject properties Use the newly added json_gobject_new() internal function to recurse into properties defined using GParamSpecObject. The same rules used by json_construct_gobject() apply to the properties storing a GObject - including JsonSerializable support. The test case for serialization and deserialization of a GObject has been updated to include a property holding a GObject. --- json-glib/json-gobject.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'json-glib/json-gobject.c') diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c index 1def054..a8b8843 100644 --- a/json-glib/json-gobject.c +++ b/json-glib/json-gobject.c @@ -266,7 +266,19 @@ json_deserialize_pspec (GValue *value, switch (JSON_NODE_TYPE (node)) { case JSON_NODE_OBJECT: - return FALSE; + if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_OBJECT)) + { + GObject *object; + + object = json_gobject_new (G_VALUE_TYPE (value), json_node_get_object (node)); + if (object != NULL) + g_value_take_object (value, object); + else + g_value_set_object (value, NULL); + + retval = TRUE; + } + break; case JSON_NODE_ARRAY: if (G_VALUE_HOLDS (value, G_TYPE_STRV)) -- cgit v1.2.1