Gio.Settings.create_action

### Method

# Gio Settingscreate_action

since: 2.32

#### Declaration [src]

    GAction*
    g_settings_create_action (
      GSettings* settings,
      const gchar* key
    )

#### Description [src]

Creates a `GAction` corresponding to a given `GSettings` key.

The action has the same name as the key.

The value of the key becomes the state of the action and the action is enabled when the key is writable. Changing the state of the action results in the key being written to. Changes to the value or writability of the key cause appropriate change notifications to be emitted for the action.

For boolean-valued keys, action activations take no parameter and result in the toggling of the value. For all other types, activations take the new value for the key (which must have the correct type).

Available since: 2.32

#### Parameters

`key`

  Type: `const gchar*`

  The name of a key in `settings`.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `GAction`

A new `GAction`.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.