[Glade-users] Re: data in g_signal_connect

olafandjasper hushmail com wrote:

void selectActionBin(GtkWidget      *button,
                    struct MY_DATA *data)
 /* This is the code that does not work */
 printf("In call back, data = <%s>\n",data->bin);
 printf("In call back, data = <%s>\n",data->doc);
 printf("In call back, data is at %p\n", data);
 printf("In call back, &data is at %p\n", &data);

This is completely broken, prototype should be:
gboolean selectActionBin(GtkWidget *button, GdkEventButton *event, 
struct MY_DATA *data);
(marking this as ''static" is not a bad idea too).
1. Return value of this callback should be gboolean (TRUE means that 
this event is handled and no other callbacks will be executed).
2. You will get a pointer to GdkEventButton structure instead of pointer 
Look at:

 g_signal_connect(G_OBJECT (butWidget),
                  G_CALLBACK (selectActionBin),

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