From 63a57fde6677d8f663e5880a259998b95b1da6c5 Mon Sep 17 00:00:00 2001 From: kugiigi Date: Sat, 20 Mar 2021 11:52:07 +0800 Subject: Add option to show/hide alarms --- src/settings-live.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/settings-live.cpp') diff --git a/src/settings-live.cpp b/src/settings-live.cpp index cf18739..9cbc23c 100644 --- a/src/settings-live.cpp +++ b/src/settings-live.cpp @@ -47,6 +47,7 @@ LiveSettings::LiveSettings(): update_show_day(); update_show_detected_locations(); update_show_events(); + update_show_alarms(); update_show_locations(); update_show_seconds(); update_show_week_numbers(); @@ -117,6 +118,10 @@ LiveSettings::LiveSettings(): g_settings_set_boolean(m_settings, SETTINGS_SHOW_EVENTS_S, value); }); + show_alarms.changed().connect([this](bool value){ + g_settings_set_boolean(m_settings, SETTINGS_SHOW_ALARMS_S, value); + }); + show_locations.changed().connect([this](bool value){ g_settings_set_boolean(m_settings, SETTINGS_SHOW_LOCATIONS_S, value); }); @@ -239,6 +244,12 @@ void LiveSettings::update_show_events() show_events.set(val); } +void LiveSettings::update_show_alarms() +{ + const auto val = g_settings_get_boolean(m_settings, SETTINGS_SHOW_ALARMS_S); + show_alarms.set(val); +} + void LiveSettings::update_show_locations() { const auto val = g_settings_get_boolean(m_settings, SETTINGS_SHOW_LOCATIONS_S); @@ -415,6 +426,8 @@ void LiveSettings::update_key_ccid(const std::string& key) update_show_week_numbers(); else if (key == SETTINGS_SHOW_EVENTS_S) update_show_events(); + else if (key == SETTINGS_SHOW_ALARMS_S) + update_show_alarms(); else if (key == SETTINGS_SHOW_LOCATIONS_S) update_show_locations(); else if (key == SETTINGS_SHOW_DETECTED_S) -- cgit v1.2.3