[gnote] Fix All Notes notebook selection in search



commit d3077ae0b99ecb6610f8b4fea797759e30588912
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat May 25 19:16:35 2013 +0300

    Fix All Notes notebook selection in search
    
    It selected first notebook in the list, not All Notes explicitly

 src/searchnoteswidget.cpp |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 4541a93..b58a2d6 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -457,9 +457,13 @@ void SearchNotesWidget::select_all_notes_notebook()
   if(!model) {
     return;
   }
-  Gtk::TreeIter iter = model->children().begin();
-  if(iter) {
-    m_notebooksTree->get_selection()->select(iter);
+  for(Gtk::TreeIter iter = model->children().begin(); iter; ++iter) {
+    notebooks::Notebook::Ptr notebook;
+    iter->get_value(0, notebook);
+    if(std::tr1::dynamic_pointer_cast<notebooks::AllNotesNotebook>(notebook) != NULL) {
+      m_notebooksTree->get_selection()->select(iter);
+      break;
+    }
   }
 }
 
@@ -1045,8 +1049,7 @@ void SearchNotesWidget::add_matches_column()
 
 bool SearchNotesWidget::show_all_search_results()
 {
-  Gtk::TreeIter iter = m_notebooksTree->get_model()->children().begin();
-  m_notebooksTree->get_selection()->select(iter);
+  select_all_notes_notebook();
   return false;
 }
 


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