[meld] dirdiff, vcview: Update GtkTreePath handling to avoid using tuples



commit d7d89e52817a979facd33a9d8269b58adce4ea8c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Dec 15 07:06:04 2013 +1000

    dirdiff, vcview: Update GtkTreePath handling to avoid using tuples

 meld/dirdiff.py |    7 ++++---
 meld/vcview.py  |    6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index ec1f5fa..8dee37e 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -626,7 +626,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
 
     def file_created(self, path, pane):
         it = self.model.get_iter(path)
-        while it and self.model.get_path(it) != (0,):
+        root = Gtk.TreePath.new_first()
+        while it and self.model.get_path(it) != root:
             self._update_item_state( it )
             it = self.model.iter_parent(it)
         self._update_diffmaps()
@@ -656,7 +657,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         self._update_item_state(child)
         self.recompute_label()
         self.scheduler.remove_all_tasks()
-        self.recursively_update( (0,) )
+        self.recursively_update(Gtk.TreePath.new_first())
         self._update_diffmaps()
 
     def get_comparison(self):
@@ -808,7 +809,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         yield _("[%s] Done") % self.label_text
 
         self.scheduler.add_task(self.on_treeview_cursor_changed)
-        self.treeview[0].get_selection().select_path((0,))
+        self.treeview[0].get_selection().select_path(Gtk.TreePath.new_first())
 
     def _show_tree_wide_errors(self, invalid_filenames, shadowed_entries):
         header = _("Multiple errors occurred while scanning this folder")
diff --git a/meld/vcview.py b/meld/vcview.py
index 14c41d8..59f111f 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -26,6 +26,7 @@ import stat
 import sys
 from gettext import gettext as _
 
+from gi.repository import Gdk
 from gi.repository import GLib
 from gi.repository import Gio
 from gi.repository import GObject
@@ -431,7 +432,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                         symlinks_followed.add(key)
 
                     if flattened:
-                        todo.append(((0,), e.path))
+                        todo.append((Gtk.TreePath.new_first(), e.path))
                         continue
 
                 child = self.model.add_entries(it, [e.path])
@@ -440,7 +441,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                     todo.append((self.model.get_path(child), e.path))
 
             if flattened:
-                self.treeview.expand_row(Gtk.TreePath((0,)), False)
+                root = Gtk.TreePath.new_first()
+                self.treeview.expand_row(Gtk.TreePath(root), False)
             else:
                 if not entries:
                     self.model.add_empty(it, _("(Empty)"))


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