WIP: Replace GtkUIManager
Prelude: I'm terribly sorry for the code dump, but this issue touches a lot of code.
Currently, in GTK3, GtkUIManager
and 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
GtkUIManager
so I wrote a replacement for the functionality Evolution uses in commit 093fcdb7. This rewrite is actually more flexible thanGtkUIManager
since 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
GtkUIManager
andGtkAction
,GtkMenuBar
will also be removed in GTK4 (GtkMenu, GtkMenuBar and GtkMenuItem are gone). There is a replacementGtkPopoverMenuBar
, but it is more limited thanGtkMenuBar
. 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 withGtkPopoverMenuBar
. 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 aGAction
for 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.