Fix AttributeError on GTK 3.24.14
GTK 3.24.14 introduced a breaking change to fix a constructor for
Gtk.TreeModelSort.
e3247ed0d9 ("Annotate GtkTreeModelSort.new_with_model() appropriately")
https://gitlab.gnome.org/GNOME/gtk/issues/1077
https://bugzilla.gnome.org/show_bug.cgi?id=680009
https://bugzilla.gnome.org/show_bug.cgi?id=634823
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: James Cameron <quozl@laptop.org>
James Cameron authored 4 years ago
Ibiam Chihurumnaya committed 4 years ago
108 | 108 | self._treemodel = Gtk.TreeStore(GObject.TYPE_STRING, |
109 | 109 | GObject.TYPE_STRING) |
110 | 110 | |
111 | # README: https://bugzilla.gnome.org/show_bug.cgi?id=680009 | |
112 | sorted = self._treemodel.sort_new_with_model() | |
111 | if hasattr(Gtk.TreeModelSort, 'new_with_model'): | |
112 | # GTK 3.24.14 and later | |
113 | sorted = Gtk.TreeModelSort.new_with_model(self._treemodel) | |
114 | else: | |
115 | # GTK 3.24.13 and earlier, gtk/e3247ed0d9 | |
116 | sorted = self._treemodel.sort_new_with_model() | |
117 | ||
113 | 118 | sorted.set_sort_column_id(0, Gtk.SortType.ASCENDING) |
114 | 119 | sorted.set_sort_func(0, self._sort_logfile) |
115 | 120 | self._treeview.set_model(sorted) |