Re: GObject instantiation hopelessly overcomplicated??



Hi,

"James M. Cape" <jcape ignore-your tv> writes:

> Overriding constructor() is typically not necessary (I could just as
> easily create the child widgets in instance_init, for example), so it
> may very well be redundant, but AFAICT the idea is to allow programmers
> to do things between set_property() for CONSTRUCT properties and
> set_property() for regular properties. Often that doesn't need to be
> done, but dispose() will typically not need to be overridden either
> (only when one object holds [circular] references to other objects).

You need to implement constructor() if you need to initialize things
based on construct properties. You can't do that in instance_init()
since you don't know the values of the construct properties there.
You could of course do it all in the object-specific _new() function
but you can't create the object using g_object_new() then and your
object will be difficult to use from language bindings.


Sven



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