From 66cdba1d8d9a3e821a1bd91c49de339dc392ce6a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sat, 22 Dec 2012 09:23:56 +0000 Subject: [PATCH] rows_reordered is present again in GTK 3.8 svn: r20819 --- gramps/gui/views/listview.py | 13 ++++++++----- gramps/gui/views/treemodels/treebasemodel.py | 12 +++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index 97261acd4..825daaefa 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -620,11 +620,14 @@ class ListView(NavigationView): filter_info = (False, value, value[0] in self.exact_search()) if same_col: - ##TODO GTK3 rows_reordered not exposed by gi, we need to reconnect - ## model to obtain desired effect, but this collapses nodes ... - self.list.set_model(None) - self.model.reverse_order() - self.list.set_model(self.model) + if (Gtk.get_major_version(), Gtk.get_minor_version()) >= (3,8): + self.model.reverse_order() + else: + ## GTK 3.6 rows_reordered not exposed by gi, we need to reconnect + ## model to obtain desired effect, but this collapses nodes ... + self.list.set_model(None) + self.model.reverse_order() + self.list.set_model(self.model) else: self.model = self.make_model(self.dbstate.db, self.sort_col, self.sort_order, diff --git a/gramps/gui/views/treemodels/treebasemodel.py b/gramps/gui/views/treemodels/treebasemodel.py index 8ec76dede..41dbf2ebb 100644 --- a/gramps/gui/views/treemodels/treebasemodel.py +++ b/gramps/gui/views/treemodels/treebasemodel.py @@ -699,10 +699,11 @@ class TreeBaseModel(GObject.Object, Gtk.TreeModel): def reverse_order(self): """ - Reverse the order of the map. This does not signal rows_reordered, - so to propagate the change to the view, you need to reattach the - model to the view. + Reverse the order of the map. Only for Gtk 3.9+ does this signal + rows_reordered, so to propagate the change to the view, you need to + reattach the model to the view. """ + self.GTK38PLUS = (Gtk.get_major_version(), Gtk.get_minor_version()) >= (3,8) self.__reverse = not self.__reverse top_node = self.tree[None] self._reverse_level(top_node) @@ -722,8 +723,9 @@ class TreeBaseModel(GObject.Object, Gtk.TreeModel): else: iternode = self.get_iter(node) path = self.do_get_path(iternode) - ##TODO GTK3: rows_reordered is not exposed in gi - #self.rows_reordered(path, iter, rows) + if self.GTK38PLUS: + ##rows_reordered is only exposed in gi starting GTK 3.8 + self.rows_reordered(path, iter, rows) if self.nrgroups > 1: for child in node.children: self._reverse_level(self.nodemap.node(child[1]))