Re: g_signal_connect question

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

 



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
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux