A GtkUIManager constructs a user interface (menus and toolbars) from
one or more UI definitions, which reference actions from one or more
action groups.
UI Merging
The most remarkable feature of GtkUIManager is that it can overlay a set
of menuitems and toolitems over another one, and demerge them later.
Merging is done based on the names of the XML elements. Each element is
identified by a path which consists of the names of its anchestors, separated
by slashes. For example, the menuitem named "Left" in the example above
has the path /ui/menubar/JustifyMenu/Left and the
toolitem with the same name has path
/ui/toolbar1/JustifyToolItems/Left.
Accelerators
Every action has an accelerator path. Accelerators are installed together with
menuitem proxies, but they can also be explicitly added with
elements in the UI definition. This makes it possible to have accelerators for
actions even if they have no visible proxies.
Smart Separators
The separators created by GtkUIManager are "smart", i.e. they do not show up
in the UI unless they end up between two visible menu or tool items. Separators
which are located at the very beginning or end of the menu or toolbar
containing them, or multiple separators next to each other, are hidden. This
is a useful feature, since the merging of UI elements from multiple sources
can make it hard or impossible to determine in advance whether a separator
will end up in such an unfortunate position.
For separators in toolbars, you can set expand="true" to
turn them from a small, visible separator to an expanding, invisible one.
Toolitems following an expanding separator are effectively right-aligned.
Empty Menus
Submenus pose similar problems to separators inconnection with merging. It is
impossible to know in advance whether they will end up empty after merging.
GtkUIManager offers two ways to treat empty submenus:
make them disappear by hiding the menu item they're attached to
add an insensitive "Empty" item
The behaviour is chosen based on the "hide_if_empty" property of the action
to which the submenu is associated.
GtkUIManager as GtkBuildable
The GtkUIManager implementation of the GtkBuildable interface accepts
GtkActionGroup objects as elements in UI definitions.
A GtkUIManager UI definition as described above can be embedded in
an GtkUIManager