aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-07-09 15:33:18 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-07-09 15:33:18 -0500
commit42bd1c1066978afa3040266f243a0582a73f453a (patch)
tree1dfd4802ca310a2d63c8d2671c7e48ed5ab8522b
parenta08215ada9d1e9cae475ba4df5121c2b09ad1d13 (diff)
downloadayatana-indicator-datetime-42bd1c1066978afa3040266f243a0582a73f453a.tar.gz
ayatana-indicator-datetime-42bd1c1066978afa3040266f243a0582a73f453a.tar.bz2
ayatana-indicator-datetime-42bd1c1066978afa3040266f243a0582a73f453a.zip
avoid the round trip to EDS if we can figure out the tzid from libical first
-rw-r--r--src/engine-eds.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp
index 9a54b74..746b9af 100644
--- a/src/engine-eds.cpp
+++ b/src/engine-eds.cpp
@@ -740,12 +740,18 @@ private:
if (in.tzid != nullptr)
{
const char * tzid {};
- icaltimezone * itz {}; // owned by client
+ icaltimezone * itz {};
- if (e_cal_client_get_timezone_sync(client, in.tzid, &itz, cancellable.get(), nullptr))
- {
+ itz = icaltimezone_get_builtin_timezone_from_tzid(in.tzid); // usually works
+
+ if (itz == nullptr) // fallback
+ itz = icaltimezone_get_builtin_timezone(in.tzid);
+
+ if (itz == nullptr) // ok, I give up... make a round trip on the bus to ask EDS to look it up in VTIMEZONES
+ e_cal_client_get_timezone_sync(client, in.tzid, &itz, cancellable.get(), nullptr);
+
+ if (itz != nullptr)
tzid = icaltimezone_get_location(itz);
- }
gtz = g_time_zone_new(tzid);
g_debug("%s eccdt.tzid -> offset is %d", G_STRLOC, in.tzid, (int)g_time_zone_get_offset(gtz,0));