From f50cbd6b5ec4ab3616e693e83ececd617f559521 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 6 Feb 2004 02:47:44 +0000 Subject: add proto 004-02-05 JP Rosevear * gui/calendar-config.h: add proto * gui/calendar-config.c (calendar_config_get_icaltimezone): return the icaltimezone based on the location and default to utc if we can't find one (calendar_config_get_hide_completed_tasks_sexp): use above svn path=/trunk/; revision=24641 --- calendar/ChangeLog | 9 +++++++++ calendar/gui/calendar-config.c | 24 +++++++++++++++++++----- calendar/gui/calendar-config.h | 1 + 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 66e6d26b81..16f208d7b9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2004-02-05 JP Rosevear + + * gui/calendar-config.h: add proto + + * gui/calendar-config.c (calendar_config_get_icaltimezone): return + the icaltimezone based on the location and default to utc if we + can't find one + (calendar_config_get_hide_completed_tasks_sexp): use above + 2004-02-05 JP Rosevear * gui/dialogs/cal-prefs-dialog.c (set_color_picker): make failure diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 55317a4bd3..9280996d4a 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -171,12 +171,27 @@ calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, g you should assume UTC (though Evolution will show the timezone-setting dialog the next time a calendar or task folder is selected). */ gchar * -calendar_config_get_timezone (void) +calendar_config_get_timezone (void) { - /* FIXME Guard against NULL? */ return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL); } +icaltimezone * +calendar_config_get_icaltimezone (void) +{ + char *location; + icaltimezone *zone = NULL; + + location = calendar_config_get_timezone (); + if (location) + zone = icaltimezone_get_builtin_timezone (location); + + if (!zone) + zone = icaltimezone_get_utc_timezone (); + + return zone; +} + /* Sets the timezone. If set to NULL it defaults to UTC. FIXME: Should check it is being set to a valid timezone. */ @@ -988,15 +1003,14 @@ calendar_config_get_hide_completed_tasks_sexp (void) immediately, so we filter out all completed tasks.*/ sexp = g_strdup ("(not is-completed?)"); } else { - char *location, *isodate; + char *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); + zone = calendar_config_get_icaltimezone (); tt = icaltime_current_time_with_zone (zone); switch (units) { diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index ac9affce00..847cba98ef 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -80,6 +80,7 @@ guint calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc /* The current timezone, e.g. "Europe/London". */ gchar* calendar_config_get_timezone (void); +icaltimezone *calendar_config_get_icaltimezone (void); void calendar_config_set_timezone (gchar *timezone); guint calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer data); -- cgit v1.2.3