diff options
author | Arthur Mello <arthur.mello@canonical.com> | 2016-07-04 16:30:18 -0300 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-07-08 02:23:04 +0200 |
commit | d61975b6145c245bf8df5322942395b101ca57c9 (patch) | |
tree | 559cd8fb730c13535d3fb0faa2e9f3b7ed7df9e4 /src/snap.cpp | |
parent | 46b0ac44948f06f37d93886996e21c0ed9e014cd (diff) | |
download | ayatana-indicator-datetime-d61975b6145c245bf8df5322942395b101ca57c9.tar.gz ayatana-indicator-datetime-d61975b6145c245bf8df5322942395b101ca57c9.tar.bz2 ayatana-indicator-datetime-d61975b6145c245bf8df5322942395b101ca57c9.zip |
If in silent mode should only vibrate if the settings say so
Diffstat (limited to 'src/snap.cpp')
-rw-r--r-- | src/snap.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
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<ain::Awake> awake; - if (appointment.is_ubuntu_alarm() || calendar_bubbles_enabled()) { - awake = std::make_shared<ain::Awake>(m_engine->app_name()); - } + if (appointment.is_ubuntu_alarm() || calendar_bubbles_enabled() || calendar_list_enabled()) { + awake = std::make_shared<ain::Awake>(m_engine->app_name()); + } // calendar events are muted in silent mode; alarm clocks never are std::shared_ptr<ain::Sound> sound; @@ -115,9 +115,12 @@ public: // create the haptic feedback... std::shared_ptr<ain::Haptic> 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>(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>(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; |