Port GtkAction to GAction
Our major usage of GtkAction
is still a sore point in the GTK3 port, and we would ideally get rid of it before releasing GIMP 3.
We haven't discussed the GAction
porting in detail yet, but my idea would be to do it as follows:
First, we port our menus to use GMenuModel
/GMenu
. Such a menu model is basically a recursive tree-like way of describing menus. There's 2 nice things about that API: on one hand we can use things like gtk_menu_new_from_model()
to get context menus (and others) without any effort; on the other hand, it's a very flexible API which allows us to set random attributes which we can fetch later (see e.g. g_menu_item_set_attribute()
)
We can keep track of this menu model in GIMP, and expose API to plug-ins to add items to it. Widgets like the command search dialog can just iterate over it to find the things you want, and filter out to whatever matches the user query.
One precondition of starting the port to GActions is that we need to use a GtkApplication (for APIs like gtk_application_set_accels_for_action()
). I've been looking into this, but it's not an easy task, since the GIMP initialization code is hard to change without regressions
TL;DR: All of the stuff we've been keeping track of in GtkActions (like labels, icons, ... belonging to a certain action) would mostly migrate to GMenuModel-based API. The core action would migrate to GAction, which can then be activated by menu items in the menu model (by setting the "action-name" attribute)