GParamSpec: add g_param_spec_get_default_value()
authorRyan Lortie <desrt@desrt.ca>
Tue, 23 Apr 2013 15:11:20 +0000 (11:11 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 23 Apr 2013 18:39:09 +0000 (14:39 -0400)
commitc18462b5803a3dd57d3ccb67153ad7851cc8ce08
tree22fe3f2ac78caff62bd5b271fd64e5da64219b7d
parentc30c0bb34d80013489897c49bef36cc56972d5d9
GParamSpec: add g_param_spec_get_default_value()

The way of getting the default value out of a GParamSpec is to allocate
a GValue, initialise it, then call g_param_spec_set_default() to set the
default value into that GValue.

This is exactly how we handle setting the default value for all of the
construct properties that were not explicitly passed to g_object_new().

Instead of doing the alloc/init/store on all construct properties on
every call to g_object_new(), we can cache those GValues in the private
data of the GParamSpec itself and reuse them.

This patch does not actually make that change to g_object_new() yet, but
it adds the API to GParamSpec so that a future patch to GObject can make
the change.

https://bugzilla.gnome.org/show_bug.cgi?id=698056
docs/reference/gobject/gobject-sections.txt
gobject/gparam.c
gobject/gparam.h
gobject/tests/param.c