[gnote] Refactor SearchNotesWidget reusing desktop interface schema



commit 0fc063dee45c4ea2453980936b51376aa9650390
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Dec 12 21:11:32 2020 +0200

    Refactor SearchNotesWidget reusing desktop interface schema

 src/searchnoteswidget.cpp | 13 ++++++++-----
 src/searchnoteswidget.hpp |  1 +
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 760b78a6..6942f4b4 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -109,8 +109,9 @@ SearchNotesWidget::SearchNotesWidget(IGnote & g, NoteManagerBase & m)
   Glib::RefPtr<Gio::Settings> settings = g.preferences().get_schema_settings(Preferences::SCHEMA_GNOTE);
   settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed));
   parse_sorting_setting(settings->get_string(Preferences::SEARCH_SORTING));
-  settings = g.preferences().get_schema_settings(Preferences::SCHEMA_DESKTOP_GNOME_INTERFACE);
-  settings->signal_changed().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_settings_changed));
+  g.preferences().schema_gnome_interface()->signal_changed(Preferences::DESKTOP_GNOME_CLOCK_FORMAT)
+    .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_gnome_clock_format_changed));
+  g.preferences().schema_gnome_interface()->get_string(Preferences::DESKTOP_GNOME_CLOCK_FORMAT); // query so 
the signal is emmitted
 }
 
 SearchNotesWidget::~SearchNotesWidget()
@@ -1440,9 +1441,11 @@ void SearchNotesWidget::on_settings_changed(const Glib::ustring & key)
       m_note_list_context_menu = NULL;
     }
   }
-  else if(key == Preferences::DESKTOP_GNOME_CLOCK_FORMAT) {
-    update_results();
-  }
+}
+
+void SearchNotesWidget::on_gnome_clock_format_changed(const Glib::ustring & /*key*/)
+{
+  update_results();
 }
 
 void SearchNotesWidget::on_sorting_changed()
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index d58e1ebd..6e09b86e 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -124,6 +124,7 @@ private:
   void on_new_notebook();
   void on_delete_notebook();
   void on_settings_changed(const Glib::ustring & key);
+  void on_gnome_clock_format_changed(const Glib::ustring & key);
   void on_sorting_changed();
   void parse_sorting_setting(const Glib::ustring & sorting);
   void on_rename_notebook();


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