diff options
Diffstat (limited to 'src/settings-live.cpp')
-rw-r--r-- | src/settings-live.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/settings-live.cpp b/src/settings-live.cpp index 2305c93..71bbd96 100644 --- a/src/settings-live.cpp +++ b/src/settings-live.cpp @@ -52,6 +52,9 @@ LiveSettings::LiveSettings(): update_show_year(); update_time_format_mode(); update_timezone_name(); + update_alarm_sound(); + update_alarm_volume(); + update_alarm_duration(); // now listen for clients to change the properties s.t. we can sync update GSettings @@ -115,6 +118,18 @@ 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](unsigned int value){ + g_settings_set_uint(m_settings, SETTINGS_ALARM_VOLUME_S, value); + }); + + alarm_duration.changed().connect([this](unsigned int value){ + g_settings_set_uint(m_settings, SETTINGS_ALARM_DURATION_S, value); + }); } /*** @@ -205,6 +220,23 @@ 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(g_settings_get_uint(m_settings, SETTINGS_ALARM_VOLUME_S)); +} + +void LiveSettings::update_alarm_duration() +{ + alarm_duration.set(g_settings_get_uint(m_settings, SETTINGS_ALARM_DURATION_S)); +} + /*** **** ***/ @@ -246,6 +278,12 @@ 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(); + else if (key == SETTINGS_ALARM_DURATION_S) + update_alarm_duration(); } /*** |