Thanks Tav,

That makes sense.  It sounds, though, like any GtkToolItem can still show as an overflow menu item as long as a proxy menu item is created.  See the following:

https://developer.gnome.org/gtk3/stable/GtkToolbar.html 
https://developer.gnome.org/gtk3/stable/GtkToolItem.html#gtk-tool-item-set-proxy-menu-item

If that's the only feature of GtkAction that we're trying to preserve here, we can just set the proxy menus on non-actionable widgets.  In that case, it should be possible to remove GtkActions as a toolbar dependency fairly easily.

For the GAction stuff, I guess ideally we should be moving to GtkApplication, so we can register actions with application scope.  As a starting point, though, I've had a play with registering GActions with Toolbar scope, and it seems to behave OK.  I just swapped a few things round in the Connectors toolbar if you want to take a look at the diff: https://gitlab.com/inkscape/inkscape/tree/gtk-actions-migration

This way, we could do the migration fairly incrementally, rather than needing a complete overhaul of the application.

If you could share your toy application, that would be great - I'm still trying to get my head round all the options!

AV



On 15 March 2018 at 08:57, Jabier Arraiza <jabier.arraiza@...2893...> wrote:
Thanks both!

-----Original Message-----
From: Tavmjong Bah <tavmjong@...8...>
To: Alex Valavanis <valavanisalex@...400...>, Inkscape Devel List <inks
cape-devel@...840...net>
Subject: Re: [Inkscape-devel] GtkActions in toolbars
Date: Thu, 15 Mar 2018 09:10:07 +0100

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

---------------------------------------------------------------------
---------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
Inkscape-devel@...1656...784...sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-devel