Porting from gtkmm-2.4 to gtkmm-3.0
See also Migrating from GTK+ 2.x to GTK+ 3 about the C API.
The gtkmm-3.0 ABI installs in parallel with the gtkmm-2.4 ABI, of which gtkmm 2.24 is currently the latest stable version. This allows application developers to start using it when they choose to, without being forced, and without breaking existing installed applications.
gtkmm-3.0 is mostly API-compatible with gtkmm-2.4, though some small changes will be needed in application source code.
Deprecated API with gtkmm-2.4
Some of the new API is in recent versions of gtkmm 2.x, replacing deprecated gtkmm-2.4 API. You can prepare your application for gtkmm-3.0 by avoiding use of deprecated API.
For instance, by using the DK_ARG_ENABLE_WARNINGS macro (from dk_warn.m4) to add an --enable-warnings=fatal configure option, the compiler will complain and abort on all compiler warnings and prevent the use of deprecated gtkmm API. For instance, these applications use that configure macro: Merkmal, GHangtuxmm. See http://www.murrayc.com/blog/permalink/2011/01/18/avoiding-use-of-deprecated-api/ for more details.
You may also use the MM_ARG_ENABLE_WARNINGS macro from mm-common (calling mm-common-prepare from your autogen.sh), as used by these applications: Glom, glom-postgresql-setup. See http://www.murrayc.com/blog/permalink/2011/01/18/avoiding-use-of-deprecated-api/ for more details.
- on_expose_event() is now on_draw().
on_draw() provides a Cairo::Context instead of an ExposeEvent. It is pre-clipped, so you no longer need to call Cairo::Context::clip().
- Likewise, signal_expose_event is now signal_draw.
- Gtk::Widget::draw_*() methods have been removed.
- Use Cairo::Context methods instead.
ComboBoxEntry and ComboBoxEntryText are gone.
Please use ComboBox and ComboBoxText with has_entry=true.
ComboBoxText::clear() and clear_items() are gone: Please use ComboBoxText::remove_all().
- Notebook::pages() is gone.
- Please use Notebook::append_page() and Notebook::get_nth_page() instead.
- Gdk::Color has been replaced by Gdk::RGBA.
- Gdk::Color::set_rgb() has been replaced by Gdk::RGBA::set_rgba() and notice that the old method took gushort (a value between 0 and 65535) but the new one takes doubles (a value between 0 and 1).
- Gdk::Color::set_rgba_p() took doubles in the same way.
- Gdk::RGBA::set_rgba_u() exists as an equivalent of the old set_rgb(gushort).
Gtk::Style and Gtk::Rc have been replaced by Gtk::StyleContext and Gtk::CssProvider (and its StyleProvider base class).
We don't use the intermediate container types any more. Instead we just use std::vector. So you'll need to change your code if you used std::list with these methods.