diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-02-26 11:34:20 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-02-26 11:34:20 -0600 |
commit | 69ed3bfcd45fc26e1fce01cba731494dc31554f2 (patch) | |
tree | ff83dfc5f5298aadfd30dbb083ab725c78697513 /src/planner-eds.cpp | |
parent | bb4bb77908d8ccd80260aee4541e45d0a075b0ad (diff) | |
download | ayatana-indicator-datetime-69ed3bfcd45fc26e1fce01cba731494dc31554f2.tar.gz ayatana-indicator-datetime-69ed3bfcd45fc26e1fce01cba731494dc31554f2.tar.bz2 ayatana-indicator-datetime-69ed3bfcd45fc26e1fce01cba731494dc31554f2.zip |
in EdsPlanner's get_appointments(), sort 'em before returning them to the caller.
Diffstat (limited to 'src/planner-eds.cpp')
-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 da406eb..4f12ec1 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) { |