RE: How can I use g_signal_connect() to pass a gponiter parameter

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

 



> -----Original Message-----> From: Jean Bréfort> > Le dimanche 01 février 2009 à 10:22 -0800, frantishek a écrit :> > My code does it just by the book:> >> > void setPermission(GtkWidget *window, gpointer p)> > {> > 	g_print("%s\n", (gchar*) p);> > }> >> > g_signal_connect_swapped (G_OBJECT (radio1), "clicked", G_CALLBACK> > (setPermission), (gpointer) "Clicked 0");> > You are using g_singal_connect_swapped, so your gpointer becomes the> first argument of the callback which should be> > void setPermission(gpointer p)> {> 	g_print("%s\n", (gchar*) p);> }
Or, better, leave the signal handler as-is and use g_signal_connect rather than g_signal_connect_swapped. The latter is really for a case where the signal handler takes a widget as its first parameter and you want to pass it a different widget to the one that emits the signal, which you can pass as the data to g_signal_connect_swapped. So for the above example, there's no reason to use g_signal_connect_swapped.
Ian

_______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://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