[gnome-todo] grid-item: Also check if any parent of the task is complete
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] grid-item: Also check if any parent of the task is complete
- Date: Fri, 2 Feb 2018 14:44:53 +0000 (UTC)
commit 3310aed69362950671f92fbebcacedbc9fdfb4ab
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Feb 2 03:33:58 2018 -0200
grid-item: Also check if any parent of the task is complete
Otherwise we generate thumbnails with random tasks inside.
src/views/gtd-list-selector-grid-item.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/views/gtd-list-selector-grid-item.c b/src/views/gtd-list-selector-grid-item.c
index 05f180a..a3dfd3d 100644
--- a/src/views/gtd-list-selector-grid-item.c
+++ b/src/views/gtd-list-selector-grid-item.c
@@ -67,6 +67,22 @@ enum {
LAST_PROP
};
+static gboolean
+task_or_parent_is_complete (GtdTask *task)
+{
+ GtdTask *aux = task;
+
+ while (aux)
+ {
+ if (gtd_task_get_complete (aux))
+ return TRUE;
+
+ aux = gtd_task_get_parent (aux);
+ }
+
+ return FALSE;
+}
+
static cairo_surface_t*
gtd_list_selector_grid_item__render_thumbnail (GtdListSelectorGridItem *item)
{
@@ -167,7 +183,7 @@ gtd_list_selector_grid_item__render_thumbnail (GtdListSelectorGridItem *item)
gint i, font_height;
/* Don't render completed tasks */
- if (gtd_task_get_complete (l->data))
+ if (task_or_parent_is_complete (l->data))
continue;
/* Hardcoded spacing between tasks */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]