static GObject* base_object_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { /* The constructor is the one place where a GParamSpecOverride is visible * to the outside world, so we do a bunch of checks here */ GValue value1 = { 0, }; GValue value2 = { 0, }; GParamSpec *pspec; g_assert (n_construct_properties == 1); pspec = construct_properties->pspec; /* Check we got the param spec we expected */ g_assert (G_IS_PARAM_SPEC_OVERRIDE (pspec)); g_assert (pspec->param_id == BASE_PROP1); g_assert (strcmp (g_param_spec_get_name (pspec), "prop1") == 0); g_assert (g_param_spec_get_redirect_target (pspec) == iface_spec1); /* Test redirection of the nick and blurb to the redirect target */ g_assert (strcmp (g_param_spec_get_nick (pspec), "Prop1") == 0); g_assert (strcmp (g_param_spec_get_blurb (pspec), "Property 1") == 0); /* Test forwarding of the various GParamSpec methods to the redirect target */ g_value_init (&value1, G_TYPE_INT); g_value_init (&value2, G_TYPE_INT); g_param_value_set_default (pspec, &value1); g_assert (g_value_get_int (&value1) == 42); g_value_reset (&value1); g_value_set_int (&value1, 0x10000); g_assert (g_param_value_validate (pspec, &value1)); g_assert (g_value_get_int (&value1) == 0xFFFF); g_assert (!g_param_value_validate (pspec, &value1)); g_value_reset (&value1); g_value_set_int (&value1, 1); g_value_set_int (&value2, 2); g_assert (g_param_values_cmp (pspec, &value1, &value2) < 0); g_assert (g_param_values_cmp (pspec, &value2, &value1) > 0); g_value_unset (&value1); g_value_unset (&value2); return base_parent_class->constructor (type, n_construct_properties, construct_properties); }
static inline void g_object_notify_queue_add (GObject *object, GObjectNotifyQueue *nqueue, GParamSpec *pspec) { if (pspec->flags & G_PARAM_READABLE) { GParamSpec *redirect; g_return_if_fail (nqueue->n_pspecs < 65535); redirect = g_param_spec_get_redirect_target (pspec); if (redirect) pspec = redirect; /* we do the deduping in _thaw */ nqueue->pspecs = g_slist_prepend (nqueue->pspecs, pspec); nqueue->n_pspecs++; } }