[evolution] Bug #632199 - Opening calendar from panel clock goes to previous day



commit 475c08d68f1e236b6162fd0d8861c3a7319ddeb5
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 29 15:54:19 2010 +0200

    Bug #632199 - Opening calendar from panel clock goes to previous day

 modules/calendar/e-cal-shell-backend.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index e726263..134f706 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -451,6 +451,18 @@ 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 = calendar_config_get_icaltimezone ();
+
+	if (!zone || (int) utc_time == -1)
+		return utc_time;
+
+	return icaltime_as_timet (
+		icaltime_from_timet_with_zone (utc_time, FALSE, zone));
+}
+
 static gboolean
 cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
                                  const gchar *uri)
@@ -510,10 +522,10 @@ 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, time_from_isodate (content));
+				&start_date, utc_to_user_zone (time_from_isodate (content)));
 		else if (g_ascii_strcasecmp (header, "enddate") == 0)
 			g_date_set_time_t (
-				&end_date, time_from_isodate (content));
+				&end_date, utc_to_user_zone (time_from_isodate (content)));
 		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]