rows_reordered is present again in GTK 3.8

svn: r20819
This commit is contained in:
Benny Malengier 2012-12-22 09:23:56 +00:00
parent 8fa4de8f9a
commit 66cdba1d8d
2 changed files with 15 additions and 10 deletions

View File

@ -620,7 +620,10 @@ class ListView(NavigationView):
filter_info = (False, value, value[0] in self.exact_search()) filter_info = (False, value, value[0] in self.exact_search())
if same_col: if same_col:
##TODO GTK3 rows_reordered not exposed by gi, we need to reconnect 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 ... ## model to obtain desired effect, but this collapses nodes ...
self.list.set_model(None) self.list.set_model(None)
self.model.reverse_order() self.model.reverse_order()

View File

@ -699,10 +699,11 @@ class TreeBaseModel(GObject.Object, Gtk.TreeModel):
def reverse_order(self): def reverse_order(self):
""" """
Reverse the order of the map. This does not signal rows_reordered, Reverse the order of the map. Only for Gtk 3.9+ does this signal
so to propagate the change to the view, you need to reattach the rows_reordered, so to propagate the change to the view, you need to
model to the view. reattach the model to the view.
""" """
self.GTK38PLUS = (Gtk.get_major_version(), Gtk.get_minor_version()) >= (3,8)
self.__reverse = not self.__reverse self.__reverse = not self.__reverse
top_node = self.tree[None] top_node = self.tree[None]
self._reverse_level(top_node) self._reverse_level(top_node)
@ -722,8 +723,9 @@ class TreeBaseModel(GObject.Object, Gtk.TreeModel):
else: else:
iternode = self.get_iter(node) iternode = self.get_iter(node)
path = self.do_get_path(iternode) path = self.do_get_path(iternode)
##TODO GTK3: rows_reordered is not exposed in gi if self.GTK38PLUS:
#self.rows_reordered(path, iter, rows) ##rows_reordered is only exposed in gi starting GTK 3.8
self.rows_reordered(path, iter, rows)
if self.nrgroups > 1: if self.nrgroups > 1:
for child in node.children: for child in node.children:
self._reverse_level(self.nodemap.node(child[1])) self._reverse_level(self.nodemap.node(child[1]))