[perl-gtk3] Adapt the Gtk3::TreeModelSort::new_with_model overload to work with gtk+ 3.24.14



commit b857d1c1bf1ce29813639d35b5459755ec08462c
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Mar 8 11:05:56 2020 +0100

    Adapt the Gtk3::TreeModelSort::new_with_model overload to work with gtk+ 3.24.14
    
    Based on a patch by Alberts Muktupāvels.
    
    https://gitlab.gnome.org/GNOME/perl-gtk3/issues/5

 lib/Gtk3.pm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 89fb2b2..52a2a6b 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1735,18 +1735,25 @@ sub Gtk3::TreeModelFilter::get {
   return Gtk3::TreeModel::get (@_);
 }
 
-=item * A redirect is added from C<Gtk3::TreeModelSort::new_with_model> to
+=item * Prior to gtk+ 3.24.14, a redirect is added from
+C<Gtk3::TreeModelSort::new_with_model> to
 <Gtk3::TreeModel::sort_new_with_model> so that Gtk3::TreeModelSort objects can
 be constructed normally.
 
 =cut
 
 # Not needed anymore once <https://bugzilla.gnome.org/show_bug.cgi?id=646742>
-# is fixed.
+# is fixed.  This never happened, but in gtk+ 3.24.14, the return type
+# annotation was changed: <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1134>.
 sub Gtk3::TreeModelSort::new_with_model {
-  my ($class, $child_model) = @_;
-  Glib::Object::Introspection->invoke (
-    $_GTK_BASENAME, 'TreeModel', 'sort_new_with_model', $child_model);
+  if (Gtk3::CHECK_VERSION (3, 24, 14)) {
+    Glib::Object::Introspection->invoke (
+      $_GTK_BASENAME, 'TreeModelSort', 'new_with_model', @_);
+  } else {
+    my ($class, $child_model) = @_;
+    Glib::Object::Introspection->invoke (
+      $_GTK_BASENAME, 'TreeModel', 'sort_new_with_model', $child_model);
+  }
 }
 
 =item * Gtk3::TreeModelSort has a C<get> method that calls


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