It derives from <GMenuModel>.
<GMenu> is a simple implementation of
<GMenuModel>. You populate a
<GMenu> by adding <GMenuItem>
instances to it.
There are some convenience functions to allow you to directly add items
(avoiding <GMenuItem>) for the common cases. To
add a regular item, use menu:insert. To add a
section, use menu:insert-section. To
add a submenu, use menu:insert-submenu.
Convenience function for appending a normal menu item to the end of
self. Combine menu-item:new and
menu:insert-item for a more flexible
alternative.
Appends item to the end of self.
See menu:insert-item for more
information.
Passed: a <GMenu>.
a <GMenu>
Passed: a <GMenuItem>.
a <GMenuItem> to append
Convenience function for appending a section menu item to the end of
self. Combine menu-item:new-section and menu:insert-item for a more flexible alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the section
Convenience function for appending a submenu menu item to the end of
self. Combine menu-item:new-submenu and menu:insert-item for a more flexible alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the submenu
Marks self as frozen.
After the menu is frozen, it is an error to attempt to make any changes
to it. In effect this means that the <GMenu> API
must no longer be used.
This function causes menu-model:is-mutable? to begin returning #f, which
has some positive performance implications.
Convenience function for inserting a normal menu item into self.
Combine menu-item:new and menu:insert-item for a more flexible alternative.
Inserts item into self.
The "insertion" is actually done by copying all of the attribute and link values of item and using them to form a new item within self. As such, item itself is not really inserted, but rather, a menu item that is exactly the same as the one presently described by item.
This means that item is essentially useless after the insertion occurs. Any changes you make to it are ignored unless it is inserted again (at which point its updated values will be copied).
You should probably just free item once you’re done.
There are many convenience functions to take care of common cases. See
menu:insert, menu:insert-section and menu:insert-submenu as well as "prepend" and "append"
variants of each of these functions.
Passed: a <GMenu>.
a <GMenu>
Passed: a 32-bit integer.
the position at which to insert the item
Passed: a <GMenuItem>.
the <GMenuItem> to insert
Convenience function for inserting a section menu item into self.
Combine menu-item:new-section and
menu:insert-item for a more flexible
alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a 32-bit integer.
the position at which to insert the item
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the section
Convenience function for inserting a submenu menu item into self.
Combine menu-item:new-submenu and
menu:insert-item for a more flexible
alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a 32-bit integer.
the position at which to insert the item
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the submenu
Convenience function for prepending a normal menu item to the start of
self. Combine menu-item:new and
menu:insert-item for a more flexible
alternative.
Prepends item to the start of self.
See menu:insert-item for more
information.
Passed: a <GMenu>.
a <GMenu>
Passed: a <GMenuItem>.
a <GMenuItem> to prepend
Convenience function for prepending a section menu item to the start of
self. Combine menu-item:new-section and menu:insert-item for a more flexible alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the section
Convenience function for prepending a submenu menu item to the start of
self. Combine menu-item:new-submenu and menu:insert-item for a more flexible alternative.
Passed: a <GMenu>.
a <GMenu>
Passed: a string, or #f.
the section label, or #f
Passed: a <GMenuModel>.
a <GMenuModel> with the items of the submenu
Removes an item from the menu.
position gives the index of the item to remove.
It is an error if position is not in range the range from 0 to one less than the number of items in the menu.
It is not possible to remove items by identity since items are added to the menu simply by copying their links and attributes (ie: identity of the item itself is not preserved).