From 65f2e3d2a3de395977fbd39af0baac0b61504ee5 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Tue, 17 Jul 2001 01:34:49 +0000 Subject: try to use builtin timezones before getting them from the server. When 2001-07-16 Damon Chaplin * gui/dialogs/task-page.c (task_page_fill_widgets): * gui/dialogs/event-page.c (event_page_fill_widgets): try to use builtin timezones before getting them from the server. When creating new events/tasks the timezones may not be on the server. * gui/dialogs/event-page.c (event_page_fill_widgets): for all-day events we subtract a day from the end date rather than add it. * gui/dialogs/e-timezone-dialog.c (on_map_leave): ignore the event if it isn't a GDK_CROSSING_NORMAL event. For some reason we are getting leave events when the button is pressed, which meant that selecting timezones in the map didn't work. * gui/dialogs/comp-editor-util.c (comp_editor_dates): * gui/print.c (print_date_label): only free icaltimetype if not NULL. svn path=/trunk/; revision=11144 --- calendar/gui/dialogs/event-page.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs/event-page.c') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 367412cbab..76b5df5b3d 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -350,19 +350,32 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Start and end times */ cal_component_get_dtstart (comp, &start_date); - status = cal_client_get_timezone (page->client, start_date.tzid, - &start_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - start_date.tzid ? start_date.tzid : ""); + + /* Note that if we are creating a new event, the timezones may not be + on the server, so we try to get the builtin timezone with the TZID + first. */ + start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date.tzid); + if (!start_zone) { + status = cal_client_get_timezone (page->client, + start_date.tzid, + &start_zone); + /* FIXME: Handle error better. */ + if (status != CAL_CLIENT_GET_SUCCESS) + g_warning ("Couldn't get timezone from server: %s", + start_date.tzid ? start_date.tzid : ""); + } cal_component_get_dtend (comp, &end_date); - status = cal_client_get_timezone (page->client, end_date.tzid, &end_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - end_date.tzid ? end_date.tzid : ""); + end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date.tzid); + if (!end_zone) { + status = cal_client_get_timezone (page->client, + end_date.tzid, + &end_zone); + /* FIXME: Handle error better. */ + if (status != CAL_CLIENT_GET_SUCCESS) + g_warning ("Couldn't get timezone from server: %s", + end_date.tzid ? end_date.tzid : ""); + } /* All-day events are inclusive, i.e. if the end date shown is 2nd Feb then the event includes all of the 2nd Feb. We would normally show @@ -372,7 +385,7 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp) end_tt = end_date.value; if (start_tt->hour == 0 && start_tt->minute == 0 && start_tt->second == 0 && end_tt->hour == 0 && end_tt->minute == 0 && end_tt->second == 0) - icaltime_adjust (end_tt, 1, 0, 0, 0); + icaltime_adjust (end_tt, -1, 0, 0, 0); gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), epage); -- cgit v1.2.3