[gnome-shell/gnome-3-34] calendar-server: Use correct timezone for all-day events
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-34] calendar-server: Use correct timezone for all-day events
- Date: Thu, 28 Nov 2019 13:19:31 +0000 (UTC)
commit bb24df2f9d3693dd39dbc573b880cecdbd283705
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Nov 28 01:23:36 2019 +0100
calendar-server: Use correct timezone for all-day events
Since commit 28c535e34, we use the timezone associated with the ICalTime
instead of the default timezone when converting to time_t. However while
that is correct for most events, for ICalTimes that don't have a timezone
associated we still want to fall back to the default timezone instead of
UTC.
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1895
src/calendar-server/gnome-shell-calendar-server.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar-server/gnome-shell-calendar-server.c
b/src/calendar-server/gnome-shell-calendar-server.c
index 9c88a2f9e7..ccdf9f67bb 100644
--- a/src/calendar-server/gnome-shell-calendar-server.c
+++ b/src/calendar-server/gnome-shell-calendar-server.c
@@ -443,6 +443,18 @@ calendar_appointment_new (ICalComponent *icomp,
return appointment;
}
+static time_t
+timet_from_ical_time (ICalTime *time,
+ ICalTimezone *default_zone)
+{
+ ICalTimezone *timezone = NULL;
+
+ timezone = i_cal_time_get_timezone (time);
+ if (timezone == NULL)
+ timezone = default_zone;
+ return i_cal_time_as_timet_with_zone (time, timezone);
+}
+
static gboolean
generate_instances_cb (ICalComponent *icomp,
ICalTime *instance_start,
@@ -455,8 +467,10 @@ generate_instances_cb (ICalComponent *icomp,
GHashTable *appointments = ((CollectAppointmentsData *)user_data)->appointments;
CalendarAppointment *appointment;
CalendarOccurrence *occurrence;
+ ICalTimezone *default_zone;
const gchar *uid;
+ default_zone = e_cal_client_get_default_timezone (cal);
uid = i_cal_component_get_uid (icomp);
appointment = g_hash_table_lookup (appointments, uid);
@@ -467,8 +481,8 @@ generate_instances_cb (ICalComponent *icomp,
}
occurrence = g_new0 (CalendarOccurrence, 1);
- occurrence->start_time = i_cal_time_as_timet_with_zone (instance_start, i_cal_time_get_timezone
(instance_start));
- occurrence->end_time = i_cal_time_as_timet_with_zone (instance_end, i_cal_time_get_timezone
(instance_end));
+ occurrence->start_time = timet_from_ical_time (instance_start, default_zone);
+ occurrence->end_time = timet_from_ical_time (instance_end, default_zone);
occurrence->rid = e_cal_util_component_get_recurid_as_string (icomp);
appointment->occurrences = g_slist_append (appointment->occurrences, occurrence);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]