Package: gtk

Function gtk-menu-shell-bind-model

Lambda List

gtk-menu-shell-bind-model (menushell model namespace separators)

Arguments

menushell -- a gtk-menu-shell widget
model -- the g-menu-model object to bind to or nil to remove binding
namespace -- a string with the namespace for actions in the menu model
separators -- true if toplevel items in shell should have separators between them

Details

Establishes a binding between a menu shell and a menu model.

The contents of the menu shell are removed and then refilled with menu items according to the menu model. When the menu model changes, the menu shell is updated. Calling this function twice on the menu shell with different menu model will cause the first binding to be replaced with a binding to the new menu model. If the menu model is nil then any previous binding is undone and all children are removed.

The argument separators determines if toplevel items, e.g. sections, have separators inserted between them. This is typically desired for menus but does not make sense for menubars.

If the argument namespace is non-nil then the effect is as if all actions mentioned in the model have their names prefixed with the namespace, plus a dot. For example, if the action "quit" is mentioned and namespace is "app" then the effective action name is "app.quit".

For most cases you are probably better off using the functions gtk-menu-new-from-model or gtk-menu-bar-new-from-model or just directly passing the g-menu-model object to the functions gtk-application-app-menu or gtk-application-menubar.
 

See also

2021-7-17