Re: g_object_newv



On 5 Jun 2001, Owen Taylor wrote:

> James Henstridge <james daa com au> writes:

> I would suggest declaring a new struct:
> 
>  struct _GArgument 
>  {
>    const char *name;
>    GValue value;
>  }
> 
> And pass in an array of those. There are other possibilities - 
> Tim may have a different opinion.

i don't have a strong opinion on this.
passing a seperate const gchar** array maybe more convenient
as you could use things like g_strfreev(). otoh, if you have
auxillary functions that create an array for you, something like
GArgument might be more convenient...

just, considering GtkArg, GArgument has an odd conotation for me,
i think i'd prefer s/GArgument/GParameter/ if we went with a
name+value array element approach.

side note on other options suggested, we should not reuse the construct params
for this interface, they are constructor specific.
also, the value identifiers need to be strings, not GParamSpec* pointers,
as internally we'd have to relookup these anyways, so no advantage would
be gained by using them.



> 
> Regards,
>                                         Owen
> 
> [ 
>   History: GValue was called GParam and included a GParamSpec *;
>   it was meant for exactly this purpose. But we eventually decided
>   to change it to what it is now because the there were considerable 
>   cases where you didn't want full parameter information and
>   just wanted a typed value 
> ]
> 

---
ciaoTJ





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