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
This commit is contained in:
parent
9150cbca3e
commit
bb24df2f9d
@ -443,6 +443,18 @@ calendar_appointment_new (ICalComponent *icomp,
|
|||||||
return appointment;
|
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
|
static gboolean
|
||||||
generate_instances_cb (ICalComponent *icomp,
|
generate_instances_cb (ICalComponent *icomp,
|
||||||
ICalTime *instance_start,
|
ICalTime *instance_start,
|
||||||
@ -455,8 +467,10 @@ generate_instances_cb (ICalComponent *icomp,
|
|||||||
GHashTable *appointments = ((CollectAppointmentsData *)user_data)->appointments;
|
GHashTable *appointments = ((CollectAppointmentsData *)user_data)->appointments;
|
||||||
CalendarAppointment *appointment;
|
CalendarAppointment *appointment;
|
||||||
CalendarOccurrence *occurrence;
|
CalendarOccurrence *occurrence;
|
||||||
|
ICalTimezone *default_zone;
|
||||||
const gchar *uid;
|
const gchar *uid;
|
||||||
|
|
||||||
|
default_zone = e_cal_client_get_default_timezone (cal);
|
||||||
uid = i_cal_component_get_uid (icomp);
|
uid = i_cal_component_get_uid (icomp);
|
||||||
appointment = g_hash_table_lookup (appointments, uid);
|
appointment = g_hash_table_lookup (appointments, uid);
|
||||||
|
|
||||||
@ -467,8 +481,8 @@ generate_instances_cb (ICalComponent *icomp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
occurrence = g_new0 (CalendarOccurrence, 1);
|
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->start_time = timet_from_ical_time (instance_start, default_zone);
|
||||||
occurrence->end_time = i_cal_time_as_timet_with_zone (instance_end, i_cal_time_get_timezone (instance_end));
|
occurrence->end_time = timet_from_ical_time (instance_end, default_zone);
|
||||||
occurrence->rid = e_cal_util_component_get_recurid_as_string (icomp);
|
occurrence->rid = e_cal_util_component_get_recurid_as_string (icomp);
|
||||||
|
|
||||||
appointment->occurrences = g_slist_append (appointment->occurrences, occurrence);
|
appointment->occurrences = g_slist_append (appointment->occurrences, occurrence);
|
||||||
|
Loading…
Reference in New Issue
Block a user