[gtkmm] Add Gtk::SelectionModel and Gtk::SingleSelection



commit c538cb7ae6a91b01ed85b3943bf9ef84d3ecfe8e
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Feb 25 14:51:22 2019 +0100

    Add Gtk::SelectionModel and Gtk::SingleSelection

 .gitignore                                |   4 ++
 gtk/gtkmm.h                               |   1 +
 gtk/src/filelist.am                       |   2 +
 gtk/src/gtk_docs_override.xml             |   1 +
 gtk/src/gtk_extra_objects.defs            |  12 ++++
 gtk/src/gtk_signals.defs                  |  62 ++++++++++++++++++
 gtk/src/gtk_vfuncs.defs                   |  67 ++++++++++++++++++++
 gtk/src/selectionmodel.ccg                |  83 ++++++++++++++++++++++++
 gtk/src/selectionmodel.hg                 | 101 ++++++++++++++++++++++++++++++
 gtk/src/singleselection.ccg               |  17 +++++
 gtk/src/singleselection.hg                |  75 ++++++++++++++++++++++
 gtk/src/stack.hg                          |   5 ++
 tools/extra_defs_gen/generate_defs_gtk.cc |   2 +
 tools/m4/convert_gtk.m4                   |   2 +
 14 files changed, 434 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index a435769d..7ca49661 100644
--- a/.gitignore
+++ b/.gitignore
@@ -425,6 +425,8 @@ gtk/gtkmm/searchentry.cc
 gtk/gtkmm/searchentry.h
 gtk/gtkmm/selectiondata.cc
 gtk/gtkmm/selectiondata.h
+gtk/gtkmm/selectionmodel.cc
+gtk/gtkmm/selectionmodel.h
 gtk/gtkmm/separator.cc
 gtk/gtkmm/separator.h
 gtk/gtkmm/separatormenuitem.cc
@@ -444,6 +446,8 @@ gtk/gtkmm/shortcutsshortcut.h
 gtk/gtkmm/shortcutswindow.cc
 gtk/gtkmm/shortcutswindow.h
 gtk/gtkmm/sizegroup.cc
+gtk/gtkmm/singleselection.cc
+gtk/gtkmm/singleselection.h
 gtk/gtkmm/sizegroup.h
 gtk/gtkmm/snapshot.cc
 gtk/gtkmm/snapshot.h
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 3fd888fe..1268c9fa 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -241,6 +241,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/shortcutssection.h>
 #include <gtkmm/shortcutsshortcut.h>
 #include <gtkmm/shortcutswindow.h>
+#include <gtkmm/singleselection.h>
 #include <gtkmm/sizegroup.h>
 #include <gtkmm/snapshot.h>
 #include <gtkmm/spinbutton.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index f31977e9..b0849caf 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -156,6 +156,7 @@ gtkmm_files_any_hg =                \
        searchbar.hg            \
        searchentry.hg          \
        selectiondata.hg        \
+       selectionmodel.hg \
        separator.hg            \
        separatormenuitem.hg    \
        separatortoolitem.hg    \
@@ -165,6 +166,7 @@ gtkmm_files_any_hg =                \
        shortcutssection.hg             \
        shortcutsshortcut.hg            \
        shortcutswindow.hg              \
+       singleselection.hg \
        sizegroup.hg            \
        snapshot.hg             \
        spinbutton.hg           \
diff --git a/gtk/src/gtk_docs_override.xml b/gtk/src/gtk_docs_override.xml
index 3c1abe46..3a8c88c9 100644
--- a/gtk/src/gtk_docs_override.xml
+++ b/gtk/src/gtk_docs_override.xml
@@ -178,6 +178,7 @@
 <substitute_enumerator_name from="G_TYPE_BOOLEAN" to="G_TYPE_BOOLEAN" />
 <substitute_enumerator_name from_prefix="GTK_TREE_SORTABLE_" to_prefix="GTK_TREE_SORTABLE_" />
 <substitute_enumerator_name from="GTK_CAN_FOCUS" to="GTK_CAN_FOCUS" />
+<substitute_enumerator_name from="GTK_INVALID_LIST_POSITION" to="GTK_INVALID_LIST_POSITION" />
 <!-- This is the default substitution. Included here to avoid warnings from DocsParser.pm. -->
 <substitute_enumerator_name from="PANGO_SCALE" to="Pango::SCALE" />
 
diff --git a/gtk/src/gtk_extra_objects.defs b/gtk/src/gtk_extra_objects.defs
index e5c1e552..0aee951c 100644
--- a/gtk/src/gtk_extra_objects.defs
+++ b/gtk/src/gtk_extra_objects.defs
@@ -215,6 +215,18 @@
   (gtype-id "GTK_TYPE_SELECTION_DATA")
 )
 
+(define-object SelectionModel
+  (in-module "Gtk")
+  (c-name "GtkSelectionModel")
+  (gtype-id "GTK_TYPE_SELECTION_MODEL")
+)
+
+(define-object SingleSelection
+  (in-module "Gtk")
+  (c-name "GtkSingleSelection")
+  (gtype-id "GTK_TYPE_SINGLE_SELECTION")
+)
+
 (define-object Snapshot
   (in-module "Gtk")
   (c-name "GtkSnapshot")
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index ee88d12a..ab3d71bb 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -8093,6 +8093,18 @@
   (default-value "FALSE")
 )
 
+;; From GtkSelectionModel
+
+(define-signal selection-changed
+  (of-object "GtkSelectionModel")
+  (return-type "void")
+  (flags "Run Last")
+  (parameters
+    '("guint" "p0")
+    '("guint" "p1")
+  )
+)
+
 ;; From GtkSeparator
 
 ;; From GtkSeparatorToolItem
@@ -8845,6 +8857,56 @@
   (default-value "")
 )
 
+;; From GtkSingleSelection
+
+(define-property autoselect
+  (of-object "GtkSingleSelection")
+  (prop-type "GParamBoolean")
+  (docs "If the selection will always select an item")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+  (default-value "TRUE")
+)
+
+(define-property can-unselect
+  (of-object "GtkSingleSelection")
+  (prop-type "GParamBoolean")
+  (docs "If unselecting the selected item is allowed")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+  (default-value "FALSE")
+)
+
+(define-property selected
+  (of-object "GtkSingleSelection")
+  (prop-type "GParamUInt")
+  (docs "Position of the selected item")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+  (default-value "4294967295")
+)
+
+(define-property selected-item
+  (of-object "GtkSingleSelection")
+  (prop-type "GParamObject")
+  (docs "The selected item")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property model
+  (of-object "GtkSingleSelection")
+  (prop-type "GParamObject")
+  (docs "The model")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From GtkSizeGroup
 
 (define-property mode
diff --git a/gtk/src/gtk_vfuncs.defs b/gtk/src/gtk_vfuncs.defs
index dd35a724..cf84003e 100644
--- a/gtk/src/gtk_vfuncs.defs
+++ b/gtk/src/gtk_vfuncs.defs
@@ -467,6 +467,73 @@
   )
 )
 
+; GtkSelectionModel
+
+(define-vfunc is_selected
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+  (parameters
+    '("guint" "position")
+  )
+)
+
+(define-vfunc select_item
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+  (parameters
+    '("guint" "position")
+    '("gboolean" "exclusive")
+  )
+)
+
+(define-vfunc unselect_item
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+  (parameters
+    '("guint" "position")
+  )
+)
+
+(define-vfunc select_range
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+  (parameters
+    '("guint" "position")
+    '("guint" "n_items")
+    '("gboolean" "exclusive")
+  )
+)
+
+(define-vfunc unselect_range
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+  (parameters
+    '("guint" "position")
+    '("guint" "n_items")
+  )
+)
+
+(define-vfunc select_all
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+)
+
+(define-vfunc unselect_all
+  (of-object "GtkSelectionModel")
+  (return-type "gboolean")
+)
+
+(define-vfunc query_range
+  (of-object "GtkSelectionModel")
+  (return-type "void")
+  (parameters
+    '("guint" "position")
+    '("guint*" "start_range")
+    '("guint*" "n_items")
+    '("gboolean*" "selected")
+  )
+)
+
 ; GtkToolShell
 
 (define-vfunc get_orientation
diff --git a/gtk/src/selectionmodel.ccg b/gtk/src/selectionmodel.ccg
new file mode 100644
index 00000000..1a9d11b5
--- /dev/null
+++ b/gtk/src/selectionmodel.ccg
@@ -0,0 +1,83 @@
+/* Copyright (C) 2019 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+// This vfunc callback and the corresponding vfunc are custom implemented because we want
+// an output argument of the C++ vfunc to be bool& (not gboolean* or gboolean&).
+void SelectionModel_Class::query_range_vfunc_callback(GtkSelectionModel* self, guint position, guint* 
start_range, guint* n_items, gboolean* selected)
+{
+  const auto obj_base = static_cast<Glib::ObjectBase*>(
+      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+  // Non-gtkmmproc-generated custom classes implicitly call the default
+  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+  // generated classes can use this optimisation, which avoids the unnecessary
+  // parameter conversions if there is no possibility of the virtual function
+  // being overridden:
+  if(obj_base && obj_base->is_derived_())
+  {
+    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
+    {
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+        // Call the virtual member method, which derived classes might override.
+        // Assuming that none of start_range, n_items, selected is nullptr.
+        // gtk_selection_model_query_range() guarantees it,
+        // and gtk_single_selection_query_range() assumes it.
+        bool selected_cxx = *selected;
+        obj->query_range_vfunc(position, *start_range, *n_items, selected_cxx);
+        *selected = selected_cxx;
+        return;
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+    }
+  }
+
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C 
interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  // Call the original underlying C function:
+  if(base && base->query_range)
+    (*base->query_range)(self, position, start_range, n_items, selected);
+}
+
+void Gtk::SelectionModel::query_range_vfunc(guint position, guint& start_range, guint& n_items, bool& 
selected) const
+{
+  const auto base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C 
interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  if(base && base->query_range)
+  {
+    gboolean selected_c = selected;
+    (*base->query_range)(const_cast<GtkSelectionModel*>(gobj()), position, &start_range, &n_items, 
&selected_c);
+    selected = selected_c;
+  }
+}
+
+} // namespace Gtk
+
diff --git a/gtk/src/selectionmodel.hg b/gtk/src/selectionmodel.hg
new file mode 100644
index 00000000..3435a013
--- /dev/null
+++ b/gtk/src/selectionmodel.hg
@@ -0,0 +1,101 @@
+/* Copyright (C) 2019 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/interface.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+extern "C"
+{
+typedef struct _GtkSelectionModelInterface GtkSelectionModelInterface;
+}
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gtk
+{
+
+/** An extension of the list model interface that handles selections.
+ *
+ * %Gtk::SelectionModel is an interface that extends the Gio::ListModel interface by adding
+ * support for selections. This support is then used by widgets using list models to add
+ * the ability to select and unselect various items.
+ *
+ * GTK provides default implementations of the common selection modes such as
+ * Gtk::SingleSelection, so you will only need to implement this interface if you want
+ * detailed control about how selections should be handled.
+ *
+ * A %Gtk::SelectionModel supports a single boolean per row indicating if a row is selected
+ * or not. This can be queried via is_selected(). When the selected
+ * state of one or more rows changes, the model will emit
+ * signal_selection_changed() by calling the
+ * selection_changed() method. The positions given in that signal
+ * may have their selection state changed, though that is not a requirement.  
+ * If new items added to the model via Gio::ListModel::signal_items_changed() are selected
+ * or not is up to the implementation.
+ *
+ * Additionally, the interface can expose functionality to select and unselect items.
+ * If these functions are implemented, GTK's list widgets will allow users to select and
+ * unselect items. However, %Gtk::SelectionModels are free to only implement them
+ * partially or not at all. In that case the widgets will not support the unimplemented
+ * operations.
+ *
+ * When selecting or unselecting is supported by a model, the return values of the
+ * selection functions do NOT indicate if selection or unselection happened. They are
+ * only meant to indicate complete failure, like when this mode of selecting is not
+ * supported by the model.
+ * Selections may happen asynchronously, so the only reliable way to find out when an
+ * item was selected is to listen to the signals that indicate selection.
+ *
+ * @see Gio::ListModel, Gtk::SingleSelection
+ * @newin{3,96}
+ */
+class SelectionModel : public Glib::Interface
+{
+  _CLASS_INTERFACE(SelectionModel, GtkSelectionModel, GTK_SELECTION_MODEL, GtkSelectionModelInterface)
+
+public:
+  _WRAP_METHOD(bool is_slected(guint position) const, gtk_selection_model_is_selected)
+  _WRAP_METHOD(bool select_item(guint position, bool exclusive), gtk_selection_model_select_item)
+  _WRAP_METHOD(bool unselect_item(guint position), gtk_selection_model_unselect_item)
+  _WRAP_METHOD(bool select_range(guint position, guint n_items, bool exclusive), 
gtk_selection_model_select_range)
+  _WRAP_METHOD(bool unselect_range(guint position, guint n_items), gtk_selection_model_unselect_range)
+  _WRAP_METHOD(bool select_all(), gtk_selection_model_select_all)
+  _WRAP_METHOD(bool unselect_all(), gtk_selection_model_unselect_all)
+  _WRAP_METHOD(void query_range(guint position, guint& start_range, guint& n_items, bool& selected) const,
+    gtk_selection_model_query_range)
+
+  // no_default_handler because the wrapped C signal has no default handler.
+  _WRAP_SIGNAL(void selection_changed(guint position, guint n_items), "selection-changed", 
no_default_handler)
+
+protected:
+  // For implementations only
+  _WRAP_METHOD(void selection_changed(guint position, guint n_items), gtk_selection_model_selection_changed)
+
+  _WRAP_VFUNC(bool is_selected(guint position) const, is_selected)
+  _WRAP_VFUNC(bool select_item(guint position, bool exclusive), select_item)
+  _WRAP_VFUNC(bool unselect_item(guint position), unselect_item)
+  _WRAP_VFUNC(bool select_range(guint position, guint n_items, bool exclusive), select_range)
+  _WRAP_VFUNC(bool unselect_range(guint position, guint n_items), unselect_range)
+  _WRAP_VFUNC(bool select_all(), select_all)
+  _WRAP_VFUNC(bool unselect_all(), unselect_all)
+  _WRAP_VFUNC(void query_range(guint position, guint& start_range, guint& n_items, bool& selected) const,
+    query_range, custom_vfunc_callback, custom_vfunc)
+
+};
+
+} // namespace Gtk
diff --git a/gtk/src/singleselection.ccg b/gtk/src/singleselection.ccg
new file mode 100644
index 00000000..3663c616
--- /dev/null
+++ b/gtk/src/singleselection.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2019 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
diff --git a/gtk/src/singleselection.hg b/gtk/src/singleselection.hg
new file mode 100644
index 00000000..f306431a
--- /dev/null
+++ b/gtk/src/singleselection.hg
@@ -0,0 +1,75 @@
+/* Copyright (C) 2019 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <glibmm/refptr.h>
+#include <giomm/listmodel.h>
+#include <gtkmm/selectionmodel.h>
+#include <gtk/gtk.h> // Declares GtkSingleSelection and GtkSingleSelectionClass
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gtk
+{
+/** A selection model that allows selecting a single item.
+ *
+ * %Gtk::SingleSelection is an implementation of the Gtk::SelectionModel interface 
+ * that allows selecting a single element. It is the default selection method
+ * used by list widgets in GTK.
+ *
+ * @see SelectionModel
+ * @newin{3,96}
+ */
+class SingleSelection : public Glib::Object, public Gio::ListModel, public SelectionModel
+{
+  _CLASS_GOBJECT(SingleSelection, GtkSingleSelection, GTK_SINGLE_SELECTION, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(Gio::ListModel)
+  _IMPLEMENTS_INTERFACE(SelectionModel)
+  _STRUCT_NOT_HIDDEN
+
+protected:
+  _CTOR_DEFAULT()
+  _WRAP_CTOR(SingleSelection(const Glib::RefPtr<Gio::ListModel>& model), gtk_single_selection_new)
+
+public:
+  _WRAP_CREATE()
+  _WRAP_CREATE(const Glib::RefPtr<Gio::ListModel>& model)
+
+  _WRAP_METHOD(guint get_selected() const, gtk_single_selection_get_selected)
+  _WRAP_METHOD(void set_selected(guint position), gtk_single_selection_set_selected)
+
+#m4 _CONVERSION(`gpointer',`Glib::RefPtr<Glib::ObjectBase>',`Glib::wrap(G_OBJECT($3))')
+  _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_selected_item(),
+    gtk_single_selection_get_selected_item, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_selected_item() const,
+    gtk_single_selection_get_selected_item, refreturn, constversion)
+
+  _WRAP_METHOD(bool get_autoselect() const, gtk_single_selection_get_autoselect)
+  _WRAP_METHOD(void set_autoselect(bool autoselect = true), gtk_single_selection_set_autoselect)
+  _WRAP_METHOD(bool get_can_unselect() const, gtk_single_selection_get_can_unselect)
+  _WRAP_METHOD(void set_can_unselect(bool can_unselect = true), gtk_single_selection_set_can_unselect)
+
+  _WRAP_PROPERTY("autoselect", bool)
+  _WRAP_PROPERTY("can-unselect", bool)
+  _WRAP_PROPERTY("selected", guint)
+  _WRAP_PROPERTY("selected-item", Glib::RefPtr<Glib::ObjectBase>)
+  _WRAP_PROPERTY("model", Glib::RefPtr<Gio::ListModel>)
+
+  // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/stack.hg b/gtk/src/stack.hg
index 40c1828c..b65f47b1 100644
--- a/gtk/src/stack.hg
+++ b/gtk/src/stack.hg
@@ -19,6 +19,7 @@
 #include <gtkmm/container.h>
 #include <gtkmm/stackpage.h>
 #include <gtkmm/enums.h>
+#include <gtkmm/selectionmodel.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/container_p.h)
@@ -85,6 +86,9 @@ public:
   _WRAP_METHOD(void set_interpolate_size(bool interpolate_size), gtk_stack_set_interpolate_size, newin 
"3,20")
   _WRAP_METHOD(bool get_interpolate_size() const, gtk_stack_get_interpolate_size, newin "3,20")
 
+  _WRAP_METHOD(Glib::RefPtr<SelectionModel> get_pages(), gtk_stack_get_pages)
+  _WRAP_METHOD(Glib::RefPtr<const SelectionModel> get_pages() const, gtk_stack_get_pages, constversion)
+
   _WRAP_PROPERTY("homogeneous", bool)
   _WRAP_PROPERTY("hhomogeneous", bool)
   _WRAP_PROPERTY("transition-duration", unsigned int)
@@ -94,6 +98,7 @@ public:
   _WRAP_PROPERTY("visible-child", Widget*)
   _WRAP_PROPERTY("visible-child-name", Glib::ustring)
   _WRAP_PROPERTY("interpolate-size", bool, newin "3,20")
+  _WRAP_PROPERTY("pages", Glib::RefPtr<SelectionModel>)
 
   // There are no signals or vfuncs.
 };
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 44cd1b6f..9afabdc4 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -182,6 +182,7 @@ int main(int /* argc */, char** /* argv */)
             << get_defs( GTK_TYPE_SCROLLED_WINDOW )
             << get_defs( GTK_TYPE_SEARCH_BAR )
             << get_defs( GTK_TYPE_SEARCH_ENTRY )
+            << get_defs( GTK_TYPE_SELECTION_MODEL )
             << get_defs( GTK_TYPE_SEPARATOR )
             << get_defs( GTK_TYPE_SEPARATOR_TOOL_ITEM )
             << get_defs( GTK_TYPE_SETTINGS )
@@ -190,6 +191,7 @@ int main(int /* argc */, char** /* argv */)
             << get_defs( GTK_TYPE_SHORTCUTS_SECTION )
             << get_defs( GTK_TYPE_SHORTCUTS_SHORTCUT )
             << get_defs( GTK_TYPE_SHORTCUTS_WINDOW )
+            << get_defs( GTK_TYPE_SINGLE_SELECTION )
             << get_defs( GTK_TYPE_SIZE_GROUP )
             << get_defs( GTK_TYPE_SPINNER )
             << get_defs( GTK_TYPE_SPIN_BUTTON )
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index e56ffc2f..c95bffff 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -567,6 +567,8 @@ _CONVERSION(`GMenuModel*',`Glib::RefPtr<const Gio::MenuModel>',`Glib::wrap($3)')
 
 _CONVERSION(`GListModel*',`Glib::RefPtr<Gio::ListModel>',`Glib::wrap($3)')
 _CONVERSION(`GListModel*',`Glib::RefPtr<const Gio::ListModel>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gio::ListModel>&',`GListModel*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`GtkSelectionModel*',`Glib::RefPtr<SelectionModel>',`Glib::wrap($3)')
 
 _CONVERSION(`const 
Glib::RefPtr<Gio::ActionGroup>&',`GActionGroup*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::ActionGroup))
 _CONVERSION(`GActionGroup*',`Glib::RefPtr<Gio::ActionGroup>',`Glib::wrap($3)')


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