mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 06:33:41 +02:00
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
This commit is contained in:
@@ -336,6 +336,8 @@ void g_value_take_param (GValue *value,
|
||||
GLIB_DEPRECATED_FOR(g_value_take_param)
|
||||
void g_value_set_param_take_ownership (GValue *value,
|
||||
GParamSpec *param);
|
||||
GLIB_AVAILABLE_IN_2_36
|
||||
const GValue * g_param_spec_get_default_value (GParamSpec *param);
|
||||
|
||||
/* --- convenience functions --- */
|
||||
typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo;
|
||||
@@ -421,7 +423,6 @@ GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool,
|
||||
guint *n_pspecs_p);
|
||||
|
||||
|
||||
|
||||
/* contracts:
|
||||
*
|
||||
* gboolean value_validate (GParamSpec *pspec,
|
||||
|
Reference in New Issue
Block a user