[meld] dirdiff: Add an emblem indicator for the current marked path
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] dirdiff: Add an emblem indicator for the current marked path
- Date: Sat, 12 Mar 2022 23:47:54 +0000 (UTC)
commit 036c7ac027fe3ddb4898037ddfe4211ed23b1376
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Mar 12 09:28:10 2022 +1000
dirdiff: Add an emblem indicator for the current marked path
This is deliberately choosing to override the "newest" marker for two
reasons:
- if you're manually marking something for comparison like this, you
probably don't actually care about whether this one or the other side
is newest, since you're basically indicating that the file you're
comparing to on the other side isn't the correct one; and
- adding a new tree store column (or a third emblem location) just to
store mark information seems like massive overkill.
meld/dirdiff.py | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 2e024431..5e8de5a2 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -248,6 +248,7 @@ def _files_same(files, regexes, comparison_args):
EMBLEM_NEW = "emblem-new"
+EMBLEM_SELECTED = "emblem-default-symbolic"
EMBLEM_SYMLINK = "emblem-symbolic-link"
COL_EMBLEM, COL_EMBLEM_SECONDARY, COL_SIZE, COL_TIME, COL_PERMS, COL_END = (
@@ -821,6 +822,7 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
locations = [os.path.abspath(l) if l else '' for l in locations]
self.current_path = None
+ self.marked = None
self.model.clear()
for m in self.msgarea_mgr:
m.clear()
@@ -1464,10 +1466,14 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
if selected is None:
return
- self.marked = {
- 'mark': self.model.get_iter(selected[0]),
- 'pane': pane
- }
+ old_it = self.marked['mark'] if self.marked else None
+ it = self.model.get_iter(selected[0])
+
+ self.marked = {'mark': it, 'pane': pane}
+
+ self._update_item_state(it)
+ if old_it:
+ self._update_item_state(old_it)
def action_diff_marked(self, *args):
pane = self._get_focused_pane()
@@ -1706,7 +1712,17 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
if stats[j]:
self.model.set_path_state(
it, j, state, isdir[j], display_text=name_overrides[j])
- emblem = EMBLEM_NEW if j in newest else None
+
+ if (
+ self.marked and
+ self.marked["pane"] == j and
+ self.model.get_string_from_iter(self.marked["mark"]) ==
+ self.model.get_string_from_iter(it)
+ ):
+ emblem = EMBLEM_SELECTED
+ else:
+ emblem = EMBLEM_NEW if j in newest else None
+
link_emblem = EMBLEM_SYMLINK if j in symlinks else None
self.model.unsafe_set(it, j, {
COL_EMBLEM: emblem,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]