On Wed, 2018-03-14 at 20:05 +0000, Alex Valavanis wrote:
Hi All, In preparation for the Hackfest, I'd like to start looking at ways to reduce (eventually eliminate!) our use of GtkAction.
One of the main uses we currently have for them is in toolbars, where the tool widgets (buttons, spinbuttons etc) are all some kind of subclass of GtkAction, which has been removed from Gtk+ 4. This means that when the user clicks on the button, it triggers an "activate" signal, which is handled by a callback function.
GtkActions have two modes: toolbar and menu. When a toolbar is too short it automatically switches to menu mode, accessed by the triangle at the left of the toolbar.
My question is basically, "what's the point?" Is there any reason why we can't just use a plain old button in most cases, and just connect up the "clicked" signal instead?
If it really needs to be some kind of Action, we could migrate to the GAction API, but this may be much more difficult.
I've done quite a bit of investigation of GActions. I think they are a much more useful than GtkActions. They are not bound to GUI elements like GtkActions. The are more akin to our verbs but with an easy way to attach them to different GUI elements solely by an XML file. (They can be triggered directly by code and they even have a DBUS interface built in.) Replacing GtkActions by GActions is a lot of work but our code will be much simpler.
I have a toy program that uses GActions that I plan on presenting at the Hackfest. I can make it available ahead of time.
Tav
Best wishes,
Alex