[gnome-todo] manager: Add a task model and supporting API
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] manager: Add a task model and supporting API
- Date: Wed, 12 Sep 2018 11:55:41 +0000 (UTC)
commit 63d36677183794fef01d924607a5ee858993b116
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Sep 10 22:33:17 2018 -0300
manager: Add a task model and supporting API
Like what's done with task lists, but for tasks.
src/engine/gtd-manager.c | 25 ++++++++++++++++++++++++-
src/engine/gtd-manager.h | 2 ++
2 files changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/src/engine/gtd-manager.c b/src/engine/gtd-manager.c
index 4fa635c..bd628d3 100644
--- a/src/engine/gtd-manager.c
+++ b/src/engine/gtd-manager.c
@@ -19,6 +19,7 @@
#define G_LOG_DOMAIN "GtdManager"
#include "contrib/gtd-list-store.h"
+#include "contrib/gtd-task-model-private.h"
#include "interfaces/gtd-provider.h"
#include "interfaces/gtd-panel.h"
#include "notification/gtd-notification.h"
@@ -56,6 +57,7 @@ struct _GtdManager
GtdPluginManager *plugin_manager;
GListModel *lists_model;
+ GListModel *tasks_model;
GList *tasklists;
GList *providers;
@@ -619,6 +621,7 @@ gtd_manager_init (GtdManager *self)
self->timer = gtd_timer_new ();
self->cancellable = g_cancellable_new ();
self->lists_model = (GListModel*) gtd_list_store_new (GTD_TYPE_TASK_LIST);
+ self->tasks_model = (GListModel*) _gtd_task_model_new (self);
}
/**
@@ -921,7 +924,7 @@ gtd_manager_get_timer (GtdManager *self)
*
* The model is sorted.
*
- * Returns: (transfer none): a #GtdTimer
+ * Returns: (transfer none): a #GListModel
*/
GListModel*
gtd_manager_get_task_lists_model (GtdManager *self)
@@ -931,6 +934,26 @@ gtd_manager_get_task_lists_model (GtdManager *self)
return self->lists_model;
}
+/**
+ * gtd_manager_get_tasks_model:
+ * @self: a #GtdManager
+ *
+ * Retrieves the #GListModel containing #GtdTasks from
+ * @self. You can use the this model to bind to GtkListBox
+ * or other widgets.
+ *
+ * The model is sorted.
+ *
+ * Returns: (transfer none): a #GListModel
+ */
+GListModel*
+gtd_manager_get_tasks_model (GtdManager *self)
+{
+ g_return_val_if_fail (GTD_IS_MANAGER (self), NULL);
+
+ return self->tasks_model;
+}
+
void
gtd_manager_load_plugins (GtdManager *self)
{
diff --git a/src/engine/gtd-manager.h b/src/engine/gtd-manager.h
index 7643e29..07fd001 100644
--- a/src/engine/gtd-manager.h
+++ b/src/engine/gtd-manager.h
@@ -76,4 +76,6 @@ GtdTimer* gtd_manager_get_timer (GtdManager
GListModel* gtd_manager_get_task_lists_model (GtdManager *self);
+GListModel* gtd_manager_get_tasks_model (GtdManager *self);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]