Package: gtk

Function gtk-popover-bind-model

Lambda List

gtk-popover-bind-model (popover model namespace)

Arguments

popover -- a gtk-popover widget
model -- a g-menu-model object to bind to or nil to remove the binding
namespace -- a string with the namespace for actions in model

Details

Establishes a binding between a popover and a menu model.

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

If the namespace argument 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 the namespace argument is "app" then the effective action name is "app.quit".

This function uses the gtk-actionable interface to define the action name and target values on the created menu items. If you want to use an action group other than "app" and "win", or if you want to use a gtk-menu-shell widget outside of a gtk-application-window widget, then you will need to attach your own action group to the widget hierarchy using the gtk-widget-insert-action-group function. As an example, if you created a group with a "quit" action and inserted it with the name "mygroup" then you would use the action name "mygroup.quit" in your g-menu-model object.
 

See also

2021-12-25