aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-12-07 20:48:13 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-12-07 20:48:13 -0600
commit9f29b40133fc419a7a74379c55d63c105a4c2c16 (patch)
tree46e409b59379697152a8efdd0d5d767e963fbea0 /src
parent95bc85d108e3564d98f26b7ad17fcc72b2966371 (diff)
downloadayatana-indicator-datetime-9f29b40133fc419a7a74379c55d63c105a4c2c16.tar.gz
ayatana-indicator-datetime-9f29b40133fc419a7a74379c55d63c105a4c2c16.tar.bz2
ayatana-indicator-datetime-9f29b40133fc419a7a74379c55d63c105a4c2c16.zip
for calendar events, use interactive notifications and a nonrepeating sound.
Diffstat (limited to 'src')
-rw-r--r--src/snap.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index 6d2957d..ee96007 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -63,13 +63,19 @@ public:
appointment_func snooze,
appointment_func ok)
{
+ /* Alarms and calendar events are treated differently.
+ Alarms should require manual intervention to dismiss.
+ Calendar events are less urgent and shouldn't require manual
+ intervention and shouldn't loop the sound. */
+ const bool interactive = appointment.is_ubuntu_alarm() && m_engine->supports_actions();
+
// force the system to stay awake
auto awake = std::make_shared<uin::Awake>(m_engine->app_name());
// create the sound...
const auto uri = get_alarm_uri(appointment, m_settings);
const auto volume = m_settings->alarm_volume.get();
- const bool loop = m_engine->supports_actions();
+ const bool loop = interactive;
auto sound = std::make_shared<uin::Sound>(uri, volume, loop);
// create the haptic feedback...
@@ -80,12 +86,9 @@ public:
// show a notification...
const auto minutes = std::chrono::minutes(m_settings->alarm_duration.get());
- const bool interactive = m_engine->supports_actions();
uin::Builder b;
b.set_body (appointment.summary);
b.set_icon_name ("alarm-clock");
- b.add_hint (uin::Builder::HINT_SNAP);
- b.add_hint (uin::Builder::HINT_AFFIRMATIVE_HINT);
b.add_hint (uin::Builder::HINT_NONSHAPED_ICON);
const char * timefmt;
@@ -104,6 +107,8 @@ public:
g_free (title);
b.set_timeout (std::chrono::duration_cast<std::chrono::seconds>(minutes));
if (interactive) {
+ b.add_hint (uin::Builder::HINT_SNAP);
+ b.add_hint (uin::Builder::HINT_AFFIRMATIVE_HINT);
b.add_action ("ok", _("OK"));
b.add_action ("snooze", _("Snooze"));
}