Re: Replacing Gtk::Action and Gtk::UIManager with Gio::Action and Gtk::Builder

On Thu, 2013-08-08 at 10:26 +0200, Murray Cumming wrote:
Over the last few days I've spent a long time wrestling with gio's new
GAction API, trying to port some gtkmm code that used GtkAction and
GtkUIManager, both of which GTK+ has now deprecated. This email is to
get some feedback in case I've lost perspective.

Note that several GTK+ developers feel that this API has been deprecated
too soon, but I am not confident that it will be reversed. We might want
to avoid the deprecation in gtkmm even if they do it in GTK+.

Here is some code that I've ported in gtkmm-documentation, in the gmenu
branch (whose commits must be squashed before putting this in master):

And here is what the old code looks like in master, using GtkUIManager:

I've tried to make the C++ API as nice as possible, avoiding the need
for magic incantations, or the need to understand the overly-conceptual
documentation, and avoiding the need to deal with GVariant
(Glib::VariantBase and Glib::Variant<>) too much. For instance, using
templated get_*() and set_*() methods as we do with Glib::Value<>
elsewhere. However, we are limited because we have already declared some
of the API stable:
Therefore, our application code still sometimes has to create and cast
Variants that it gets from, or needs to give to, some methods. Which is

The convenience API, for toggle items and radio items, that I've created
is not pretty. I guess that derived classes would be nicer. I've
suggested that the C API should have these:

There are other problems that prevent a simple deprecation of GtkAction:
* There is no replacement yet for GtkRadioActionItem:

I meant GtkRecentAction:

This is still the major obstacle to us really deprecating GtkAction and
GtkUIManager. I don't see much chance that it will be fixed in the GTK+
API soon enough.

* GtkBuilder's <menu> syntax does not let us define toolbars, like
GtkUIManager's syntax did. But apparently I'll be able to get this
working with GtkBuilder's old syntax and the items' action-name

murrayc murrayc com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]