Re: construct-time properties and constructor



On Tue, 2001-11-13 at 19:53, Tim Janik wrote:
> On 13 Nov 2001, Murray Cumming wrote:
> 
> > I'm trying to fix the libgnomeui widgets so that they use construct-time
> > properties instead of _construct functions, but I'm finding that most of
> > properties would need to be dealt with all at once, instead of one after
> > the other.
> > 
> > It seems like this might be possible in the widget's constructor, which
> > gets passed an array of construct-time properties. But I am concerned
> > that these will be set a second time by the normal properties system.
> > Should I remove them from the GObjectConstructParam
> > *construct_properties array and pass a different array to the parent
> > class's constructor to stop this?
> > 
> > Although I've read about this in the archives, I can't seem to find an
> > example of a constructor that actually uses the construct_properties
> > array that's passed to it.
> 
> you shouldn't actually touch that array.
> just pass the array on when chaining to the parent class' constructor.
> then perform any construction tasks after chaining.
> to disable setting of these properties after the object has been
> constructed, create them with the G_PARAM_CONSTRUCT_ONLY flag.

OK, I'm trying that now. I need to access the GParamSpec::param_id field
to identify the correct array items, so I don't think that should be
marked <private>. There is a PARAM_SPEC_PARAM_ID macro, but that's in
gobject.c.


-- 
Murray Cumming
murrayc usa net
www.murrayc.com




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