[gnome-calendar] event: properly set the timezone



commit 87620ebbbdd6d58554cd3592b1aede29cfbb9460
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Feb 26 20:58:29 2016 +0100

    event: properly set the timezone

 src/gcal-event.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/gcal-event.c b/src/gcal-event.c
index 17f71f9..d8b36ac 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -116,26 +116,24 @@ build_component_from_datetime (GcalEvent *self,
                                GDateTime *dt)
 {
   ECalComponentDateTime *comp_dt;
-  GDateTime *utf_dt;
+  gchar *tzid;
 
   if (!dt)
     return NULL;
 
-  utf_dt = g_date_time_to_utc (dt);
-
   comp_dt = g_new0 (ECalComponentDateTime, 1);
   comp_dt->value = NULL;
   comp_dt->tzid = NULL;
 
-  comp_dt->value = datetime_to_icaltime (utf_dt);
-  comp_dt->value->zone = NULL;
+  tzid = format_utc_offset (g_date_time_get_utc_offset (dt));
+
+  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 = format_utc_offset (g_date_time_get_utc_offset (dt));
-
-  g_clear_pointer (&utf_dt, g_date_time_unref);
+    comp_dt->tzid = tzid;
 
   return comp_dt;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]