[meld] findbar: Hide when pressing Escape



commit 78a12d6904211248e4395037a3415f017cd00117
Author: Vladimir Panteleev <git thecybershadow net>
Date:   Mon Oct 23 02:53:45 2017 +0000

    findbar: Hide when pressing Escape
    
    Connect a handler for the GTK stop-search signal, and hide the FindBar
    when it is received.
    
    Although there exists code in FileDiff.on_key_event to handle Escape
    key presses, Escape key press events are not propagated when the
    GtkSearchEntry has focus.

 data/ui/findbar.ui |    1 +
 meld/ui/findbar.py |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/findbar.ui b/data/ui/findbar.ui
index f88d462..74b0651 100644
--- a/data/ui/findbar.ui
+++ b/data/ui/findbar.ui
@@ -137,6 +137,7 @@
             <property name="secondary_icon_activatable">False</property>
             <signal name="changed" handler="on_find_entry_changed" swapped="no"/>
             <signal name="activate" handler="on_find_next_button_clicked" swapped="no"/>
+            <signal name="stop-search" handler="on_stop_search" swapped="no"/>
           </object>
           <packing>
             <property name="left_attach">1</property>
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index 2dae183..aa67c6a 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -48,6 +48,9 @@ class FindBar(gnomeglade.Component):
         self.wrap_box.set_visible(False)
         self.widget.hide()
 
+    def on_stop_search(self, search_entry):
+        self.hide()
+
     def set_text_view(self, textview):
         self.textview = textview
         if textview is not None:


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