From cd03321181ba64c66a93c60d444dfea59f293fa1 Mon Sep 17 00:00:00 2001 From: Arthur Mello Date: Mon, 4 Jul 2016 16:30:18 -0300 Subject: If in silent mode should only vibrate if the settings say so --- src/snap.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/snap.cpp') diff --git a/src/snap.cpp b/src/snap.cpp index d0c12a0..363e0df 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -97,9 +97,9 @@ public: // force the system to stay awake std::shared_ptr awake; - if (appointment.is_ubuntu_alarm() || calendar_bubbles_enabled()) { - awake = std::make_shared(m_engine->app_name()); - } + if (appointment.is_ubuntu_alarm() || calendar_bubbles_enabled() || calendar_list_enabled()) { + awake = std::make_shared(m_engine->app_name()); + } // calendar events are muted in silent mode; alarm clocks never are std::shared_ptr sound; @@ -115,9 +115,12 @@ public: // create the haptic feedback... std::shared_ptr haptic; if (should_vibrate() && (appointment.is_ubuntu_alarm() || calendar_vibrations_enabled())) { - const auto haptic_mode = m_settings->alarm_haptic.get(); - if (haptic_mode == "pulse") - haptic = std::make_shared(ain::Haptic::MODE_PULSE, appointment.is_ubuntu_alarm()); + // when in silent mode should only vibrate if user defined so + if (!silent_mode() || vibrate_in_silent_mode_enabled()) { + const auto haptic_mode = m_settings->alarm_haptic.get(); + if (haptic_mode == "pulse") + haptic = std::make_shared(ain::Haptic::MODE_PULSE, appointment.is_ubuntu_alarm()); + } } // show a notification... @@ -218,6 +221,11 @@ private: return m_settings->cal_notification_list.get(); } + bool vibrate_in_silent_mode_enabled() const + { + return m_settings->vibrate_silent_mode.get(); + } + static void on_sound_proxy_ready(GObject* /*source_object*/, GAsyncResult* res, gpointer gself) { GError * error; -- cgit v1.2.3