aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-06-23 18:52:52 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-06-23 18:52:52 -0500
commita85fd44e7b2dc67b3e0712e174e88d0eb6c467e7 (patch)
tree222a1f286be139627a89d31a9db414b2d174f423 /src
parentf6778e1cc3e3881225e967c94de4685c732755db (diff)
downloadayatana-indicator-datetime-a85fd44e7b2dc67b3e0712e174e88d0eb6c467e7.tar.gz
ayatana-indicator-datetime-a85fd44e7b2dc67b3e0712e174e88d0eb6c467e7.tar.bz2
ayatana-indicator-datetime-a85fd44e7b2dc67b3e0712e174e88d0eb6c467e7.zip
add GSettings support for specifying a default alarm sound and default alarm volume.
Diffstat (limited to 'src')
-rw-r--r--src/settings-live.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/settings-live.cpp b/src/settings-live.cpp
index 2305c93..ec78feb 100644
--- a/src/settings-live.cpp
+++ b/src/settings-live.cpp
@@ -52,6 +52,8 @@ LiveSettings::LiveSettings():
update_show_year();
update_time_format_mode();
update_timezone_name();
+ update_alarm_sound();
+ update_alarm_volume();
// now listen for clients to change the properties s.t. we can sync update GSettings
@@ -115,6 +117,14 @@ LiveSettings::LiveSettings():
timezone_name.changed().connect([this](const std::string& value){
g_settings_set_string(m_settings, SETTINGS_TIMEZONE_NAME_S, value.c_str());
});
+
+ alarm_sound.changed().connect([this](const std::string& value){
+ g_settings_set_string(m_settings, SETTINGS_ALARM_SOUND_S, value.c_str());
+ });
+
+ alarm_volume.changed().connect([this](AlarmVolume value){
+ g_settings_set_enum(m_settings, SETTINGS_ALARM_VOLUME_S, gint(value));
+ });
}
/***
@@ -205,6 +215,18 @@ void LiveSettings::update_timezone_name()
g_free(val);
}
+void LiveSettings::update_alarm_sound()
+{
+ auto val = g_settings_get_string(m_settings, SETTINGS_ALARM_SOUND_S);
+ alarm_sound.set(val);
+ g_free(val);
+}
+
+void LiveSettings::update_alarm_volume()
+{
+ alarm_volume.set((AlarmVolume)g_settings_get_enum(m_settings, SETTINGS_ALARM_VOLUME_S));
+}
+
/***
****
***/
@@ -246,6 +268,10 @@ void LiveSettings::update_key(const std::string& key)
update_show_detected_locations();
else if (key == SETTINGS_TIMEZONE_NAME_S)
update_timezone_name();
+ else if (key == SETTINGS_ALARM_SOUND_S)
+ update_alarm_sound();
+ else if (key == SETTINGS_ALARM_VOLUME_S)
+ update_alarm_volume();
}
/***