Amtk introduction
Amtk introduction Introduction to the Actions, Menus and Toolbars Kit for GTK+

Amtk is the acronym for “Actions, Menus and Toolbars Kit”. It is a basic GtkUIManager replacement based on GAction. GtkUIManager has been deprecated in GTK+ 3, without a good enough replacement for applications that want to keep a traditional UI (with a GtkMenuBar, a GtkToolbar and a GtkStatusbar; in contrast to the new UI with a GtkHeaderBar and a “hamburger menu”).

With Amtk, menus and toolbars are created programmatically, but with convenient APIs (the support for an XML format will maybe be added in the future, contributions welcome). GMenu is not used, a menubar is created with GtkMenuItem's, although the support for GMenu could easily be added.

There are currently several things that are not possible to do with the support of GMenu in GTK+, that Amtk solves:

- Primarily, encoding the information about an action only once, to create both a menu item and a toolbar item for that action. The information needed: a label (i.e. a short description), an icon, a tooltip (i.e. a longer description) and keyboard shortcuts. This is implemented by AmtkActionInfo, with AmtkFactory classes to create menu and toolbar items.

  When writing an XML file to create a GMenu with the format understood by GtkBuilder (see the class description of GtkApplicationWindow), the information in the XML file can be used only to create a GMenu, not a toolbar. It would not be convenient to duplicate the information.

- When a GtkMenuItem is selected (e.g. when the mouse hovers it), showing a longer description in the GtkStatusbar. This is implemented by AmtkApplicationWindow. It makes the UI better self-discoverable, to improve the usability.

- Related to the previous point: having a GtkRecentChooser menu that shows in a GtkStatusbar the full file path when a menu item is selected. This is implemented by amtk_application_window_connect_recent_chooser_menu_to_statusbar().

- Additionally, the Amtk infrastructure permits to share AmtkActionInfo's in a library (with translations); this is a bit similar to GtkStockItem, to reduce the amount of work that an application (and translators) need to do.