panel.menu_manager
Module for [MenuManager] class
Types 3
The goal of #PanelMenuManager is to simplify the process of merging multiple GtkBuilder .ui files containing menus into a single representation of the application menus. Additionally, it provides the ability to "unmerge" previously merged menus.
This allows for an application to have plugins which seemlessly extends the core application menus.
Implementation notes:
To make this work, we don't use the GMenu instances created by a GtkBuilder instance. Instead, we create the menus ourself and recreate section and submenu links. This allows the #PanelMenuManager to be in full control of the generated menus.
[panel.menu_manager.MenuManager.getMenuById] will always return a #GMenu, however that menu may contain no children until something has extended it later on during the application process.
MenuManager self()Returns `this`, for use in `with` statements.MenuManagerGidBuilder builder()Get builder for [panel.menu_manager.MenuManager] Returns: New builder objectuint addFilename(string filename)uint addResource(string resource)gio.menu.Menu findItemById(string id, out uint position)Locates a menu item that matches id and sets the position within the resulting #GMenu to position.gio.menu.Menu getMenuById(string menuId)string[] getMenuIds()Gets the known menu ids as a string array. Returns:uint merge(string menuId, gio.menu_model.MenuModel menuModel)Note that menu_model is not retained, a copy of it is made.void remove(uint mergeId)This removes items from menus that were added as part of a previous menu merge. Use the value returned from [panel.menumanager.MenuManager.merge] as the mergeid.void setAttributeString(gio.menu.Menu menu, uint position, string attribute, string value)Overwrites an attribute for a menu that was created by #PanelMenuManager.Fluent builder for [panel.menu_manager.MenuManager]