[evolution] Bug #690930 - Launching calendar from clock-applet applies timezone twice
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #690930 - Launching calendar from clock-applet applies timezone twice
- Date: Tue, 12 Mar 2013 11:34:16 +0000 (UTC)
commit 3e8e8cb946d4597134c7d98a178c17ef5e835dc6
Author: Milan Crha <mcrha redhat com>
Date: Tue Mar 12 12:33:46 2013 +0100
Bug #690930 - Launching calendar from clock-applet applies timezone twice
modules/calendar/e-cal-shell-backend.c | 35 ++++++++++++++++++++-----------
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 49afb09..ec7af99 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]