Re: [GObject] Extending properties

On Tue, Oct 14, 2008 at 4:08 AM, Maciej Piechotka <uzytkownik2 gmail com> wrote:
> For some reason I have to 'extend' the property. I.e. the parent had
> G_READABLE and the child has to have G_READABLE | G_CONSTRUCT_ONLY.
> Is such construction correct:
> GParamSpec *spec;
> g_object_class_override_property (gobject_class, PROP_FOO, "foo");
> spec = g_object_class_find_property (gobject_class, "foo");
> spec->flags |= G_PARAM_CONSTRUCT;
> Is (for GParamSpecObject) this correct:
> spec->value_type = BAR_TYPE_CHILD
> Assuming BarChild is child of the original class?

According to the docs your code is safe, although I've
always used g_object_class_install_property() directly
in a subclass if I needed to change the default or flags...
so I would say that is also safe.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]