[gnome-todo/wip/gbsneto/plugins] provider-local: implement task creation
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/plugins] provider-local: implement task creation
- Date: Mon, 4 Jan 2016 18:13:25 +0000 (UTC)
commit 74f0cafde2717d4e816eff7c30ff68d107ca09de
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jan 4 16:08:38 2016 -0200
provider-local: implement task creation
This was the missing bit of task creation. Shall
be done for Goa provider too.
plugins/eds/gtd-provider-local.c | 42 ++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/plugins/eds/gtd-provider-local.c b/plugins/eds/gtd-provider-local.c
index 5736f6b..4e7f812 100644
--- a/plugins/eds/gtd-provider-local.c
+++ b/plugins/eds/gtd-provider-local.c
@@ -17,6 +17,7 @@
*/
#include "gtd-provider-local.h"
+#include "gtd-task-list-eds.h"
#include <glib/gi18n.h>
@@ -113,9 +114,46 @@ static void
gtd_provider_local_create_task_list (GtdProvider *provider,
GtdTaskList *list)
{
- gtd_provider_eds_create_task_list (GTD_PROVIDER_EDS (provider), list);
+ ESourceExtension *extension;
+ GtdTaskListEds *eds_list;
+ ESource *source;
+ GError *error;
- g_signal_emit_by_name (provider, "list-added", list);
+ error = NULL;
+
+ /* Create the source */
+ source = e_source_new (NULL,
+ NULL,
+ &error);
+
+ if (error)
+ {
+ g_warning ("%s: %s: %s",
+ G_STRFUNC,
+ _("Error creating new task list"),
+ error->message);
+
+ gtd_manager_emit_error_message (gtd_manager_get_default (),
+ _("Error creating new task list"),
+ error->message);
+
+ g_clear_error (&error);
+ return;
+ }
+
+ /* EDS properties */
+ e_source_set_display_name (source, gtd_task_list_get_name (list));
+
+ /* Make it a local source */
+ extension = e_source_get_extension (source, E_SOURCE_EXTENSION_TASK_LIST);
+
+ e_source_set_parent (source, "local-stub");
+ e_source_backend_set_backend_name (E_SOURCE_BACKEND (extension), "local");
+
+ /* EDS Task list */
+ eds_list = gtd_task_list_eds_new (provider, source);
+
+ gtd_provider_eds_create_task_list (GTD_PROVIDER_EDS (provider), GTD_TASK_LIST (eds_list));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]