Gio.MenuItem.set_attribute

### Method

# Gio MenuItemset_attribute

since: 2.32

#### Declaration

    void
    g_menu_item_set_attribute (
      GMenuItem* menu_item,
      const gchar* attribute,
      const gchar* format_string,
      ...
    )

#### Description

Sets or unsets an attribute on `menu_item`.

The attribute to set or unset is specified by `attribute`. This can be one of the standard attribute names `G_MENU_ATTRIBUTE_LABEL`, `G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, or a custom attribute name. Attribute names are restricted to lowercase characters, numbers and ‘-‘. Furthermore, the names must begin with a lowercase character, must not end with a ‘-‘, and must not contain consecutive dashes.

If `format_string` is non-`NULL` then the proper position parameters are collected to create a `GVariant` instance to use as the attribute value. If it is `NULL` then the positional parameterrs are ignored and the named attribute is unset.

See also `g_menu_item_set_attribute_value()` for an equivalent call that directly accepts a `GVariant`.

Available since: 2.32

This method is not directly available to language bindings.

#### Parameters

`attribute`

  Type: `const gchar*`

  The attribute to set.

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

`format_string`

  Type: `const gchar*`

  A `GVariant` format string, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  Positional parameters, as per `format_string`.