aboutsummaryrefslogtreecommitdiff
path: root/src/planner-snooze.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-09 13:08:24 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-09 13:08:24 -0500
commit8d282df37c72ff27a006ff928f1b151d98aa0e45 (patch)
tree89d5ecc46c7e674e753e907f48d8e8acd4935d1a /src/planner-snooze.cpp
parentd5002c6b27cf0e00828555a10e89778008d6cd01 (diff)
parent49f49d4c18c2cc77a1a305c93a74e9e8ec903526 (diff)
downloadayatana-indicator-datetime-8d282df37c72ff27a006ff928f1b151d98aa0e45.tar.gz
ayatana-indicator-datetime-8d282df37c72ff27a006ff928f1b151d98aa0e45.tar.bz2
ayatana-indicator-datetime-8d282df37c72ff27a006ff928f1b151d98aa0e45.zip
sync with trunk
Diffstat (limited to 'src/planner-snooze.cpp')
-rw-r--r--src/planner-snooze.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/planner-snooze.cpp b/src/planner-snooze.cpp
index 29d5f06..e4062d2 100644
--- a/src/planner-snooze.cpp
+++ b/src/planner-snooze.cpp
@@ -51,14 +51,18 @@ public:
return m_appointments;
}
- void add(const Appointment& appt_in)
+ void add(const Appointment& appt_in, const Alarm& alarm)
{
+ // make a copy of the appointment with only this alarm
Appointment appt = appt_in;
+ appt.alarms.clear();
+ appt.alarms.push_back(alarm);
// reschedule the alarm to go off N minutes from now
- const auto alarm_duration_secs = appt.end - appt.begin;
- appt.begin = m_clock->localtime().add_full(0,0,0,0,m_settings->snooze_duration.get(),0);
- appt.end = appt.begin.add_full(0,0,0,0,0,alarm_duration_secs);
+ const auto offset = std::chrono::minutes(m_settings->snooze_duration.get());
+ appt.begin += offset;
+ appt.end += offset;
+ appt.alarms[0].time += offset;
// give it a new ID
gchar* uid = e_uid_new();
@@ -95,9 +99,9 @@ SnoozePlanner::~SnoozePlanner()
}
void
-SnoozePlanner::add(const Appointment& appointment)
+SnoozePlanner::add(const Appointment& appointment, const Alarm& alarm)
{
- impl->add(appointment);
+ impl->add(appointment, alarm);
}
core::Property<std::vector<Appointment>>&