From e3a546e4d24101d65ad1217f10ac1e7576f5f3b7 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 24 Sep 2002 16:08:59 +0000 Subject: return a builtin timezone if we don't find the timezone in our component. 2002-09-24 Rodrigo Moya * pcs/cal-backend-file.c (cal_backend_file_get_timezone_object, cal_backend_file_get_timezone): return a builtin timezone if we don't find the timezone in our component. svn path=/trunk/; revision=18202 --- calendar/ChangeLog | 6 ++++++ calendar/pcs/cal-backend-file.c | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e29f3e8086..87ac607143 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2002-09-24 Rodrigo Moya + + * pcs/cal-backend-file.c (cal_backend_file_get_timezone_object, + cal_backend_file_get_timezone): return a builtin timezone if we + don't find the timezone in our component. + 2002-09-24 JP Rosevear * conduits/calendar/calendar-conduit.c (comp_from_remote_record): diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index f4992f2952..c5b6c63df5 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -1070,8 +1070,11 @@ cal_backend_file_get_timezone_object (CalBackend *backend, const char *tzid) g_assert (priv->comp_uid_hash != NULL); zone = icalcomponent_get_timezone (priv->icalcomp, tzid); - if (!zone) - return NULL; + if (!zone) { + zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); + if (!zone) + return NULL; + } icalcomp = icaltimezone_get_component (zone); if (!icalcomp) @@ -1080,9 +1083,9 @@ cal_backend_file_get_timezone_object (CalBackend *backend, const char *tzid) ical_string = icalcomponent_as_ical_string (icalcomp); /* We dup the string; libical owns that memory. */ if (ical_string) - return g_strdup (ical_string); + return g_strdup (ical_string); else - return NULL; + return NULL; } /* Builds a list of UIDs from a list of CalComponent objects */ @@ -1920,6 +1923,7 @@ cal_backend_file_get_timezone (CalBackend *backend, const char *tzid) { CalBackendFile *cbfile; CalBackendFilePrivate *priv; + icaltimezone *zone; cbfile = CAL_BACKEND_FILE (backend); priv = cbfile->priv; @@ -1927,9 +1931,14 @@ cal_backend_file_get_timezone (CalBackend *backend, const char *tzid) g_return_val_if_fail (priv->icalcomp != NULL, NULL); if (!strcmp (tzid, "UTC")) - return icaltimezone_get_utc_timezone (); - else - return icalcomponent_get_timezone (priv->icalcomp, tzid); + zone = icaltimezone_get_utc_timezone (); + else { + zone = icalcomponent_get_timezone (priv->icalcomp, tzid); + if (!zone) + zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); + } + + return zone; } -- cgit v1.2.3