[gnote] Add methods for boolean settings
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add methods for boolean settings
- Date: Mon, 14 Dec 2020 21:07:12 +0000 (UTC)
commit 2e64c602a0b02b4a02f94cb2179a0d4ef073f875
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Dec 14 23:02:46 2020 +0200
Add methods for boolean settings
src/preferences.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/preferences.hpp | 16 ++++++++++++
2 files changed, 88 insertions(+), 1 deletion(-)
---
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 3291fd93..9bc76ab2 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -78,7 +78,8 @@ namespace gnote {
void Preferences::init()
{
- m_schemas[SCHEMA_GNOTE] = Gio::Settings::create(SCHEMA_GNOTE);
+ m_schema_gnote = Gio::Settings::create(SCHEMA_GNOTE);
+ m_schemas[SCHEMA_GNOTE] = m_schema_gnote;
m_schema_gnome_interface = Gio::Settings::create(SCHEMA_DESKTOP_GNOME_INTERFACE);
m_schema_sync = Gio::Settings::create(SCHEMA_SYNC);
m_schema_sync_wdfs = Gio::Settings::create(SCHEMA_SYNC_WDFS);
@@ -124,6 +125,76 @@ namespace gnote {
return settings;
}
+ bool Preferences::enable_spellchecking() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_SPELLCHECKING);
+ }
+
+ void Preferences::enable_spellchecking(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_SPELLCHECKING, value);
+ }
+
+ bool Preferences::enable_auto_links() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_AUTO_LINKS);
+ }
+
+ void Preferences::enable_auto_links(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_AUTO_LINKS, value);
+ }
+
+ bool Preferences::enable_url_links() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_URL_LINKS);
+ }
+
+ void Preferences::enable_url_links(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_URL_LINKS, value);
+ }
+
+ bool Preferences::enable_wikiwords() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_WIKIWORDS);
+ }
+
+ void Preferences::enable_wikiwords(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_WIKIWORDS, value);
+ }
+
+ bool Preferences::open_notes_in_new_window() const
+ {
+ return m_schema_gnote->get_boolean(OPEN_NOTES_IN_NEW_WINDOW);
+ }
+
+ bool Preferences::enable_custom_font() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_CUSTOM_FONT);
+ }
+
+ void Preferences::enable_custom_font(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_CUSTOM_FONT, value);
+ }
+
+ bool Preferences::enable_auto_bulleted_lists() const
+ {
+ return m_schema_gnote->get_boolean(ENABLE_AUTO_BULLETED_LISTS);
+ }
+
+ void Preferences::enable_auto_bulleted_lists(bool value)
+ {
+ m_schema_gnote->set_boolean(ENABLE_AUTO_BULLETED_LISTS, value);
+ }
+
+ void Preferences::open_notes_in_new_window(bool value)
+ {
+ m_schema_gnote->set_boolean(OPEN_NOTES_IN_NEW_WINDOW, value);
+ }
+
Glib::ustring Preferences::sync_client_id() const
{
return m_schema_sync->get_string(SYNC_CLIENT_ID);
diff --git a/src/preferences.hpp b/src/preferences.hpp
index f5cd3a0e..c2a3f058 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -65,6 +65,21 @@ namespace gnote {
Glib::RefPtr<Gio::Settings> get_schema_settings(const Glib::ustring & schema);
+ bool enable_spellchecking() const;
+ void enable_spellchecking(bool);
+ bool enable_auto_links() const;
+ void enable_auto_links(bool);
+ bool enable_url_links() const;
+ void enable_url_links(bool);
+ bool enable_wikiwords() const;
+ void enable_wikiwords(bool);
+ bool enable_custom_font() const;
+ void enable_custom_font(bool);
+ bool enable_auto_bulleted_lists() const;
+ void enable_auto_bulleted_lists(bool);
+ bool open_notes_in_new_window() const;
+ void open_notes_in_new_window(bool);
+
const Glib::ustring & desktop_gnome_clock_format() const
{
return m_desktop_gnome_clock_format;
@@ -105,6 +120,7 @@ namespace gnote {
private:
Preferences(const Preferences &) = delete;
std::map<Glib::ustring, Glib::RefPtr<Gio::Settings> > m_schemas;
+ Glib::RefPtr<Gio::Settings> m_schema_gnote;
Glib::RefPtr<Gio::Settings> m_schema_gnome_interface;
Glib::RefPtr<Gio::Settings> m_schema_sync;
Glib::RefPtr<Gio::Settings> m_schema_sync_wdfs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]