[PATCH] 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(+)

diff --git a/data/ui/findbar.ui b/data/ui/findbar.ui
index f88d4623..74b06517 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 2dae1831..aa67c6ad 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:
-- 
2.14.2



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