diff options
author | Milan Crha <mcrha@redhat.com> | 2010-10-29 21:54:19 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-10-29 21:54:19 +0800 |
commit | 475c08d68f1e236b6162fd0d8861c3a7319ddeb5 (patch) | |
tree | abb4ad21e8fa570e9d92cbaeea11b1f446927330 | |
parent | e3b41081da24d7fb1cc945fd4ab2daef413e66bc (diff) | |
download | gsoc2013-evolution-475c08d68f1e236b6162fd0d8861c3a7319ddeb5.tar.gz gsoc2013-evolution-475c08d68f1e236b6162fd0d8861c3a7319ddeb5.tar.zst gsoc2013-evolution-475c08d68f1e236b6162fd0d8861c3a7319ddeb5.zip |
Bug #632199 - Opening calendar from panel clock goes to previous day
-rw-r--r-- | 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 e72626304e..134f706054 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) |