[gnome-todo] task-list-view: fix newly-created task not being removed



commit 2cfba611c4fabf9596da0474d0dd11d861dac074
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Oct 26 22:08:10 2016 -0200

    task-list-view: fix newly-created task not being removed
    
    When the user creates the tasklist, the task is not added to the
    tasks' GList, and we eventually fail to remove it (since it's not
    in the list).
    
    Fix that by properly adding the task to the internal list of tasks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773554

 src/gtd-task-list-view.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index 2f53586..5801381 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -990,21 +990,22 @@ task_completed_cb (GtdTask         *task,
 }
 
 static void
-gtd_task_list_view__task_added (GtdTaskList *list,
-                                GtdTask     *task,
-                                gpointer     user_data)
+gtd_task_list_view__task_added (GtdTaskList     *list,
+                                GtdTask         *task,
+                                GtdTaskListView *self)
 {
-  g_return_if_fail (GTD_IS_TASK_LIST_VIEW (user_data));
-  g_return_if_fail (GTD_IS_TASK_LIST (list));
-  g_return_if_fail (GTD_IS_TASK (task));
+  GtdTaskListViewPrivate *priv = gtd_task_list_view_get_instance_private (self);
 
   /* Add the new task to the list */
-  gtd_task_list_view__add_task (GTD_TASK_LIST_VIEW (user_data), task);
+  gtd_task_list_view__add_task (self, task);
+
+  /* Also add to the list of current tasks */
+  priv->list = g_list_prepend (priv->list, task);
 
   g_signal_connect (task,
                     "notify::complete",
                     G_CALLBACK (task_completed_cb),
-                    user_data);
+                    self);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]