summaryrefslogtreecommitdiff
path: root/json-glib/json-gobject.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-10-27 11:30:55 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-10-27 11:30:55 +0000
commit5406301b0e3bf74c0d7ae47a618c416d5c6dc29d (patch)
tree3e9c918fbcc4868e837cc39d857609c13c6ff820 /json-glib/json-gobject.c
parent3a2176ebf96b33716d1b50068ca44b1d3cd9b0c8 (diff)
downloadjson-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.c14
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;