aboutsummaryrefslogtreecommitdiff
path: root/src/planner-snooze.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:11:39 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:11:39 -0500
commit8c7daeeb87abd0be1b96169da18baf018c4859c9 (patch)
treedbcceb67a1cda0ef293394948f358f2b06063dd4 /src/planner-snooze.cpp
parent6e4367c088eb9026f29295c650f8639e09423212 (diff)
downloadayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.tar.gz
ayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.tar.bz2
ayatana-indicator-datetime-8c7daeeb87abd0be1b96169da18baf018c4859c9.zip
add the new Alarm class as an argument to the alarm queue class
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>>&