Skip to content

Gio.MenuAttributeIter

class — extends GObject.Object

MenuAttributeIter is an opaque structure type. You must access it using the functions below.

Methods

get_name

def get_name(self) -> str

Gets the name of the attribute at the current iterator position, as a string.

The iterator is not advanced.

get_next

def get_next(self) -> tuple[bool, str, GLib.Variant]

This function combines MenuAttributeIter.next with MenuAttributeIter.get_name and MenuAttributeIter.get_value.

First the iterator is advanced to the next (possibly first) attribute. If that fails, then False is returned and there are no other effects.

If successful, name and value are set to the name and value of the attribute that has just been advanced to. At this point, MenuAttributeIter.get_name and MenuAttributeIter.get_value will return the same values again.

The value returned in name remains valid for as long as the iterator remains at the current position. The value returned in value must be unreffed using GLib.Variant.unref when it is no longer in use.

get_value

def get_value(self) -> GLib.Variant

Gets the value of the attribute at the current iterator position.

The iterator is not advanced.

next

def next(self) -> bool

Attempts to advance the iterator to the next (possibly first) attribute.

True is returned on success, or False if there are no more attributes.

You must call this function when you first acquire the iterator to advance it to the first attribute (and determine if the first attribute exists at all).

Virtual methods

do_get_next

def do_get_next(self) -> tuple[bool, str, GLib.Variant]

This function combines MenuAttributeIter.next with MenuAttributeIter.get_name and MenuAttributeIter.get_value.

First the iterator is advanced to the next (possibly first) attribute. If that fails, then False is returned and there are no other effects.

If successful, name and value are set to the name and value of the attribute that has just been advanced to. At this point, MenuAttributeIter.get_name and MenuAttributeIter.get_value will return the same values again.

The value returned in name remains valid for as long as the iterator remains at the current position. The value returned in value must be unreffed using GLib.Variant.unref when it is no longer in use.