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);

Parameters

instance -
 

The instance to connect to.

detailed_signal -
 

A string of the form “signal-name::detail”.

c_handler -
 

The GCallback to connect.

data -
 

Data to pass to c_handler calls.