[gnote] Add utilities to handle sync settings
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add utilities to handle sync settings
- Date: Sun, 13 Dec 2020 11:56:55 +0000 (UTC)
commit 4c7b952a9defc9047170836ac953ddfc110485e1
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Dec 13 13:54:44 2020 +0200
Add utilities to handle sync settings
src/preferences.cpp | 26 ++++++++++++++++++++++++++
src/preferences.hpp | 20 ++++++++++----------
2 files changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 44cea4e8..13dae260 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -97,6 +97,19 @@ namespace gnote {
m_desktop_gnome_clock_format = m_schema_gnome_interface->get_string(DESKTOP_GNOME_CLOCK_FORMAT);
m_desktop_gnome_font = m_schema_gnome_interface->get_string(DESKTOP_GNOME_FONT);
+
+
+ m_schema_sync->signal_changed(SYNC_SELECTED_SERVICE_ADDIN).connect([this](const Glib::ustring &) {
+ m_sync_selected_service_addin = m_schema_sync->get_string(SYNC_SELECTED_SERVICE_ADDIN);
+ signal_sync_selected_service_addin_changed();
+ });
+ m_schema_sync->signal_changed(SYNC_AUTOSYNC_TIMEOUT).connect([this](const Glib::ustring &) {
+ m_sync_autosync_timeout = m_schema_sync->get_int(SYNC_AUTOSYNC_TIMEOUT);
+ signal_sync_autosync_timeout_changed();
+ });
+
+ m_sync_selected_service_addin = m_schema_sync->get_string(SYNC_SELECTED_SERVICE_ADDIN);
+ m_sync_autosync_timeout = m_schema_sync->get_int(SYNC_AUTOSYNC_TIMEOUT);
}
Glib::RefPtr<Gio::Settings> Preferences::get_schema_settings(const Glib::ustring & schema)
@@ -129,6 +142,12 @@ namespace gnote {
m_schema_sync->set_string(SYNC_LOCAL_PATH, value);
}
+ void Preferences::sync_selected_service_addin(const Glib::ustring & value)
+ {
+ m_sync_selected_service_addin = value;
+ m_schema_sync->set_string(SYNC_SELECTED_SERVICE_ADDIN, value);
+ }
+
int Preferences::sync_configured_conflict_behavior() const
{
return m_schema_sync->get_int(SYNC_CONFIGURED_CONFLICT_BEHAVIOR);
@@ -139,4 +158,11 @@ namespace gnote {
m_schema_sync->set_int(SYNC_CONFIGURED_CONFLICT_BEHAVIOR, value);
}
+ void Preferences::sync_autosync_timeout(int value)
+ {
+ m_sync_autosync_timeout = value;
+ m_schema_sync->set_int(SYNC_AUTOSYNC_TIMEOUT, value);
+ }
+
}
+
diff --git a/src/preferences.hpp b/src/preferences.hpp
index d87abc8b..c98ab28d 100644
--- a/src/preferences.hpp
+++ b/src/preferences.hpp
@@ -97,22 +97,18 @@ namespace gnote {
void sync_local_path(const Glib::ustring &);
Glib::ustring sync_selected_service_addin() const
{
- return m_schema_sync->get_string(SYNC_SELECTED_SERVICE_ADDIN);
- }
- void sync_selected_service_addin(const Glib::ustring & value)
- {
- m_schema_sync->set_string(SYNC_SELECTED_SERVICE_ADDIN, value);
+ return m_sync_selected_service_addin;
}
+ void sync_selected_service_addin(const Glib::ustring & value);
+ sigc::signal<void> signal_sync_selected_service_addin_changed;
int sync_configured_conflict_behavior() const;
void sync_configured_conflict_behavior(int);
int sync_autosync_timeout() const
{
- return m_schema_sync->get_int(SYNC_AUTOSYNC_TIMEOUT);
- }
- void sync_autosync_timeout(int value)
- {
- m_schema_sync->set_int(SYNC_AUTOSYNC_TIMEOUT, value);
+ return m_sync_autosync_timeout;
}
+ void sync_autosync_timeout(int value);
+ sigc::signal<void> signal_sync_autosync_timeout_changed;
private:
Preferences(const Preferences &) = delete;
std::map<Glib::ustring, Glib::RefPtr<Gio::Settings> > m_schemas;
@@ -121,6 +117,10 @@ namespace gnote {
Glib::ustring m_desktop_gnome_clock_format;
Glib::ustring m_desktop_gnome_font;
+
+ Glib::ustring m_sync_selected_service_addin;
+
+ int m_sync_autosync_timeout;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]