Gtk.MenuShell.prototype.bind_model
function bind_model(model:Gio.MenuModel, action_namespace:String, with_separators:Boolean):void { // Gjs wrapper for gtk_menu_shell_bind_model() }
Establishes a binding between a Gtk.MenuShell and a Gio.MenuModel.
The contents of @shell are removed and then refilled with menu items according to model. When model changes, @shell is updated. Calling this function twice on @shell with different model will cause the first binding to be replaced with a binding to the new model. If model is null then any previous binding is undone and all children are removed.
with_separators determines if toplevel items (eg: sections) have separators inserted between them. This is typically desired for menus but doesn't make sense for menubars.
If action_namespace is non-null 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 action_namespace is "app" then the effective action name is "app.quit".
For most cases you are probably better off using Gtk.Menu.new_from_model or Gtk.MenuBar.new_from_model or just directly passing the Gio.MenuModel to Gtk.Application.prototype.set_app_menu or gtk_application_set_menu_bar().
Since 3.6
- model
the Gio.MenuModel to bind to or null to remove binding
- action_namespace
the namespace for actions in model
- with_separators
true if toplevel items in @shell should have separators between them