[gnome-todo/wip/gbsneto/subtasks: 11/27] task-list: emit ::list-changed whenever a task changes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/subtasks: 11/27] task-list: emit ::list-changed whenever a task changes
- Date: Fri, 14 Oct 2016 14:42:04 +0000 (UTC)
commit 34a8080eb6715768ce60c15ed61ea2202705dc5f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Oct 10 21:18:46 2016 -0300
task-list: emit ::list-changed whenever a task changes
src/gtd-task-list.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gtd-task-list.c b/src/gtd-task-list.c
index f054220..ab53abc 100644
--- a/src/gtd-task-list.c
+++ b/src/gtd-task-list.c
@@ -161,6 +161,14 @@ process_pending_subtasks (GtdTaskList *self,
}
static void
+task_changed_cb (GtdTask *task,
+ GParamSpec *pspec,
+ GtdTaskList *self)
+{
+ g_signal_emit (self, signals[TASK_UPDATED], 0, task);
+}
+
+static void
gtd_task_list_finalize (GObject *object)
{
GtdTaskList *self = (GtdTaskList*) object;
@@ -596,6 +604,11 @@ gtd_task_list_save_task (GtdTaskList *list,
process_pending_subtasks (list, task);
setup_parent_task (list, task);
+ g_signal_connect (task,
+ "notify",
+ G_CALLBACK (task_changed_cb),
+ list);
+
g_signal_emit (list, signals[TASK_ADDED], 0, task);
e_cal_component_free_id (id);
@@ -623,6 +636,10 @@ gtd_task_list_remove_task (GtdTaskList *list,
if (!gtd_task_list_contains (list, task))
return;
+ g_signal_handlers_disconnect_by_func (task,
+ task_changed_cb,
+ list);
+
priv->tasks = g_list_remove (priv->tasks, task);
g_hash_table_remove (priv->uid_to_task, gtd_object_get_uid (GTD_OBJECT (task)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]