Function Macro
GObjectsignal_connect_swapped
Declaration [src]
#define g_signal_connect_swapped (
instance,
detailed_signal,
c_handler,
data
)
Description [src]
Connects a GCallback
function to a signal for a particular object.
The instance on which the signal is emitted and data
will be swapped when
calling the handler. This is useful when calling pre-existing functions to
operate purely on the data
, rather than the instance
: swapping the
parameters avoids the need to write a wrapper function.
For example, this allows the shorter code:
g_signal_connect_swapped (button, "clicked",
(GCallback) gtk_widget_hide, other_widget);
Rather than the cumbersome:
static void
button_clicked_cb (GtkButton *button, GtkWidget *other_widget)
{
gtk_widget_hide (other_widget);
}
...
g_signal_connect (button, "clicked",
(GCallback) button_clicked_cb, other_widget);
This function cannot fail. If the given signal doesn’t exist, a critical warning is emitted.
This function is not directly available to language bindings.