Richard wrote:
>
> Could someone explain the reason for this function
>
> "g_signal_connect_swapped"
For instance, you can do
g_signal_connect (widget, "destroy", G_CALLBACK (null_pointer), &pointer);
...
void
null_pointer (GtkObject* object, gpointer pointer)
{
*pointer = NULL;
}
Or
g_signal_connect_swapped (widget, "destroy", G_CALLBACK (null_pointer),
&pointer);
...
void
null_pointer (gpointer pointer)
{
*pointer = NULL;
}
Note the absence of unneeded argument in the second case. This is not
very important when you write a function yourself, but can save you
from writing an adaptor in case of ready functions. For instance,
imagine this:
g_signal_connect_swapped (widget, "destroy",
G_CALLBACK (gtk_widget_destroy), another_widget);
if you want `another_widget' leave no longer than `widget'. Without
g_signal_connect_swapped(), you'd have to write a dummy function which
just rearranges its arguments and invokes gtk_widget_destroy().
Paul
_______________________________________________
gtk-app-devel-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list