[gnome-todo] task-row: Only update task if it's not loading
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] task-row: Only update task if it's not loading
- Date: Mon, 5 Mar 2018 02:51:27 +0000 (UTC)
commit af3598688be4ffb5a259098ac9ffb41109d9ca38
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Mar 4 23:50:18 2018 -0300
task-row: Only update task if it's not loading
So we can avoid updating tasks that are already being updated.
src/gtd-task-list-view.c | 9 +++++++++
src/gtd-task-row.c | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index c77a3af..b6d2aac 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -563,7 +563,11 @@ static gboolean
undo_remove_task_cb (GtdTaskListView *self,
GtdTask *task)
{
+ /* Tasks are not loading anymore */
+ gtd_object_pop_loading (GTD_OBJECT (task));
+
on_task_list_task_added_cb (NULL, task, self);
+
return TRUE;
}
@@ -610,7 +614,12 @@ static inline gboolean
remove_task_rows_from_list_view_cb (GtdTaskListView *self,
GtdTask *task)
{
+ /* Task is in loading state until it's either readded, or effectively removed */
+ gtd_object_push_loading (GTD_OBJECT (task));
+
+ /* Remove from the view, but not from the list */
on_task_list_task_removed_cb (self, task);
+
return TRUE;
}
diff --git a/src/gtd-task-row.c b/src/gtd-task-row.c
index 07fa9de..2e587bc 100644
--- a/src/gtd-task-row.c
+++ b/src/gtd-task-row.c
@@ -994,7 +994,8 @@ gtd_task_row_set_active (GtdTaskRow *self,
/* And the listbox */
gtk_revealer_set_reveal_child (GTK_REVEALER (self->edit_panel_revealer), active);
- if (!active)
+ /* Save the task if it is not being loaded */
+ if (!active && !gtd_object_get_loading (GTD_OBJECT (self->task)))
gtd_provider_update_task (gtd_task_get_provider (self->task), self->task);
g_signal_emit (self, active ? signals[ENTER] : signals[EXIT], 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]