[meld] dirdiff: Rudimentary support for blank folder comparisons (bgo#742342)



commit 7d0afcf991927593c362390a324e438104da1c9a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Feb 6 06:20:49 2015 +1000

    dirdiff: Rudimentary support for blank folder comparisons (bgo#742342)
    
    As a consequence, we also now don't compare a user's home directory to
    itself if the user starts a comparison without selecting any folders.
    
    This 'support' still requires there to be a blank, non-existant entry
    in the comparison tree, but otherwise basically works as expected.
    Getting rid of that blank entry would be nice, but basically everywhere
    in the dirdiff/tree model stack expects to get at least one valid path
    per tree row, so it's a bunch of churn for minimal gain.

 meld/dirdiff.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 87b0aa9..23a30d8 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -635,12 +635,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         for i, l in enumerate(locations):
             if not isinstance(l, unicode):
                 locations[i] = l.decode(sys.getfilesystemencoding())
-        # TODO: Support for blank folder comparisons should probably look here
-        locations = [os.path.abspath(l or ".") for l in locations]
+        locations = [os.path.abspath(l) if l else '' for l in locations]
         self.current_path = None
         self.model.clear()
         for pane, loc in enumerate(locations):
-            self.fileentry[pane].set_filename(loc)
+            if loc:
+                self.fileentry[pane].set_filename(loc)
         child = self.model.add_entries(None, locations)
         self.treeview0.grab_focus()
         self._update_item_state(child)
@@ -1501,6 +1501,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
     def recompute_label(self):
         root = self.model.get_iter_first()
         filenames = self.model.value_paths(root)
+        filenames = [f or _('No folder') for f in filenames]
         if self.custom_labels:
             label_options = zip(self.custom_labels, filenames)
             shortnames = [l[0] or l[1] for l in label_options]


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