diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 10:30:27 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 10:30:27 +0000 |
commit | 27afed8dc89bf9562c3536f0a053d250e70eea4d (patch) | |
tree | 2c6025e8353fe58d0690f28343f7a979e61629b9 /json-glib/json-gobject.c | |
parent | 317447b52455c56b0123168ab127ce026d7d0c22 (diff) | |
download | json-glib-27afed8dc89bf9562c3536f0a053d250e70eea4d.tar.gz |
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.
Diffstat (limited to 'json-glib/json-gobject.c')
-rw-r--r-- | json-glib/json-gobject.c | 14 |
1 files changed, 13 insertions, 1 deletions
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)) |