aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-05-15 19:33:50 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-05-15 19:33:50 +0000
commit398e4f208f377f75eadcf4181cf09ac289c287e7 (patch)
tree5eaa4bc49ea436af7781d3d5b725f15d0952e44b /src
parent5a3c49ea09e971b6a2b1005de10171ebf165cf58 (diff)
parent9ee3e699248b4dcaae0ac15829d5004e5e23c66e (diff)
downloadayatana-indicator-datetime-398e4f208f377f75eadcf4181cf09ac289c287e7.tar.gz
ayatana-indicator-datetime-398e4f208f377f75eadcf4181cf09ac289c287e7.tar.bz2
ayatana-indicator-datetime-398e4f208f377f75eadcf4181cf09ac289c287e7.zip
Honor the 'other vibrations' setting to enable/disable vibrations when alarm notifications are shown.
Approved by: Rodney Dawes, PS Jenkins bot
Diffstat (limited to 'src')
-rw-r--r--src/com.ubuntu.touch.AccountsService.Sound.xml5
-rw-r--r--src/snap.cpp14
2 files changed, 16 insertions, 3 deletions
diff --git a/src/com.ubuntu.touch.AccountsService.Sound.xml b/src/com.ubuntu.touch.AccountsService.Sound.xml
index 91d71dc..6e2ca5f 100644
--- a/src/com.ubuntu.touch.AccountsService.Sound.xml
+++ b/src/com.ubuntu.touch.AccountsService.Sound.xml
@@ -34,6 +34,11 @@
<annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
</property>
+ <!-- "Other vibrations" should cover all vibrations except for those relating to phone calls and messages -->
+ <property name="OtherVibrate" type="b" access="readwrite">
+ <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
+ </property>
+
<property name="DialpadSoundsEnabled" type="b" access="readwrite">
<annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
</property>
diff --git a/src/snap.cpp b/src/snap.cpp
index ae0a62a..3867e90 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -104,10 +104,12 @@ public:
}
// create the haptic feedback...
- const auto haptic_mode = m_settings->alarm_haptic.get();
std::shared_ptr<uin::Haptic> haptic;
- if (haptic_mode == "pulse")
- haptic = std::make_shared<uin::Haptic>(uin::Haptic::MODE_PULSE);
+ if (should_vibrate()) {
+ const auto haptic_mode = m_settings->alarm_haptic.get();
+ if (haptic_mode == "pulse")
+ haptic = std::make_shared<uin::Haptic>(uin::Haptic::MODE_PULSE);
+ }
// show a notification...
const auto minutes = std::chrono::minutes(m_settings->alarm_duration.get());
@@ -181,6 +183,12 @@ private:
&& (accounts_service_sound_get_silent_mode(m_accounts_service_sound_proxy));
}
+ bool should_vibrate() const
+ {
+ return (m_accounts_service_sound_proxy != nullptr)
+ && (accounts_service_sound_get_other_vibrate(m_accounts_service_sound_proxy));
+ }
+
std::string get_alarm_uri(const Alarm& alarm,
const std::shared_ptr<const Settings>& settings) const
{