aboutsummaryrefslogtreecommitdiff
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorArthur Mello <arthur.mello@canonical.com>2016-07-04 16:30:18 -0300
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:37:39 +0200
commitcd03321181ba64c66a93c60d444dfea59f293fa1 (patch)
treea86401e19c0cf30989814021202629aeeba46417 /src/snap.cpp
parent94af77abe22cf5fe8845d3d0cd4a9bc2ca5ab38a (diff)
downloadayatana-indicator-datetime-cd03321181ba64c66a93c60d444dfea59f293fa1.tar.gz
ayatana-indicator-datetime-cd03321181ba64c66a93c60d444dfea59f293fa1.tar.bz2
ayatana-indicator-datetime-cd03321181ba64c66a93c60d444dfea59f293fa1.zip
If in silent mode should only vibrate if the settings say so
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp20
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;