On Tue, 15 Feb 2005 09:32:46 -0800, Paolo Costabel
<[EMAIL PROTECTED]> wrote:
[...]
> >can I pass (a pointer to) user data to a button's callback? The compiler
> >wants me to create button callbacks like void (*)(void) -- but what I
> >need is void (*)(void*), at least for the "pressed" and "released"
> >signals
> >
> >How could I do that?

Different GSignal's have different callback signatures; g_signal_connect
only needs the address of your callback code segment, typicly we use
the G_CALLBACK macro to cast like so:

/************** .... *****************/
void
foo_button_pressed (GtkButton *button, FooData *foo)
{

}
/************** .... *****************/
g_signal_connect (G_OBJECT (button), "pressed", 
                                 G_CALLBACK (foo_button_pressed),
(gpointer)foo);
/**************************************/

Cheers,
                                            -Tristan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to