diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-config.c | 24 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 1 |
2 files changed, 20 insertions, 5 deletions
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); |