[Glade-users] Question about signal data.

Damon Chaplin damon@helixcode.com
Thu, 04 Jan 2001 00:40:13 +0000


Brian Wagener wrote:
> 
> Hello,
> Thanks for your help last time, but I have another similar question.  I
> want to make a signal handler that handles the "clicked" signal of
> several similar buttons.  I tried adding something like "(int)45" to the
> signal data section of glade, but nothing really changed.  I am using
> autoconnect() don't know if I should be using ...connect_data()
> instead.  What would be the best way to do this?

libglade's glade_xml_signal_autoconnect() function assumes that the signal
data field is just a string, so it won't understand (int)45.

You could either use atoi() to convert to an integer, or you can set the
value based on the widget which received the signal, e.g.

   button1 = lookup_widget (widget, "button1");
   button2 = lookup_widget (widget, "button2");
   button3 = lookup_widget (widget, "button3");

   if (widget == button1)
     value = 45;
   else if (widget == button2)
     value = 50;
   else if (widget == button3)
     value = 55;

Damon