[meld] filediff: Create property actions for use in statusbar



commit 42818d68fbfa038e652aca85b61e826ee45f8361
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jan 6 07:40:15 2019 +1000

    filediff: Create property actions for use in statusbar
    
    Exposing these properties via actions makes it easy to create a menu to
    for them in a status bar button popover.
    
    The actions are all exposed in a new "view" GAction group, and so are
    specific to the current file comparison.

 meld/filediff.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 59b9732d..649bea06 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -44,7 +44,8 @@ from meld.sourceview import (
     get_custom_encoding_candidates, LanguageManager, TextviewLineAnimationType)
 from meld.ui._gtktemplate import Template
 from meld.ui.findbar import FindBar
-from meld.ui.util import map_widgets_into_lists
+from meld.ui.util import (
+    make_multiobject_property_action, map_widgets_into_lists)
 from meld.undo import UndoSequence
 
 
@@ -236,6 +237,19 @@ class FileDiff(Gtk.VBox, MeldDoc):
         self.in_nested_textview_gutter_expose = False
         self._cached_match = CachedSequenceMatcher(self.scheduler)
 
+        # Set up property actions for statusbar toggles
+        sourceview_prop_actions = [
+            'highlight-current-line-local',
+            'show-line-numbers',
+            'wrap-mode-bool',
+        ]
+
+        prop_action_group = Gio.SimpleActionGroup()
+        for prop in sourceview_prop_actions:
+            action = make_multiobject_property_action(self.textview, prop)
+            prop_action_group.add_action(action)
+        self.insert_action_group('view', prop_action_group)
+
         for buf in self.textbuffer:
             buf.undo_sequence = self.undosequence
             buf.connect("notify::has-selection",


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