[gnome-todo] today, scheduled: properly update when date changes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] today, scheduled: properly update when date changes
- Date: Sat, 29 Apr 2017 00:08:22 +0000 (UTC)
commit 690e2396e198e5377665d61a08edd3e8c44db1a0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Apr 28 21:05:58 2017 -0300
today, scheduled: properly update when date changes
plugins/scheduled-panel/gtd-panel-scheduled.c | 3 +++
plugins/today-panel/gtd-panel-today.c | 15 ++++++---------
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/plugins/scheduled-panel/gtd-panel-scheduled.c b/plugins/scheduled-panel/gtd-panel-scheduled.c
index e755b73..1aeb374 100644
--- a/plugins/scheduled-panel/gtd-panel-scheduled.c
+++ b/plugins/scheduled-panel/gtd-panel-scheduled.c
@@ -297,11 +297,13 @@ gtd_panel_scheduled_sort_func (GtkListBoxRow *row1,
static void
gtd_panel_scheduled_count_tasks (GtdPanelScheduled *panel)
{
+ g_autoptr (GDateTime) now;
GtdManager *manager;
GList *tasklists;
GList *l;
guint number_of_tasks;
+ now = g_date_time_new_now_local ();
manager = gtd_manager_get_default ();
tasklists = gtd_manager_get_task_lists (manager);
number_of_tasks = 0;
@@ -342,6 +344,7 @@ gtd_panel_scheduled_count_tasks (GtdPanelScheduled *panel)
/* Add the tasks to the view */
gtd_task_list_view_set_list (GTD_TASK_LIST_VIEW (panel->view), panel->task_list);
+ gtd_task_list_view_set_default_date (GTD_TASK_LIST_VIEW (panel->view), now);
if (number_of_tasks != panel->number_of_tasks)
{
diff --git a/plugins/today-panel/gtd-panel-today.c b/plugins/today-panel/gtd-panel-today.c
index 83c22ed..c3c62b4 100644
--- a/plugins/today-panel/gtd-panel-today.c
+++ b/plugins/today-panel/gtd-panel-today.c
@@ -54,36 +54,32 @@ enum {
};
static gboolean
-is_today (GDateTime *dt)
+is_today (GDateTime *today,
+ GDateTime *dt)
{
- GDateTime *today;
-
if (!dt)
return FALSE;
- today = g_date_time_new_now_local ();
-
if (g_date_time_get_year (dt) == g_date_time_get_year (today) &&
g_date_time_get_month (dt) == g_date_time_get_month (today) &&
g_date_time_get_day_of_month (dt) == g_date_time_get_day_of_month (today))
{
- g_date_time_unref (today);
return TRUE;
}
- g_date_time_unref (today);
-
return FALSE;
}
static void
gtd_panel_today_count_tasks (GtdPanelToday *panel)
{
+ g_autoptr (GDateTime) now;
GtdManager *manager;
GList *tasklists;
GList *l;
guint number_of_tasks;
+ now = g_date_time_new_now_local ();
manager = gtd_manager_get_default ();
tasklists = gtd_manager_get_task_lists (manager);
number_of_tasks = 0;
@@ -104,7 +100,7 @@ gtd_panel_today_count_tasks (GtdPanelToday *panel)
task_dt = gtd_task_get_due_date (t->data);
- if (!is_today (task_dt))
+ if (!is_today (now, task_dt))
{
g_clear_pointer (&task_dt, g_date_time_unref);
continue;
@@ -123,6 +119,7 @@ gtd_panel_today_count_tasks (GtdPanelToday *panel)
/* Add the tasks to the view */
gtd_task_list_view_set_list (GTD_TASK_LIST_VIEW (panel->view), panel->task_list);
+ gtd_task_list_view_set_default_date (GTD_TASK_LIST_VIEW (panel->view), now);
if (number_of_tasks != panel->number_of_tasks)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]