Re: g_object_newv

James Henstridge <james daa com au> writes:

> I was wondering if there has been any progress on adding a g_object_newv
> function (similar to gtk_object_newv) to glib, as described in the
> following bugzilla bug:
> It would be really helpful for my work on libglade and also for language
> bindings.  Apparently Martin has some uses for a function like that in
> gnome-libs as well.
> If no one is hacking on it, I could look at doing a patch.  The only
> problem is working out what the prototype should look like.  The
> gtk_object_newv function takes an array of GtkArg structs.  I can't just
> pass an array of GValues because the GValues don't have a name member.
> Possible options are passing an array of strings and an array of GValues,
> an array of structs with name and value members, or maybe reusing
> GObjectConstructParam (with this last option the user would have to lookup
> the GParamSpec's for each property).  Which option sounds best?

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.


  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 

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