aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-03-12 19:33:46 +0800
committerMilan Crha <mcrha@redhat.com>2013-03-12 19:33:46 +0800
commit3e8e8cb946d4597134c7d98a178c17ef5e835dc6 (patch)
tree856fa59b6d8c7e210d524b0ffdfbed25edf4171f /modules/calendar
parentd1eb86b2c37237bce7635ce77d3f208a7604263d (diff)
downloadgsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar.gz
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar.bz2
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar.lz
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar.xz
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.tar.zst
gsoc2013-evolution-3e8e8cb946d4597134c7d98a178c17ef5e835dc6.zip
Bug #690930 - Launching calendar from clock-applet applies timezone twice
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-backend.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 49afb09d24..ec7af990e5 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -362,15 +362,28 @@ cal_shell_backend_init_importers (void)
e_import_class_add_importer (import_class, importer, NULL, NULL);
}
-static time_t
-utc_to_user_zone (time_t utc_time,
- icaltimezone *zone)
+static void
+populate_g_date (GDate *date,
+ time_t utc_time,
+ icaltimezone *zone)
{
- if (!zone || (gint) utc_time == -1)
- return utc_time;
+ struct icaltimetype icaltm;
+
+ g_return_if_fail (date != NULL);
+
+ if ((gint) utc_time == -1)
+ return;
+
+ if (zone)
+ icaltm = icaltime_from_timet_with_zone (utc_time, FALSE, zone);
+ else
+ icaltm = icaltime_from_timet (utc_time, FALSE);
+
+ if (icaltime_is_null_time (icaltm) ||
+ !icaltime_is_valid_time (icaltm))
+ return;
- return icaltime_as_timet (
- icaltime_from_timet_with_zone (utc_time, FALSE, zone));
+ g_date_set_dmy (date, icaltm.day, icaltm.month, icaltm.year);
}
static gboolean
@@ -440,13 +453,9 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
content = g_strndup (cp, content_len);
if (g_ascii_strcasecmp (header, "startdate") == 0)
- g_date_set_time_t (
- &start_date, utc_to_user_zone (
- time_from_isodate (content), zone));
+ populate_g_date (&start_date, time_from_isodate (content), zone);
else if (g_ascii_strcasecmp (header, "enddate") == 0)
- g_date_set_time_t (
- &end_date, utc_to_user_zone (
- time_from_isodate (content), zone));
+ populate_g_date (&end_date, time_from_isodate (content), zone);
else if (g_ascii_strcasecmp (header, "source-uid") == 0)
source_uid = g_strdup (content);
else if (g_ascii_strcasecmp (header, "comp-uid") == 0)