WIP: Replace GtkUIManager
Prelude: I'm terribly sorry for the code dump, but this issue touches a lot of code.
Currently, in GTK3,
GtkAction are deprecated, and in GTK4, both of them will be removed. I've been working on rewriting the code they touch, and I have made a lot of progress. A few items to touch on:
There is no replacement for
GtkUIManagerso I wrote a replacement for the functionality Evolution uses in commit 093fcdb7. This rewrite is actually more flexible than
GtkUIManagersince a component merging a menu describes where each menu item is to be merged relative to other items in the menu bar. In the menubar, items are given an id attribute, and in the merged menu, items are given either a before or after attribute describing their position relative to an item in the menubar. An example of this in action is in evolution-plugin-manager.c.
In addition to
GtkMenuBarwill also be removed in GTK4 (GtkMenu, GtkMenuBar and GtkMenuItem are gone). There is a replacement
GtkPopoverMenuBar, but it is more limited than
GtkMenuBar. For example, in Evolution, if the switcher is hidden, then the user cannot make any changes to the switcher appearance—the menu is disabled. However, there is no way to access this menu item and disable it with
GtkPopoverMenuBar. Therefore, instead of reimplementing features such as these in this rewrite, I believe it is best to remove them since they will not be possible in GTK4 or very difficult.
With the switch to the new
GAction-based menus, a plugin must provide a
GActionfor each menu item. In evolution-plugin-manager.c, I create an action to activate the plugin manager dialog, and I install an action map containing that action with a custom prefix on the window so that the action name does not conflict with any other plugin's name. It might be nice to provide every extension with an action map that it can add its actions to in order to guarantee that no names conflict.
I've dumped the code now so that it's hopefully less daunting and I can get some feedback sooner rather than later.