From 4315308a19e4cf474451cecf8b69aceddda91f49 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sat, 9 Jul 2011 15:23:36 -0400 Subject: Avoid serializing default property values only after consulting the JsonSerializable. This patch gives the JsonSerializable class a chance to decide whether it's appropriate to serialize a property before JsonGObject checks for a default value and skips the property. --- json-glib/json-serializable.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'json-glib/json-serializable.c') diff --git a/json-glib/json-serializable.c b/json-glib/json-serializable.c index c90a687..e49ccb1 100644 --- a/json-glib/json-serializable.c +++ b/json-glib/json-serializable.c @@ -123,6 +123,10 @@ json_serializable_real_serialize (JsonSerializable *serializable, GParamSpec *pspec) { JSON_NOTE (GOBJECT, "Default serialization for property '%s'", pspec->name); + + if (g_param_value_defaults (pspec, (GValue *)value)) + return NULL; + return json_serialize_pspec (value, pspec); } -- cgit v1.2.1