[meld] vcview: Support setting tab label, improve version labels (bgo#699056)



commit fa11317b77478ec2beb3c8c2ed3f49cda58ba2d9
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu Apr 24 07:54:17 2014 +1000

    vcview: Support setting tab label, improve version labels (bgo#699056)
    
    Having good labels that work for all VCs is hard, so these strings are
    a compromise. Setting the tab label automatically based on the strings
    used for the pane labels isn't sensible, so we now specify that as
    well.
    
    This commit also fixes some very confused ordering of local/remote
    labels for versions.

 meld/filediff.py |    8 +++++---
 meld/vcview.py   |   23 ++++++++++++++++-------
 2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index fee2bca..a18d999 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1083,9 +1083,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             self.file_save_button[i].props.stock_id = (
                 Gtk.STOCK_SAVE if buf.data.writable else Gtk.STOCK_SAVE_AS)
 
-        # FIXME: Account for meta label information
-
-        self.label_text = (" — ").decode('utf8').join(shortnames)
+        label = self.meta.get("tablabel", "")
+        if label:
+            self.label_text = label
+        else:
+            self.label_text = (" — ").decode('utf8').join(shortnames)
         self.tooltip_text = self.label_text
         self.label_changed()
 
diff --git a/meld/vcview.py b/meld/vcview.py
index 5445ef1..924d7f1 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -494,14 +494,21 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
 
         if self.vc.get_entry(path).state == tree.STATE_CONFLICT and \
                 hasattr(self.vc, 'get_path_for_conflict'):
+            local_label = _(u"%s — local") % basename
+            remote_label = _(u"%s — remote") % basename
+
             # We create new temp files for other, base and this, and
             # then set the output to the current file.
             if self.props.merge_file_order == "local-merge-remote":
                 conflicts = (tree.CONFLICT_THIS, tree.CONFLICT_MERGED,
                              tree.CONFLICT_OTHER)
+                meta['labels'] = (local_label, None, remote_label)
+                meta['tablabel'] = _(u"%s (local, merge, remote)") % basename
             else:
                 conflicts = (tree.CONFLICT_OTHER, tree.CONFLICT_MERGED,
                              tree.CONFLICT_THIS)
+                meta['labels'] = (remote_label, None, local_label)
+                meta['tablabel'] = _(u"%s (remote, merge, local)") % basename
             diffs = [self.vc.get_path_for_conflict(path, conflict=c)
                      for c in conflicts]
             temps = [p for p, is_temp in diffs if is_temp]
@@ -511,17 +518,19 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 'merge_output': path,
             }
             meta['prompt_resolve'] = True
-            meta['labels'] = (
-                _(u"%s — local") % basename, None,
-                _(u"%s — remote") % basename
-            )
         else:
+            remote_label = _(u"%s — repository") % basename
             comp_path = self.vc.get_path_for_repo_file(path)
             temps = [comp_path]
-            diffs = [path, comp_path] if left_is_local else [comp_path, path]
+            if left_is_local:
+                diffs = [path, comp_path]
+                meta['labels'] = (None, remote_label)
+                meta['tablabel'] = _(u"%s (working, repository)") % basename
+            else:
+                diffs = [comp_path, path]
+                meta['labels'] = (remote_label, None)
+                meta['tablabel'] = _(u"%s (repository, working)") % basename
             kwargs = {}
-            meta['labels'] = (
-                _(u"%s — local") % basename, None)
         kwargs['meta'] = meta
 
         for temp_file in temps:


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