[gnome-shell/wip/mcrha/calendar-server-timezones] calendar-server: Read timezone from the calendar, not its timezone cache
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/mcrha/calendar-server-timezones] calendar-server: Read timezone from the calendar, not its timezone cache
- Date: Wed, 2 Feb 2022 14:37:08 +0000 (UTC)
commit c94ca70c195d3cbfe55474f455ed6ebe4cc47b9f
Author: Milan Crha <mcrha redhat com>
Date: Wed Feb 2 15:34:03 2022 +0100
calendar-server: Read timezone from the calendar, not its timezone cache
The calendar's timezone cache holds only timezones already received
or added to the calendar, thus when asking it for a timezone for "the first
time", it returns NULL and a wrong timezone is used instead.
The get_timezone() does not do any I/O when the timezone is already cached
on the client side, thus it's fine to use it.
This could exhibit with non-recurring events, which use custom time zones,
in which case the event is shown in a wrong time.
src/calendar-server/gnome-shell-calendar-server.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar-server/gnome-shell-calendar-server.c
b/src/calendar-server/gnome-shell-calendar-server.c
index 5d15e2ae60..f1980c633c 100644
--- a/src/calendar-server/gnome-shell-calendar-server.c
+++ b/src/calendar-server/gnome-shell-calendar-server.c
@@ -123,7 +123,6 @@ get_time_from_property (ECalClient *cal,
{
ICalProperty *prop;
ICalTime *itt;
- ICalParameter *param;
ICalTimezone *timezone = NULL;
prop = i_cal_component_get_first_property (icomp, prop_kind);
@@ -132,17 +131,24 @@ get_time_from_property (ECalClient *cal,
itt = get_prop_func (prop);
- param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
- if (param)
- timezone = e_timezone_cache_get_timezone (E_TIMEZONE_CACHE (cal), i_cal_parameter_get_tzid (param));
- else if (i_cal_time_is_utc (itt))
+ if (i_cal_time_is_utc (itt))
timezone = i_cal_timezone_get_utc_timezone ();
else
+ {
+ ICalParameter *param;
+
+ param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
+ if (param && !e_cal_client_get_timezone_sync (cal, i_cal_parameter_get_tzid (param), &timezone, NULL,
NULL))
+ print_debug ("Failed to get timezone '%s'\n", i_cal_parameter_get_tzid (param));
+
+ g_clear_object (¶m);
+ }
+
+ if (timezone == NULL)
timezone = default_zone;
i_cal_time_set_timezone (itt, timezone);
- g_clear_object (¶m);
g_clear_object (&prop);
*out_itt = itt;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]