Re: any chance of a g_object_newv



Hi,

James Henstridge <james daa com au> writes:

> Is there any chance of adding a "g_object_newv" function that could
> construct an object from an array holding name/value pairs (or
> paramspec/value pairs).
> 
> As it is, there doesn't seem to be any way to construct an object and set
> G_CONSTRUCT_ONLY properties unless you have a va_list.

There is, but it is somewhat ugly. We use the following code:

  object = klass->constructor (type, 
			       n_construct_properties, 
                               construct_properties);

construct_properties is an array of GObjectConstructParam which is 
build beforehand using info from klass->property_specs.

Anyway, I think our code would benefit from g_object_newv() too. At 
least gtk_object_newv is what we used before the port to GObject.


Salut, Sven




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