[gnote] Use spellchecking utilities in watchers



commit 9817e02423eade90a92f4b36bf66aa86ae3c98fe
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Fri Dec 18 17:47:51 2020 +0200

    Use spellchecking utilities in watchers

 src/watchers.cpp | 13 ++++---------
 src/watchers.hpp |  2 +-
 2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/watchers.cpp b/src/watchers.cpp
index 35561eba..e3f93101 100644
--- a/src/watchers.cpp
+++ b/src/watchers.cpp
@@ -291,11 +291,9 @@ namespace gnote {
 
   void NoteSpellChecker::on_note_opened ()
   {
-    Glib::RefPtr<Gio::Settings> settings = ignote().preferences()
-      .get_schema_settings(Preferences::SCHEMA_GNOTE);
-    settings->signal_changed()
+    ignote().preferences().signal_enable_spellchecking_changed
       .connect(sigc::mem_fun(*this, &NoteSpellChecker::on_enable_spellcheck_changed));
-    if(settings->get_boolean(Preferences::ENABLE_SPELLCHECKING)) {
+    if(ignote().preferences().enable_spellchecking()) {
       attach ();
     }
     else {
@@ -379,12 +377,9 @@ namespace gnote {
   }
   
 
-  void NoteSpellChecker::on_enable_spellcheck_changed(const Glib::ustring & key)
+  void NoteSpellChecker::on_enable_spellcheck_changed()
   {
-    if (key != Preferences::ENABLE_SPELLCHECKING) {
-      return;
-    }
-    bool value = ignote().preferences().get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(key);
+    bool value = ignote().preferences().enable_spellchecking();
     
     if (value) {
       attach ();
diff --git a/src/watchers.hpp b/src/watchers.hpp
index b74fc3f7..e16819d4 100644
--- a/src/watchers.hpp
+++ b/src/watchers.hpp
@@ -112,7 +112,7 @@ namespace gnote {
     void attach_checker();
     void detach();
     void detach_checker();
-    void on_enable_spellcheck_changed(const Glib::ustring & key);
+    void on_enable_spellcheck_changed();
     void tag_applied(const Glib::RefPtr<const Gtk::TextTag> &,
                      const Gtk::TextIter &, const Gtk::TextIter &);
     void on_language_changed(const gchar *lang);


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