diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-02-27 10:59:17 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-02-27 10:59:17 +0000 |
commit | c8074804364bce7f5dd614c66130aa451b9aaf8b (patch) | |
tree | 5a1b62927b190a6a0fffa14feadfd1a00aee1cc2 | |
parent | e60d563f9f0b36b91533bda083ea30b0f8420ff1 (diff) | |
parent | 69ed3bfcd45fc26e1fce01cba731494dc31554f2 (diff) | |
download | ayatana-indicator-datetime-c8074804364bce7f5dd614c66130aa451b9aaf8b.tar.gz ayatana-indicator-datetime-c8074804364bce7f5dd614c66130aa451b9aaf8b.tar.bz2 ayatana-indicator-datetime-c8074804364bce7f5dd614c66130aa451b9aaf8b.zip |
In EdsPlanner's get_appointments(), sort 'em before returning them to the caller.
Fixes: 1285249
-rw-r--r-- | src/planner-eds.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/planner-eds.cpp b/src/planner-eds.cpp index 241e97f..a9eecf2 100644 --- a/src/planner-eds.cpp +++ b/src/planner-eds.cpp @@ -26,6 +26,7 @@ #include <libecal/libecal.h> #include <libedataserver/libedataserver.h> +#include <algorithm> // std::sort() #include <map> #include <set> @@ -407,11 +408,17 @@ private: *** walk through the sources to build the appointment list **/ - std::shared_ptr<Task> main_task(new Task(this, func), [](Task* task){ + auto task_deleter = [](Task* task){ + // give the caller the (sorted) finished product + auto& a = task->appointments; + std::sort(a.begin(), a.end(), [](const Appointment& a, const Appointment& b){return a.begin < b.begin;}); + task->func(a); + // we're done; delete the task g_debug("time to delete task %p", (void*)task); - task->func(task->appointments); delete task; - }); + }; + + std::shared_ptr<Task> main_task(new Task(this, func), task_deleter); for (auto& kv : m_clients) { |