Re: [gtk-list] gtk_args_collect & gnome--

On Fri, 21 Aug 1998, Havoc Pennington wrote:

> Hi,
> I have a trivial little problem here I can't think of a nice solution to.
> Perhaps someone has some ideas or can tell me how I'm confused.
> The GnomeCanvas relies heavily on GtkArg; it's the only way to set the
> properties of the various GnomeCanvasItem types. So this is done at item
> creation time and with a function
> gnome_canvas_item_set(GnomeCanvasItem*,...);
> My problem is the C++ wrapper. The nice function to have would be:
> GnomeCanvasItem::set(const gchar* first_name, ...)
> but there's no way to do this, because gtk_args_collect wants to see a
> va_list*, and I don't know a way to get first_name into a va_list (well,
> that's the root cause, but it comes up indirectly because
> gtk_object_args_collect also wants the va_list* and so
> gnome_canvas_item_set can't have a first_name argument). 
> So I'd have to re-implement gtk_args_collect, which also means
> gtk_arg_collect_value which is a big inline non-public function. 
> Yuck.
> Alternatively I could make a separate C function for each arg one
> might want to set:
> Gnome_CanvasLine::set_fill_color(const string & s)
> {
>   gnome_canvas_item_set(GNOME_CANVAS_ITEM(gtkobj()),
>                         "fill_color", s.c_str(), 0);
> }
> but this creates a huge maintenance headache compared to the other
> approach (and some small inefficiency, esp. since the canvas does some
> stuff every time you set args).
> Suggestions? Am I missing the obvious solution? Misunderstanding the whole
> thing?

i see the problem you are having, can we move this discussion to since its mainly an implementation issue?
there are some else problems with va_lists that need to be sorted out,
i'll write to gtk-devel on this soon.

(i hope that the language-glue and GUI builder types from gtk-list also
have subscribed to

> Thanks,
> Havoc


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