GObject.signal_connect_swapped
Description: Reference for GObject.signal_connect_swapped

### 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 name doesn’t exist, a critical warning is emitted. No validation is performed on the ‘detail’ string when specified in `detailed_signal`, other than a non-empty check.

Refer to the signals documentation for more details.

This function is not directly available to language bindings.

#### Parameters

`instance`

  Type: `-`

  The instance to connect to.

`detailed_signal`

  Type: `-`

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

`c_handler`

  Type: `-`

  The `GCallback` to connect.

`data`

  Type: `-`

  Data to pass to `c_handler` calls.