aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-model.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-29 06:13:13 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-29 06:13:13 +0800
commitd16418158d22a039e2a9a9665a5b337aed5f510a (patch)
treea266037935761cecd56a01901524dd0bfc91a560 /calendar/gui/calendar-model.c
parentdf39199fb04368c2bd25e7922edb7a83be382690 (diff)
downloadgsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.tar.gz
gsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.tar.zst
gsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.zip
get the tasks directly from the CalendarModel, so we get the filtering &
2001-10-28 Damon Chaplin <damon@ximian.com> * gui/print.c (print_todo_details): get the tasks directly from the CalendarModel, so we get the filtering & sorting for free. Fixes bug #10280. Hmm. This seems too easy. It isn't going to work is it... * gui/gnome-cal.c (gnome_calendar_get_task_pad): new function to get the TaskPad ECalendarTable, for printing. * gui/calendar-model.c: * gui/calendar-config.c (calendar_config_get_hide_completed_tasks_sexp): split this out from calendar-model.c so we could use it for printing, but ended up doing that a different way. * gui/dialogs/task-page.c (init_widgets): removed a duplicated signal connected to field_changed_cb(). svn path=/trunk/; revision=14302
Diffstat (limited to 'calendar/gui/calendar-model.c')
-rw-r--r--calendar/gui/calendar-model.c56
1 files changed, 5 insertions, 51 deletions
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 7e8cc5665b..f039a3d7e1 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1897,8 +1897,7 @@ adjust_query_sexp (CalendarModel *model, const char *sexp)
CalendarModelPrivate *priv;
CalObjType type;
char *type_sexp;
- char *completed_sexp = "";
- gboolean free_completed_sexp = FALSE;
+ char *completed_sexp;
char *new_sexp;
priv = model->priv;
@@ -1916,58 +1915,13 @@ adjust_query_sexp (CalendarModel *model, const char *sexp)
/* Create a sub-expression for filtering out completed tasks, based on
the config settings. */
- if (calendar_config_get_hide_completed_tasks ()) {
- CalUnits units;
- gint value;
-
- units = calendar_config_get_hide_completed_tasks_units ();
- value = calendar_config_get_hide_completed_tasks_value ();
-
- if (value == 0) {
- /* If the value is 0, we want to hide completed tasks
- immediately, so we filter out all completed tasks.*/
- completed_sexp = "(not is-completed?)";
- } else {
- char *location, *isodate;
- icaltimezone *zone;
- struct icaltimetype tt;
- time_t t;
-
- /* Get the current time, and subtract the appropriate
- number of days/hours/minutes. */
- location = calendar_config_get_timezone ();
- zone = icaltimezone_get_builtin_timezone (location);
- tt = icaltime_current_time_with_zone (zone);
-
- switch (units) {
- case CAL_DAYS:
- icaltime_adjust (&tt, -value, 0, 0, 0);
- break;
- case CAL_HOURS:
- icaltime_adjust (&tt, 0, -value, 0, 0);
- break;
- case CAL_MINUTES:
- icaltime_adjust (&tt, 0, 0, -value, 0);
- break;
- default:
- g_assert_not_reached ();
- }
-
- t = icaltime_as_timet_with_zone (tt, zone);
-
- /* Convert the time to an ISO date string, and build
- the query sub-expression. */
- isodate = isodate_from_time_t (t);
- completed_sexp = g_strdup_printf ("(not (completed-before? (make-time \"%s\")))", isodate);
- free_completed_sexp = TRUE;
- }
- }
+ completed_sexp = calendar_config_get_hide_completed_tasks_sexp ();
new_sexp = g_strdup_printf ("(and %s %s %s)", type_sexp,
- completed_sexp, sexp);
+ completed_sexp ? completed_sexp : "",
+ sexp);
g_free (type_sexp);
- if (free_completed_sexp)
- g_free (completed_sexp);
+ g_free (completed_sexp);
#if 0
g_print ("Calendar model sexp:\n%s\n", new_sexp);