Commit bb260fe3 authored by Aurimas Černius's avatar Aurimas Černius

Make escape close search when search entry has focus

parent 2909bcd6
......@@ -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()
......@@ -628,6 +630,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()) {
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment