[gnote] Make m_serach_box a pointer



commit 195701c5cd8f4b81fd938dad449536b5bde2dd16
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Jan 2 13:00:52 2021 +0200

    Make m_serach_box a pointer

 src/recentchanges.cpp | 19 ++++++++++---------
 src/recentchanges.hpp |  2 +-
 2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index f8d456ca..199b8ab7 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -54,7 +54,7 @@ namespace gnote {
     , m_note_manager(m)
     , m_preferences(g.preferences())
     , m_search_notes_widget(g, m)
-    , m_search_box(0.5, 0.5, 0.0, 1.0)
+    , m_search_box(nullptr)
     , m_find_next_prev_box(nullptr)
     , m_mapped(false)
     , m_entry_changed_timeout(NULL)
@@ -89,7 +89,7 @@ namespace gnote {
     else {
       content->attach(*m_header_bar, 0, content_y_attach++, 1, 1);
     }
-    content->attach(m_search_box, 0, content_y_attach++, 1, 1);
+    content->attach(*m_search_box, 0, content_y_attach++, 1, 1);
     content->attach(m_embed_box, 0, content_y_attach++, 1, 1);
     m_embed_box.set_hexpand(true);
     m_embed_box.set_vexpand(true);
@@ -247,8 +247,9 @@ namespace gnote {
     grid->attach(m_search_entry, 0, 0, 1, 1);
     grid->show();
 
-    m_search_box.add(*grid);
-    m_search_box.set_hexpand(true);
+    m_search_box = manage(new Gtk::Alignment(0.5, 0.5, 0.0, 1.0));
+    m_search_box->add(*grid);
+    m_search_box->set_hexpand(true);
   }
 
   void NoteRecentChanges::make_find_next_prev()
@@ -299,7 +300,7 @@ namespace gnote {
       show_search_bar();
     }
     else {
-      m_search_box.hide();
+      m_search_box->hide();
       SearchableItem *searchable_widget = dynamic_cast<SearchableItem*>(currently_embedded());
       if(searchable_widget) {
         searchable_widget->perform_search("");
@@ -325,10 +326,10 @@ namespace gnote {
 
   void NoteRecentChanges::show_search_bar(bool focus)
   {
-    if(m_search_box.get_visible()) {
+    if(m_search_box->get_visible()) {
       return;
     }
-    m_search_box.show();
+    m_search_box->show();
     if(focus) {
       m_search_entry.grab_focus();
     }
@@ -705,7 +706,7 @@ namespace gnote {
 
   void NoteRecentChanges::on_entry_changed()
   {
-    if(!m_search_box.get_visible()) {
+    if(!m_search_box || !m_search_box->get_visible()) {
       return;
     }
     if(m_entry_changed_timeout == NULL) {
@@ -737,7 +738,7 @@ namespace gnote {
 
   void NoteRecentChanges::entry_changed_timeout()
   {
-    if(!m_search_box.get_visible()) {
+    if(!m_search_box || !m_search_box->get_visible()) {
       return;
     }
     Glib::ustring search_text = get_search_text();
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 93be1773..d840ee5a 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -101,7 +101,7 @@ private:
   Preferences        &m_preferences;
   Gtk::Widget        *m_header_bar;
   SearchNotesWidget   m_search_notes_widget;
-  Gtk::Alignment      m_search_box;
+  Gtk::Alignment     *m_search_box;
   Gtk::Grid          *m_find_next_prev_box;
   Gtk::ToggleButton   m_search_button;
   Gtk::Alignment      m_embedded_toolbar;


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