From d3732ff1a0d149544f89d08fa489e4f0fca8da07 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 2 Sep 2014 10:37:03 -0500 Subject: add snooze properties to our schema; export it on the bus; add tests --- src/settings-live.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/settings-live.cpp') diff --git a/src/settings-live.cpp b/src/settings-live.cpp index a8338ed..8ea06a4 100644 --- a/src/settings-live.cpp +++ b/src/settings-live.cpp @@ -56,6 +56,7 @@ LiveSettings::LiveSettings(): update_alarm_volume(); update_alarm_duration(); update_alarm_haptic(); + update_snooze_duration(); // now listen for clients to change the properties s.t. we can sync update GSettings @@ -135,6 +136,10 @@ LiveSettings::LiveSettings(): alarm_haptic.changed().connect([this](const std::string& value){ g_settings_set_string(m_settings, SETTINGS_ALARM_HAPTIC_S, value.c_str()); }); + + snooze_duration.changed().connect([this](unsigned int value){ + g_settings_set_uint(m_settings, SETTINGS_SNOOZE_DURATION_S, value); + }); } /*** @@ -249,6 +254,11 @@ void LiveSettings::update_alarm_haptic() g_free(val); } +void LiveSettings::update_snooze_duration() +{ + snooze_duration.set(g_settings_get_uint(m_settings, SETTINGS_SNOOZE_DURATION_S)); +} + /*** **** ***/ @@ -298,6 +308,8 @@ void LiveSettings::update_key(const std::string& key) update_alarm_duration(); else if (key == SETTINGS_ALARM_HAPTIC_S) update_alarm_haptic(); + else if (key == SETTINGS_SNOOZE_DURATION_S) + update_snooze_duration(); } /*** -- cgit v1.2.3