summaryrefslogtreecommitdiff
path: root/json-glib/json-gobject.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2009-11-12 12:59:03 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-11-12 13:03:19 +0000
commit61d54cc9e2a3098e876e700a9248428f400a5368 (patch)
treebda80d32b8457721525b3c7247bad9689a77ed85 /json-glib/json-gobject.c
parent63dc03da507a216c0764bc0e50fc62b2b77dc1b2 (diff)
downloadjson-glib-61d54cc9e2a3098e876e700a9248428f400a5368.tar.gz
serializable: Make Serializable in charge of parsing
If a GObject class implements JsonSerializable and has overridden the serialize_property() vfunc then the Serializable should be fully in charge of serializing a property - that is: JSON-GLib should not try to add a fallback in case the serialize_property() implementation returned NULL. This is a change in semantics for JsonSerializable implementations. http://bugzilla.openedhand.com/show_bug.cgi?id=1859 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Diffstat (limited to 'json-glib/json-gobject.c')
-rw-r--r--json-glib/json-gobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index a9ecfe7..574ff38 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -360,14 +360,17 @@ json_gobject_dump (GObject *gobject)
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (gobject, pspec->name, &value);
+ /* if there is a serialization vfunc, then it is completely responsible
+ * for serializing the property, possibly by calling the implementation
+ * of the default JsonSerializable interface through chaining up
+ */
if (serialize_property)
{
node = iface->serialize_property (serializable, pspec->name,
&value,
pspec);
}
-
- if (!node)
+ else
node = json_serialize_pspec (&value, pspec);
if (node)