Re: About dialog API



On Thu, 2003-04-10 at 15:41, Matthias Clasen wrote:
> On Thu, 2003-04-10 at 09:22, Owen Taylor wrote:
> > This perhaps solves the GUI builder problem, but it doesn't solve
> > the problem of use from C at all. Creating a GValueArray of strings
> > looks to be quite painful, in fact.
> 
>   gchar *authors[] = {
>     "Peter Mattis",
>     "Spencer Kimball",
>     "Josh MacDonald",
>     "and many more...",
>     NULL
>   };
> 
>   GValueArray *array = g_value_array_new (0);
> 
>   for (tmp = authors; tmp != NULL; tmp++) 
>     {
>       GValue tmp_value = { 0 };
>  
>       g_value_init (&tmp_value, G_TYPE_STRING);
>       g_value_set_string (&tmp_value, tmp);
>       g_value_array_append (array, &tmp_value);
>     } 
> 
> Doesn't look too bad to me. 

Maybe we have a different definition of "not too bad." :-)
(The above isn't too bad to write once for someone who
knows GObject, but making everybody using GnomeAbout
do it!)

> You can make it better by introducing a
> little g_value_array_append_string (GValueArray *array, gchar *str)
> helper, which would reduce to loop to
> 
> for (tmp = authors; tmp != NULL; tmp++)
>   g_value_array_append_string (array, tmp);

I'd say that even this is unacceptable gtk_about_show(),
so we'd have to forget the idea of gtk_about_show (parent, ...);

If array of string marshalled a a null-terminated gchar **,
that would be a different. But GValueArray * doesn't
seem workable.

Regards,
                                        Owen





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