Gio.MenuItem.set_attribute_value

### Method

# Gio MenuItemset_attribute_value

since: 2.32

#### Declaration [src]

    void
    g_menu_item_set_attribute_value (
      GMenuItem* menu_item,
      const gchar* attribute,
      GVariant* value
    )

#### Description [src]

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.

must consist only of lowercase ASCII characters, digits and ‘-‘.

If `value` is non-`NULL` then it is used as the new value for the attribute. If `value` is `NULL` then the attribute is unset. If the `value` `GVariant` is floating, it is consumed.

See also `g_menu_item_set_attribute()` for a more convenient way to do the same.

Available since: 2.32

#### 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.

`value`

  Type: `GVariant`

  A `GVariant` to use as the value, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.