aboutsummaryrefslogtreecommitdiff
path: root/src/settings-live.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings-live.cpp')
-rw-r--r--src/settings-live.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/settings-live.cpp b/src/settings-live.cpp
index 01de7b8..66590e0 100644
--- a/src/settings-live.cpp
+++ b/src/settings-live.cpp
@@ -34,14 +34,19 @@ namespace datetime {
LiveSettings::~LiveSettings()
{
+ g_clear_object(&m_settings_general_notification);
g_clear_object(&m_settings_cal_notification);
g_clear_object(&m_settings);
}
-LiveSettings::LiveSettings(): m_settings(g_settings_new(SETTINGS_INTERFACE)), m_settings_cal_notification(g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH))
+LiveSettings::LiveSettings():
+ m_settings(g_settings_new(SETTINGS_INTERFACE)),
+ m_settings_cal_notification(g_settings_new_with_path(SETTINGS_NOTIFY_SCHEMA_ID, SETTINGS_NOTIFY_CALENDAR_PATH)),
+ m_settings_general_notification(g_settings_new(SETTINGS_NOTIFY_APPS_SCHEMA_ID))
{
- g_signal_connect (m_settings, "changed", G_CALLBACK(on_changed_ccid), this);
- g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this);
+ g_signal_connect (m_settings, "changed", G_CALLBACK(on_changed_ccid), this);
+ g_signal_connect (m_settings_cal_notification, "changed", G_CALLBACK(on_changed_cal_notification), this);
+ g_signal_connect (m_settings_general_notification, "changed", G_CALLBACK(on_changed_general_notification), this);
// init the Properties from the GSettings backend
update_custom_time_format();
@@ -68,6 +73,7 @@ LiveSettings::LiveSettings(): m_settings(g_settings_new(SETTINGS_INTERFACE)), m_
update_cal_notification_vibrations();
update_cal_notification_bubbles();
update_cal_notification_list();
+ update_vibrate_silent_mode();
// now listen for clients to change the properties s.t. we can sync update GSettings
@@ -171,6 +177,10 @@ LiveSettings::LiveSettings(): m_settings(g_settings_new(SETTINGS_INTERFACE)), m_
cal_notification_list.changed().connect([this](bool value){
g_settings_set_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY, value);
});
+
+ vibrate_silent_mode.changed().connect([this](bool value){
+ g_settings_set_boolean(m_settings_general_notification, SETTINGS_VIBRATE_SILENT_KEY, value);
+ });
}
/***
@@ -317,6 +327,11 @@ void LiveSettings::update_cal_notification_list()
cal_notification_list.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY));
}
+void LiveSettings::update_vibrate_silent_mode()
+{
+ vibrate_silent_mode.set(g_settings_get_boolean(m_settings_general_notification, SETTINGS_VIBRATE_SILENT_KEY));
+}
+
/***
****
***/
@@ -347,6 +362,23 @@ void LiveSettings::update_key_cal_notification(const std::string& key)
****
***/
+void LiveSettings::on_changed_general_notification(GSettings* /*settings*/,
+ gchar* key,
+ gpointer gself)
+{
+ static_cast<LiveSettings*>(gself)->update_key_general_notification(key);
+}
+
+void LiveSettings::update_key_general_notification(const std::string& key)
+{
+ if (key == SETTINGS_VIBRATE_SILENT_KEY)
+ update_vibrate_silent_mode();
+}
+
+/***
+****
+***/
+
void LiveSettings::on_changed_ccid(GSettings* /*settings*/,
gchar* key,
gpointer gself)