diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-07-09 15:23:36 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-07-09 15:23:36 -0400 |
commit | 4315308a19e4cf474451cecf8b69aceddda91f49 (patch) | |
tree | 226d181df9ea9dcbb768bd20071e3ab2a84ddd7b /json-glib/json-serializable.c | |
parent | 4ba9a6a81709221ba58d0f8e067de660eb96914e (diff) | |
download | json-glib-4315308a19e4cf474451cecf8b69aceddda91f49.tar.gz |
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.
Diffstat (limited to 'json-glib/json-serializable.c')
-rw-r--r-- | json-glib/json-serializable.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); } |