Re: g_signal_connect question



Hi

1. "clicked" callback:
void user_function( GtkButton *button, gpointer user_data );

for yor example:
void user_function( GtkButton *button, struct args *p );

2. You can't pass local variables:

>         struct args *p = g_malloc( sizeof( *p ) );
>         p->numdice = 1;
>         p->sides = 10;
...
>         g_signal_connect( G_OBJECT( button1 ), "clicked",
>                   G_CALLBACK( roll ), (gpointer) p );

Don't forget to free the allocated data, when the program is finished e.g.
via

g_signal_connect_swapped( G_OBJECT( button1 ), "destroy-event",
         G_CALLBACK( g_free ), (gpointer) p );

HTH

Jan-Marek



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