Re: multiple data args to gtk_signal_connect



On Mon, Aug 02, 1999 at 04:33:56PM +0200, fritz jetzek wrote:
> i may be stupid, but in 3 months of around-the-clock coding i still have
> no idea how to pass multiple arguments via the gtk_signal_connect
> function, for example when i need to change various widgets on emission
> of a signal. calling gtk_signal_connect for each widget is not viable in
> my case since the widgets also depend on each other. i might set up a
> glist on the fly to pass it in the gpointer field of the call but that
> seems a bit awkward... could someone point me to the most elegant way?

I solve it by 1) allocating a struct (then you should use the _full connect
function and pass g_free as the desroy handler) 2) setting named data on the
object I'm connecting the singal on e.g.

/*in signal handler*/
char *data1 = gtk_object_get_data(object,"data1");
GtkWidget *data2 = gtk_object_get_data(object,"data2");

/*when connecting
char *data1;
GtkWidget *data2;
...
gtk_object_set_data(object,"data1",data1);
gtk_object_set_data(object,"data2",data2);
gtk_signal_connect(object,"some_signal",GTK_SIGNAL_FUNC(handler),NULL);


This seems to meto be cleaner then defining a new struct, but I've been
accused in the past of liking _get/_set_data WAAAAY too much :)

George



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