Re: g_signal_connect_swapped
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: gtk-app-devel-list gnome org
- Cc: Richard <rileyrg googlemail com>
- Subject: Re: g_signal_connect_swapped
- Date: Sun, 26 Nov 2006 22:41:04 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]