GNOME Bugzilla – Bug 772391
Gtkmm tutorial: Add an equivalent of gtk+'s example application
Last modified: 2016-10-25 07:02:33 UTC
Gtk+'s documentation contains an example application, https://developer.gnome.org/gtk3/stable/ch01s04.html It's built in several steps. Each step contains buildable source code. The final step is a quite useful application. This example should be translated to C++/gtkmm and included in the gtkmm tutorial. The descriptive text should be included in the tutorial in a new chapter, of course with necessary modifications. I have started with the source code of the first few steps. (not uploaded yet)
I have pushed the first 3 sections (out of 9) of the new "Building applications" chapter, and the source code corresponding to those steps. https://git.gnome.org/browse/gtkmm-documentation/commit/?id=280d7393b9cc176a851faa32952a7cff59a74ac8
I have pushed sections 4-6 (out of 9) of the new "Building applications" chapter, and the source code corresponding to those steps. https://git.gnome.org/browse/gtkmm-documentation/commit/?id=0432609e23c645046c4ae330c47801d842f236e6 When I translated the code in step 5 (A preference dialog) from gtk+ to gtkmm, I had to use RefPtr::operator->() to get a plain pointer from a RefPtr: m_settings->bind("font", tag.operator->(), "font"); This problem is discussed in bug 495762. In this case, I think the best solution would be to add a Gio::Settings::bind() overload that takes a RefPtr. void Gio::Settings::bind(const Glib::ustring& key, const Glib::RefPtr<Glib::ObjectBase>& object, const Glib::ustring& property, Gio::SettingsBindFlags flags=SETTINGS_BIND_DEFAULT);
I have pushed sections 7-9 (the last ones) of the new "Building applications" chapter, and the source code corresponding to those steps. https://git.gnome.org/browse/gtkmm-documentation/commit/?id=511f27dae2d33b6a73ae7d7b5db8a9b2a4d2b11c When I translated the code in step 8 (Properties) from gtk+ to gtkmm, I noticed that g_property_action_new() has not been wrapped in glibmm. I had to call it directly. Perhaps we should add a Gio::PropertyAction class. The whole "Building applications" chapter has now been added to the gtkmm tutorial.
(In reply to Kjell Ahlstedt from comment #2) > I had to use RefPtr::operator->() to get a plain pointer from a RefPtr: > > m_settings->bind("font", tag.operator->(), "font"); I have changed it to m_settings->bind("font", tag->property_font()); Strange that I didn't notice Gio::Settings::bind(key, property_proxy, flags) before. It's usually better than bind(key, object, property_name, flags). We don't need a bind() overload taking a RefPtr.