summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-03-07 13:22:54 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2020-03-17 08:31:12 +0000
commit9cdbc56fbac4db2de78dc080934b8f0a7efc892a (patch)
tree9724a554a4685d3f14c871e6e5066927730329f3 /gi
parent9f50957ea17f116fafc44be5e26c08fc3c1179b0 (diff)
downloadpygobject-9cdbc56fbac4db2de78dc080934b8f0a7efc892a.tar.gz
Gtk overrides: make sure TreeModelSort.new_with_model and TreeModel.sort_new_with_model exist
In https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1134 the method was changed to a constructor which means the API is different between older and newer gtk. Add fallbacks for both in our overrides so both ways work all the time.
Diffstat (limited to 'gi')
-rw-r--r--gi/overrides/Gtk.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index b4213642..d1ed83da 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -834,6 +834,13 @@ class TreeModel(Gtk.TreeModel):
raise IndexError("could not find tree path '%s'" % key)
return aiter
+ def sort_new_with_model(self):
+ super_object = super(TreeModel, self)
+ if hasattr(super_object, "sort_new_with_model"):
+ return super_object.sort_new_with_model()
+ else:
+ return TreeModelSort.new_with_model(self)
+
def _coerce_path(self, path):
if isinstance(path, Gtk.TreePath):
return path
@@ -973,6 +980,11 @@ class TreeModelSort(Gtk.TreeModelSort):
arg_names=('model',),
category=PyGTKDeprecationWarning)
+ if not hasattr(Gtk.TreeModelSort, "new_with_model"):
+ @classmethod
+ def new_with_model(self, child_model):
+ return TreeModel.sort_new_with_model(child_model)
+
TreeModelSort = override(TreeModelSort)
__all__.append('TreeModelSort')