Re: any chance of a g_object_newv



On 6 May 2001, Sven Neumann wrote:

> 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);

I suppose this could be used, but directly accessing the function pointers
in non local code seems to be frowned uppon in most parts of GTK+.  I
wasn't saying that it was impossible to do it, just that
g_object_new_valist looked fairly non trivial (about 140 lines) -- not the
sort of thing you would want to rewrite if you could help it.

> 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.

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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