diff options
author | Milan Crha <mcrha@redhat.com> | 2010-09-29 17:39:26 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-09-29 17:39:26 +0800 |
commit | 6ec1118c92dcdf1f8377efde3ea575b5bc94412a (patch) | |
tree | 8cf3c669abb95acd6cf4aab979c0a1181760bd54 /modules/calendar | |
parent | c7b134377499a7bdc4a109cd1ec374ab5ac57a7b (diff) | |
download | gsoc2013-evolution-6ec1118c92dcdf1f8377efde3ea575b5bc94412a.tar.gz gsoc2013-evolution-6ec1118c92dcdf1f8377efde3ea575b5bc94412a.tar.zst gsoc2013-evolution-6ec1118c92dcdf1f8377efde3ea575b5bc94412a.zip |
Bug #629462 - Tasks 'Due' filters don't work properly
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-cal-shell-view.c | 13 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view.c | 19 |
2 files changed, 19 insertions, 13 deletions
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index 19c804204c..f9985f5f6a 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -66,6 +66,7 @@ cal_shell_view_execute_search (EShellView *shell_view) GtkRadioAction *action; time_t start_range; time_t end_range; + time_t now_time; gboolean range_search; gchar *start, *end; gchar *query; @@ -81,6 +82,9 @@ cal_shell_view_execute_search (EShellView *shell_view) searchbar = e_cal_shell_content_get_searchbar (cal_shell_content); + calendar = e_cal_shell_content_get_calendar (cal_shell_content); + now_time = time_day_begin (icaltime_as_timet (icaltime_current_time_with_zone (e_cal_model_get_timezone (gnome_calendar_get_model (calendar))))); + action = GTK_RADIO_ACTION (ACTION (CALENDAR_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); @@ -145,8 +149,8 @@ cal_shell_view_execute_search (EShellView *shell_view) case CALENDAR_FILTER_ACTIVE_APPOINTMENTS: /* Show a year's worth of appointments. */ - start_range = time (NULL); - end_range = time_add_day (start_range, 365); + start_range = now_time; + end_range = time_day_end (time_add_day (start_range, 365)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); @@ -161,8 +165,8 @@ cal_shell_view_execute_search (EShellView *shell_view) break; case CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS: - start_range = time (NULL); - end_range = time_add_day (start_range, 7); + start_range = now_time; + end_range = time_day_end (time_add_day (start_range, 7)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); @@ -207,7 +211,6 @@ cal_shell_view_execute_search (EShellView *shell_view) } /* Submit the query. */ - calendar = e_cal_shell_content_get_calendar (cal_shell_content); gnome_calendar_set_search_query ( calendar, query, range_search, start_range, end_range); g_free (query); diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c index b2146f5e59..3bf0eb67f1 100644 --- a/modules/calendar/e-task-shell-view.c +++ b/modules/calendar/e-task-shell-view.c @@ -106,6 +106,7 @@ task_shell_view_execute_search (EShellView *shell_view) ECalModel *model; time_t start_range; time_t end_range; + time_t now_time; gchar *start, *end; gchar *query; gchar *temp; @@ -117,6 +118,11 @@ task_shell_view_execute_search (EShellView *shell_view) task_shell_content = E_TASK_SHELL_CONTENT (shell_content); searchbar = e_task_shell_content_get_searchbar (task_shell_content); + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + task_table = e_task_shell_content_get_task_table (task_shell_content); + model = e_task_table_get_model (task_table); + now_time = time_day_begin (icaltime_as_timet (icaltime_current_time_with_zone (e_cal_model_get_timezone (model)))); + action = GTK_RADIO_ACTION (ACTION (TASK_SEARCH_ANY_FIELD_CONTAINS)); value = gtk_radio_action_get_current_value (action); @@ -177,8 +183,8 @@ task_shell_view_execute_search (EShellView *shell_view) break; case TASK_FILTER_NEXT_7_DAYS_TASKS: - start_range = time (NULL); - end_range = time_add_day (start_range, 7); + start_range = now_time; + end_range = time_day_end (time_add_day (start_range, 7)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); @@ -191,8 +197,8 @@ task_shell_view_execute_search (EShellView *shell_view) break; case TASK_FILTER_ACTIVE_TASKS: - start_range = time (NULL); - end_range = time_add_day (start_range, 365); + start_range = now_time; + end_range = time_day_end (time_add_day (start_range, 365)); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); @@ -207,7 +213,7 @@ task_shell_view_execute_search (EShellView *shell_view) case TASK_FILTER_OVERDUE_TASKS: start_range = 0; - end_range = time (NULL); + end_range = time_day_end (now_time); start = isodate_from_time_t (start_range); end = isodate_from_time_t (end_range); @@ -264,9 +270,6 @@ task_shell_view_execute_search (EShellView *shell_view) } /* Submit the query. */ - task_shell_content = E_TASK_SHELL_CONTENT (shell_content); - task_table = e_task_shell_content_get_task_table (task_shell_content); - model = e_task_table_get_model (task_table); e_cal_model_set_search_query (model, query); g_free (query); |