diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 11:30:55 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-10-27 11:30:55 +0000 |
commit | 5406301b0e3bf74c0d7ae47a618c416d5c6dc29d (patch) | |
tree | 3e9c918fbcc4868e837cc39d857609c13c6ff820 /json-glib/json-gobject.c | |
parent | 3a2176ebf96b33716d1b50068ca44b1d3cd9b0c8 (diff) | |
download | json-glib-5406301b0e3bf74c0d7ae47a618c416d5c6dc29d.tar.gz |
gobject: Serialize properties holding a GObject
Like we deserialize them, we can serialize GObject properties
defined using GParamSpecObject.
Diffstat (limited to 'json-glib/json-gobject.c')
-rw-r--r-- | json-glib/json-gobject.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c index b004e21..1b3b1fe 100644 --- a/json-glib/json-gobject.c +++ b/json-glib/json-gobject.c @@ -576,6 +576,20 @@ json_serialize_pspec (const GValue *real_value, json_node_set_int (retval, g_value_get_flags (real_value)); break; + case G_TYPE_OBJECT: + { + GObject *object = g_value_get_object (real_value); + + if (object != NULL) + { + retval = json_node_new (JSON_NODE_OBJECT); + json_node_take_object (retval, json_gobject_dump (object)); + } + else + retval = json_node_new (JSON_NODE_NULL); + } + break; + case G_TYPE_NONE: retval = json_node_new (JSON_NODE_NULL); break; |