[gnote/gnome-3-20] Make escape close search when search entry has focus
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-3-20] Make escape close search when search entry has focus
- Date: Sun, 18 Sep 2016 14:34:36 +0000 (UTC)
commit b8a55010b6ee7214d31d1aa63b26af4e0df896a4
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Aug 13 20:14:08 2016 +0300
Make escape close search when search entry has focus
src/recentchanges.cpp | 13 +++++++++++++
src/recentchanges.hpp | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 484baaa..8af97e9 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -220,6 +220,8 @@ namespace gnote {
{
m_search_entry.set_activates_default(false);
m_search_entry.set_size_request(300);
+ m_search_entry.signal_key_press_event()
+ .connect(sigc::mem_fun(*this, &NoteRecentChanges::on_entry_key_pressed), false);
m_search_entry.signal_changed()
.connect(sigc::mem_fun(*this, &NoteRecentChanges::on_entry_changed));
m_search_entry.signal_activate()
@@ -626,6 +628,17 @@ namespace gnote {
return res;
}
+ bool NoteRecentChanges::on_entry_key_pressed(GdkEventKey *event)
+ {
+ switch(event->keyval) {
+ case GDK_KEY_Escape:
+ m_search_entry.set_text("");
+ m_search_button.set_active(false);
+ }
+
+ return false;
+ }
+
void NoteRecentChanges::on_entry_changed()
{
if(!m_search_box.get_visible()) {
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 90f6906..4de439b 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -77,6 +77,7 @@ private:
EmbeddableWidget *currently_embedded();
void make_header_bar();
void make_search_box();
+ bool on_entry_key_pressed(GdkEventKey *);
void on_entry_changed();
void on_entry_activated();
void entry_changed_timeout();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]