event: handle different tzid formats

tzid can have different formats depending on where it originates from:
regular or prefixed by a libical specific identifier. Use the
right icaltimezone_get_builtin_timezone* for each case.

https://bugzilla.gnome.org/show_bug.cgi?id=763180
This commit is contained in:
fosero
2016-03-06 17:03:00 -03:00
committed by Georges Basile Stavracas Neto
parent 681ec191f0
commit e464eb6415
+7 -1
View File
@@ -19,6 +19,8 @@
#include "gcal-event.h"
#include "gcal-utils.h"
#define LIBICAL_TZID_PREFIX "/freeassociation.sourceforge.net/"
struct _GcalEvent
{
GObject parent;
@@ -95,7 +97,11 @@ get_timezone_from_ical (ECalComponentDateTime *comp)
gchar *tzid;
gint offset;
zone = icaltimezone_get_builtin_timezone (comp->tzid);
if (g_str_has_prefix (comp->tzid, LIBICAL_TZID_PREFIX))
zone = icaltimezone_get_builtin_timezone_from_tzid (comp->tzid);
else
zone = icaltimezone_get_builtin_timezone (comp->tzid);
offset = icaltimezone_get_utc_offset (zone, comp->value, NULL);
tzid = format_utc_offset (offset);