Re: construct-time properties and constructor



On 14 Nov 2001, Murray Cumming wrote:

> On Tue, 2001-11-13 at 23:45, Tim Janik wrote: 

> > no, i said don't touch the array. that also implies you shouldn't
> > evaluate it,
> 
> Sorry, I didn't understand.
> 
> So how can I get at that information? Should I use struct member fields which are set in set_property(), then read in those temporary values in the constructor after calling the base constructor? 

hm, adding newlines helps making the message text more digestible.
if with struct member fields you mean object fields, then yes.

CONSTRUCT properties are set and gotten just like normal properties through
set_property()/get_property(). they are just ensured to be set (only, depending
on the flags) at construction time. providing you access to the object constructor
just means you can shuffle stuff in your object _right after_ they were
set.

enum GParamFlags
 typedef enum
 {
   G_PARAM_READABLE            = 1 << 0,
   G_PARAM_WRITABLE            = 1 << 1,
   G_PARAM_CONSTRUCT           = 1 << 2,
   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
   G_PARAM_LAX_VALIDATION      = 1 << 4,
   G_PARAM_PRIVATE             = 1 << 5
 } GParamFlags;
Through the GParamFlags flag values, certain aspects of parameters can be configured.
 G_PARAM_READABLE       the parameter is readable
 G_PARAM_WRITABLE       the parameter is writable
 G_PARAM_CONSTRUCT      the parameter will be set upon object construction
 G_PARAM_CONSTRUCT_ONLY the parameter will only be set upon object construction
 G_PARAM_LAX_VALIDATION upon parameter conversion (see g_param_value_convert()) strict validation is not required

#define G_PARAM_READWRITE       (G_PARAM_READABLE | G_PARAM_WRITABLE)
GParamFlags value alias for G_PARAM_READABLE | G_PARAM_WRITABLE.

---
ciaoTJ




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