[gnome-todo] task-list-view: fix wrong tasklist handling
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] task-list-view: fix wrong tasklist handling
- Date: Sun, 8 May 2016 22:36:56 +0000 (UTC)
commit 860189a4016e095a77193c2de80616b595f77fb2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun May 8 19:33:43 2016 -0300
task-list-view: fix wrong tasklist handling
src/gtd-task-list-view.c | 42 +++++++++++++++++++++++++-----------------
1 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index 3722b71..e6653fe 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -118,6 +118,27 @@ enum {
};
static void
+real_save_task (GtdTaskListView *self,
+ GtdTask *task)
+{
+ GtdTaskListViewPrivate *priv;
+ GtdTaskList *list;
+
+ priv = self->priv;
+ list = gtd_task_get_list (task);
+
+ /*
+ * This will emit GtdTaskList::task-added and we'll readd
+ * to the list.
+ */
+ gtd_task_list_save_task (list, task);
+
+ if (priv->task_list != list)
+ gtd_task_list_save_task (priv->task_list, task);
+}
+
+
+static void
remove_task_action (GtdNotification *notification,
gpointer user_data)
{
@@ -132,22 +153,9 @@ static void
undo_remove_task_action (GtdNotification *notification,
gpointer user_data)
{
- GtdTaskListViewPrivate *priv;
- RemoveTaskData *data;
- GtdTaskList *list;
-
- data = user_data;
- priv = data->view->priv;
- list = gtd_task_get_list (data->task);
-
- /*
- * This will emit GtdTaskList::task-added and we'll readd
- * to the list.
- */
- gtd_task_list_save_task (list, data->task);
+ RemoveTaskData *data = user_data;
- if (priv->task_list != list)
- gtd_task_list_save_task (priv->task_list, data->task);
+ real_save_task (data->view, data->task);
g_free (data);
}
@@ -381,7 +389,7 @@ gtd_task_list_view__edit_task_finished (GtdEditPane *pane,
gtd_task_save (task);
gtd_manager_update_task (gtd_manager_get_default (), task);
- gtd_task_list_save_task (priv->task_list, task);
+ real_save_task (GTD_TASK_LIST_VIEW (user_data), task);
gtk_list_box_invalidate_sort (priv->listbox);
}
@@ -622,7 +630,7 @@ gtd_task_list_view__task_completed (GObject *object,
task_complete = gtd_task_get_complete (task);
gtd_manager_update_task (gtd_manager_get_default (), task);
- gtd_task_list_save_task (gtd_task_get_list (task), task);
+ real_save_task (GTD_TASK_LIST_VIEW (user_data), task);
if (task_complete)
priv->complete_tasks++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]