[gnote] Add change signal for spellchecking



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

    Add change signal for spellchecking

 src/preferences.cpp | 13 ++++++++-----
 src/preferences.hpp |  8 +++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 9bc76ab2..f7fe6566 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -84,6 +84,13 @@ namespace gnote {
     m_schema_sync = Gio::Settings::create(SCHEMA_SYNC);
     m_schema_sync_wdfs = Gio::Settings::create(SCHEMA_SYNC_WDFS);
 
+    m_schema_gnote->signal_changed(ENABLE_SPELLCHECKING).connect([this](const Glib::ustring &) {
+      m_enable_spellchecking = m_schema_gnote->get_boolean(ENABLE_SPELLCHECKING);
+      signal_enable_spellchecking_changed();
+    });
+
+    m_enable_spellchecking = m_schema_gnote->get_boolean(ENABLE_SPELLCHECKING);
+
     m_schema_gnome_interface->signal_changed(DESKTOP_GNOME_CLOCK_FORMAT).connect([this](const Glib::ustring 
&) {
       m_desktop_gnome_clock_format = m_schema_gnome_interface->get_string(DESKTOP_GNOME_CLOCK_FORMAT);
       signal_desktop_gnome_clock_format_changed();
@@ -125,13 +132,9 @@ namespace gnote {
     return settings;
   }
 
-  bool Preferences::enable_spellchecking() const
-  {
-    return m_schema_gnote->get_boolean(ENABLE_SPELLCHECKING);
-  }
-
   void Preferences::enable_spellchecking(bool value)
   {
+    m_enable_spellchecking = value;
     m_schema_gnote->set_boolean(ENABLE_SPELLCHECKING, value);
   }
 
diff --git a/src/preferences.hpp b/src/preferences.hpp
index c2a3f058..4dbb78da 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -65,8 +65,12 @@ namespace gnote {
 
     Glib::RefPtr<Gio::Settings> get_schema_settings(const Glib::ustring & schema);
 
-    bool enable_spellchecking() const;
+    bool enable_spellchecking() const
+      {
+        return m_enable_spellchecking;
+      }
     void enable_spellchecking(bool);
+    sigc::signal<void> signal_enable_spellchecking_changed;
     bool enable_auto_links() const;
     void enable_auto_links(bool);
     bool enable_url_links() const;
@@ -131,6 +135,8 @@ namespace gnote {
     Glib::ustring m_sync_selected_service_addin;
 
     int m_sync_autosync_timeout;
+
+    bool m_enable_spellchecking;
   };
 
 


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