Method

GioMenuModelget_item_attribute

since: 2.32

Declaration

gboolean
g_menu_model_get_item_attribute (
  GMenuModel* model,
  gint item_index,
  const gchar* attribute,
  const gchar* format_string,
  ...
)

Description

Queries item at position item_index in model for the attribute specified by attribute.

If the attribute exists and matches the GVariantType corresponding to format_string then format_string is used to deconstruct the value into the positional parameters and TRUE is returned.

If the attribute does not exist, or it does exist but has the wrong type, then the positional parameters are ignored and FALSE is returned.

This function is a mix of g_menu_model_get_item_attribute_value() and g_variant_get(), followed by a g_variant_unref(). As such, format_string must make a complete copy of the data (since the GVariant may go away after the call to g_variant_unref()). In particular, no ‘&’ characters are allowed in format_string.

Available since: 2.32

This method is not directly available to language bindings.

Parameters

item_index

Type: gint

The index of the item.

attribute

Type: const gchar*

The attribute to query.

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

Type: const gchar*

A GVariant format string.

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

Type: 

Positional parameters, as per format_string.

Return value

Type: gboolean

TRUE if the named attribute was found with the expected type.