Re: GObjectClass->constructor revised, g_object_newv_with_data

On Jul 5, 2005, at 7:57 AM, Tim Janik wrote:

On Tue, 5 Jul 2005, Gustavo J. A. M. Carneiro wrote:

Currently [construction properties will] be set by the GObject system at the wrong time, i.e. before the python proxy object is attached to the GObject instance.

i'd rather say, you are trying to setup your proxy at the wrong time, i.e. after _init() which is too late. if you properly setup your proxy in _init() construct properties will work fine out of the box.

For what it's worth, this is similar to the approach we took with gtk2-perl. The perl+C combination object is set up the first time the GObject is marshaled to perl; if that happens to be in a set_property override as part of g_object_new(), then so be it. This works the same way for all GObjects, regardless of whether they are derived in perl code.

If we attach the proxy after g_object_newv returns then it is already
too late to handle construction properties in python space.

no, this is case (1), i.e. you are creating a C Object and have nothing todo with its construction properties, e.g. a GtkButton. so attaching the python
proxy to the fully constructed object is good enough.

An important thing to remember here is that the _init()s will all run from the inside out *before* any set_property()s get called by g_object_new().

"that's it! you're a genius!" "yes. that's what i think. do you think i deserve a raise?"
    - dialogue from 'Godzilla versus Mothra', 1964

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