aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notifications.cpp2
-rw-r--r--src/snap.cpp29
2 files changed, 14 insertions, 17 deletions
diff --git a/src/notifications.cpp b/src/notifications.cpp
index 41ced42..486a910 100644
--- a/src/notifications.cpp
+++ b/src/notifications.cpp
@@ -160,7 +160,7 @@ public:
// close() removes the item from m_notifications,
// so increment the iterator before it gets invalidated
- for (auto it=m_notifications.begin(), end=m_notifications.end(); it!=end; )
+ for (auto it=m_notifications.begin(), e=m_notifications.end(); it!=e; )
{
const int key = it->first;
++it;
diff --git a/src/snap.cpp b/src/snap.cpp
index 4da4b45..d99e5ef 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -109,38 +109,35 @@ void Snap::operator()(const Appointment& appointment,
auto sound = std::make_shared<uin::Sound>(uri, volume, loop);
// show a notification...
- const auto minutes = m_settings->alarm_duration.get();
+ const auto minutes = std::chrono::minutes(m_settings->alarm_duration.get());
const bool interactive = m_engine->supports_actions();
- uin::Builder notification_builder;
- notification_builder.set_body (appointment.summary);
- notification_builder.set_icon_name ("alarm-clock");
- notification_builder.add_hint (uin::Builder::HINT_SNAP);
- notification_builder.add_hint (uin::Builder::HINT_TINT);
+ 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_TINT);
const auto timestr = appointment.begin.format (_("%a, %X"));
auto title = g_strdup_printf (_("Alarm %s"), timestr.c_str());
- notification_builder.set_title (title);
+ b.set_title (title);
g_free (title);
- notification_builder.set_timeout (std::chrono::duration_cast<std::chrono::seconds>(std::chrono::minutes(minutes)));
+ b.set_timeout (std::chrono::duration_cast<std::chrono::seconds>(minutes));
if (interactive) {
- notification_builder.add_action ("show", _("Show"));
- notification_builder.add_action ("dismiss", _("Dismiss"));
+ b.add_action ("show", _("Show"));
+ b.add_action ("dismiss", _("Dismiss"));
}
// add the 'sound' and 'awake' objects to the capture so that
// they stay alive until the closed callback is called; i.e.,
// for the lifespan of the notficiation
- notification_builder.set_closed_callback([appointment,
- show,
- dismiss,
- sound,
- awake](const std::string& action){
+ b.set_closed_callback([appointment, show, dismiss, sound, awake]
+ (const std::string& action){
if (action == "show")
show(appointment);
else
dismiss(appointment);
});
- const auto key = m_engine->show (notification_builder);
+ const auto key = m_engine->show(b);
if (key)
m_notifications.insert (key);
else