### Function Macro

# GObject signal_connect_swapped

since: 2.0

#### Declaration

    #define g_signal_connect_swapped (
      instance,
      detailed_signal,
      c_handler,
      data
    )

#### Description

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.

Available since: 2.0

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.