[meld: 4/8] small refactoring




commit d3b9987e489f754590d437f439eecf6a3d8d3ffb
Author: DAB <dab dab la>
Date:   Thu Jan 6 19:57:36 2022 -0500

    small refactoring

 meld/dirdiff.py             | 18 ++++++++----------
 meld/resources/gtk/menus.ui |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index c3967151..325628ea 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -263,6 +263,11 @@ class DirDiffTreeStore(tree.DiffTreeStore):
         }
         super().add_error(parent, msg, pane, defaults)
 
+class ComparisonOptions:
+    def __init__(self):
+        self.ignore_case = False
+        self.normalize_encoding = False
+
 
 class CanonicalListing:
     """Multi-pane lists with canonicalised matching and error detection"""
@@ -483,12 +488,7 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
                 "text-filters-changed", self.on_text_filters_changed)
         ]
 
-        class Comparison:
-            def __init__(self):
-                self.ignore_case = False
-                self.normalize_encoding = False
-            pass
-        self.compare = Comparison()
+        self.compare = ComparisonOptions()
 
         # Handle overview map visibility binding. Because of how we use
         # grid packing, we need two revealers here instead of the more
@@ -824,10 +824,8 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
         invalid_filenames = []
 
         # TODO: Map this to a GObject prop instead?
-        if self.get_action_state('folder-ignore-case'):
-            self.compare.ignore_case = True
-        if self.get_action_state('folder-normalize-encoding'):
-            self.compare.normalize_encoding = True
+        self.compare.ignore_case = self.get_action_state('folder-ignore-case')
+        self.compare.normalize_encoding = self.get_action_state('folder-normalize-encoding')
 
         while len(todo):
             todo.sort()  # depth first
diff --git a/meld/resources/gtk/menus.ui b/meld/resources/gtk/menus.ui
index d038d8be..992f67c1 100644
--- a/meld/resources/gtk/menus.ui
+++ b/meld/resources/gtk/menus.ui
@@ -159,7 +159,7 @@
         <attribute name="action">view.folder-ignore-case</attribute>
       </item>
       <item>
-        <attribute name="label" translatable="yes">Normalize UTF-8 encodings</attribute>
+        <attribute name="label" translatable="yes">Normalize Unicode paths</attribute>
         <attribute name="action">view.folder-normalize-encoding</attribute>
       </item>
     </section>


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