Replacing Gtk::Action and Gtk::UIManager with Gio::Action and Gtk::Builder
- From: Murray Cumming <murrayc murrayc com>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: Replacing Gtk::Action and Gtk::UIManager with Gio::Action and Gtk::Builder
- Date: Thu, 08 Aug 2013 10:26:20 +0200
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):
http://tinyurl.com/lbgv3uo
And here is what the old code looks like in master, using GtkUIManager:
http://tinyurl.com/ktmllcb
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:
http://tinyurl.com/kmbyt8d
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
annoying.
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:
https://bugzilla.gnome.org/show_bug.cgi?id=705655
There are other problems that prevent a simple deprecation of GtkAction:
* There is no replacement yet for GtkRadioActionItem:
https://bugzilla.gnome.org/show_bug.cgi?id=705656
* 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
properties.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]