Re: [gtk-list] Re: Why doesn't GTK+...



Owen Taylor wrote:
> 
> "Vomjom" <vomjom@earthlink.net> writes:
> 
> > GTK+ allows one argument for functions like
> > gtk_signal_connect()... why doesn't it allow multiple arguments
> > using ellipses (...) as an argument? This could fit in many places,
> > such as gtk_slist_append(), allowing you to append more than one
> > thing at a time.
> 
> This is impossible to do in a portable manner - while
> having a gtk_signal_connect() variant that took an
> arbitrary number of user data arguments is easy
> to do using varargs, the problem is writing code
> that can call:
> 
>  void callback (GtkWidget *widget, gpointer data)
> 
> and
> 
>  void callback (GtkWidget *widget, gpointer data1,
>                 gpointer data2)
> 
> and
> 
>  void callback (GtkWidget *widget, gpointer data, gpointer data2,
>                 gpointer data3)
> 
> and so forth.

On a related note, why didn't GTK+ signals simply use structs to pass
signal-specific data, e.g.

  void callback (GtkWidget *widget,
                 GtkButtonPressData *signal_data,
                 gpointer user_data);

That would have simplified all the signal emission code, wouldn't it?
Signal marshallers wouldn't have been needed.

Damon



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