[meld/ui-next] ui.findbar: Move shift-return hidden shortcut to a real key binding



commit 879858effef51415e380e35a5588361ad37002ce
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Mar 11 07:25:03 2019 +1000

    ui.findbar: Move shift-return hidden shortcut to a real key binding

 data/meld.css      |  8 +++++++-
 meld/filediff.py   |  2 --
 meld/ui/findbar.py | 12 +++++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/data/meld.css b/data/meld.css
index f15504ab..d5913abf 100644
--- a/data/meld.css
+++ b/data/meld.css
@@ -29,7 +29,13 @@ action-gutter {
     background-color: @theme_bg_color;
 }
 
-find-bar {
+@binding-set MeldFindbarBindings {
+    bind "<Shift>Return" { "activate-secondary" () };
+}
+
+meld-find-bar {
+    -gtk-key-bindings: MeldFindbarBindings;
+
     padding: 6px;
     border-width: 1px 0 0 0;
     border-style: solid;
diff --git a/meld/filediff.py b/meld/filediff.py
index e2466719..1ddbb4c6 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -407,8 +407,6 @@ class FileDiff(Gtk.VBox, MeldDoc):
             if event.keyval == Gdk.KEY_Escape:
                 self.findbar.hide()
         elif event.type == Gdk.EventType.KEY_RELEASE:
-            if event.keyval == Gdk.KEY_Return and self.keymask & MASK_SHIFT:
-                self.findbar.start_find_previous(self.focus_pane)
             self.keymask &= ~mod_key
 
     def on_text_filters_changed(self, app):
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index 489dc202..0432a439 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -39,6 +39,16 @@ class FindBar(Gtk.Grid):
 
     replace_mode = GObject.Property(type=bool, default=False)
 
+    @GObject.Signal(
+        name='activate-secondary',
+        flags=(
+            GObject.SignalFlags.RUN_FIRST |
+            GObject.SignalFlags.ACTION
+        ),
+    )
+    def activate_secondary(self) -> None:
+        self._find_text(backwards=True)
+
     def __init__(self, parent):
         super().__init__()
         self.init_template()
@@ -194,4 +204,4 @@ class FindBar(Gtk.Grid):
             self.wrap_box.set_visible(False)
 
 
-FindBar.set_css_name('find-bar')
+FindBar.set_css_name('meld-find-bar')


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