[gnome-calendar/wip/mcatanzaro/timezone: 4/5] event: Restore handling of all day events
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/mcatanzaro/timezone: 4/5] event: Restore handling of all day events
- Date: Wed, 6 Dec 2017 03:26:40 +0000 (UTC)
commit 63fe2e6eb88af6921c93fbbbf7ffc77968e500e8
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Tue Dec 5 17:36:14 2017 -0600
event: Restore handling of all day events
This brings back the original handling of all day events that we had
before I reverted the previous commit.
src/gcal-event.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/gcal-event.c b/src/gcal-event.c
index d9c7fe7..dc60663 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -225,24 +225,28 @@ build_component_from_datetime (GcalEvent *self,
GDateTime *dt)
{
ECalComponentDateTime *comp_dt;
- gchar *tzid;
if (!dt)
return NULL;
comp_dt = g_new0 (ECalComponentDateTime, 1);
- comp_dt->value = NULL;
- comp_dt->tzid = NULL;
-
- tzid = g_date_time_format (dt, "%Z");
-
comp_dt->value = datetime_to_icaltime (dt);
- comp_dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
comp_dt->value->is_date = self->all_day;
- /* All day events have no timezone */
- if (!self->all_day)
- comp_dt->tzid = tzid;
+ if (self->all_day)
+ {
+ comp_dt->value->zone = icaltimezone_get_utc_timezone ();
+ comp_dt->tzid = g_strdup ("UTC");
+ }
+ else
+ {
+ gchar *tzid;
+
+ tzid = g_date_time_format (dt, "%Z");
+ comp_dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ /* This transfers ownership of tzid. */
+ comp_dt->tzid = tzid;
+ }
return comp_dt;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]