Re: GObjectClass->constructor revised, g_object_newv_with_data

On Tue, 2005-07-05 at 13:57 +0200, Tim Janik wrote:
> On Tue, 5 Jul 2005, Gustavo J. A. M. Carneiro wrote:
> > On Tue, 2005-07-05 at 02:26 +0200, Tim Janik wrote:
> >> On Tue, 7 Jun 2005, Gustavo J. A. M. Carneiro wrote:
> >>
> >>>  I'd like to propose an API enhancement to GObject, in order to solve
> >>> pygtk bugs 161177 and 123891 in a way that doesn't involve some "hack".
> >>>
> >>>  As people may or may not know, in PyGTK there is, for each GObject, a
> >>> corresponding "python wrapper" PyObject.  Normally, the PyObject is
> >>> create first, then __init__ is called, and this in turn calls the parent
> >>> __init__ which takes care of creating the GObject with g_object_newv.
> >>>
> >>>  Now, in bug 123891 we'd like to solve the "construction properties"
> >>> problem.  The only place where we may set construction properties is, as
> >>> you may know, in the GObjectClass->constructor method.
> >>
> >> what do you mean with "we may set construction properties"?
> >> construction properties are supposed to be passed in as (name,value)
> >> pairs to g_object_newv(), and they'll be set by the GObject system
> >> automatically at the right time.
> >
> >  Currently they'll 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.

  Your solution seems almost reasonable, except the TLS part... :|

  Any chance to pass a "gpointer data" into _init()?  I suppose passing
an extra parameter into a callback function doesn't break anything,
right?  g_object_newv would pass in NULL by default, and legacy _init's
would happily ignore it, or we could call a new g_object_newv_with_data
to pass something else, like a PyObject*.  Would that be acceptable?


Gustavo J. A. M. Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>
The universe is always one step beyond logic.

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