[gnote] Make enter key find next match when searching in note



commit 0e072fc09d066babf295b17df709a20f82cf681b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Mar 28 18:23:22 2016 +0300

    Make enter key find next match when searching in note
    
    Fixes Bug 700624.

 src/recentchanges.cpp |   10 +++++++++-
 src/recentchanges.hpp |    1 +
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 0a5ded8..7c035f7 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -49,6 +49,7 @@ namespace gnote {
     , m_search_box(0.5, 0.5, 0.0, 1.0)
     , m_mapped(false)
     , m_entry_changed_timeout(NULL)
+    , m_search_dirty(false)
     , m_window_menu_embedded(NULL)
     , m_window_menu_default(NULL)
     , m_keybinder(get_accel_group())
@@ -637,6 +638,7 @@ namespace gnote {
         .connect(sigc::mem_fun(*this, &NoteRecentChanges::entry_changed_timeout));
     }
 
+    m_search_dirty = true;
     std::string search_text = get_search_text();
     if(search_text.empty()) {
       SearchableItem *searchable_widget = dynamic_cast<SearchableItem*>(currently_embedded());
@@ -655,7 +657,12 @@ namespace gnote {
       m_entry_changed_timeout->cancel();
     }
 
-    entry_changed_timeout();
+    if(m_search_dirty) {
+      entry_changed_timeout();
+    }
+    else {
+      on_find_next_button_clicked();
+    }
   }
 
   void NoteRecentChanges::entry_changed_timeout()
@@ -671,6 +678,7 @@ namespace gnote {
     SearchableItem *searchable_widget = dynamic_cast<SearchableItem*>(currently_embedded());
     if(searchable_widget) {
       searchable_widget->perform_search(search_text);
+      m_search_dirty = false;
     }
   }
 
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 90f6906..9a618ac 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -113,6 +113,7 @@ private:
   sigc::connection    m_current_embedded_name_slot;
   sigc::connection    m_signal_popover_widgets_changed_cid;
   utils::InterruptableTimeout *m_entry_changed_timeout;
+  bool                m_search_dirty;
   Gtk::PopoverMenu     *m_window_menu_embedded;
   Gtk::PopoverMenu     *m_window_menu_default;
   utils::GlobalKeybinder m_keybinder;


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