diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/date-time.cpp | 12 | ||||
-rw-r--r-- | src/planner-eds.cpp | 18 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/date-time.cpp b/src/date-time.cpp index e6d99cd..432d877 100644 --- a/src/date-time.cpp +++ b/src/date-time.cpp @@ -85,9 +85,15 @@ GDateTime* DateTime::get() const std::string DateTime::format(const std::string& fmt) const { - const auto str = g_date_time_format(get(), fmt.c_str()); - std::string ret = str; - g_free(str); + std::string ret; + + gchar* str = g_date_time_format(get(), fmt.c_str()); + if (str) + { + ret = str; + g_free(str); + } + return ret; } diff --git a/src/planner-eds.cpp b/src/planner-eds.cpp index da406eb..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) { @@ -516,8 +523,11 @@ private: e_cal_client_get_attachment_uris_finish(E_CAL_CLIENT(client), res, &uris, &error); if (error != nullptr) { - if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && + !g_error_matches(error, E_CLIENT_ERROR, E_CLIENT_ERROR_NOT_SUPPORTED)) + { g_warning("Error getting appointment uris: %s", error->message); + } g_error_free(error); } |