From 04bda8ad1e0cb676d711dbf0f22ff9f4fb615891 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Tue, 23 Oct 2001 00:23:42 +0000 Subject: added setDefaultTimezone() method. 2001-10-22 Damon Chaplin * idl/evolution-calendar.idl: added setDefaultTimezone() method. * pcs/cal-backend.c (cal_backend_get_default_timezone): (cal_backend_set_default_timezone): new functions to call class methods. * pcs/cal-backend-file.c: lots of changes to handle the default timezone and use it. * pcs/query.c: use the default timezone. * gui/dialogs/task-details-page.c (date_changed_cb): initialized completed_tt. * gui/dialogs/event-page.c: changed it to handle DATE values. The 'All Day Event' checkbox is only set now when the DTSTART and DTEND are DATE values. * gui/dialogs/comp-editor-util.c (comp_editor_free_dates): free the CalComponentDateTime structs as well. * gui/e-tasks.c: set the default timezone on the server. * gui/tag-calendar.c: * gui/gnome-cal.c: * gui/e-week-view.c: * gui/e-day-view.c: updates to handle DATE values. * gui/e-calendar-table.c (date_compare_cb): updated to use the new ECellDateEditValue values, so it now works. (percent_compare_cb): updated to use GPOINTER_TO_INT values. (e_calendar_table_init): use an ECellPercent for the percent field and an ECellDateEditText for the date fields. * gui/comp-util.c (cal_comp_util_compare_event_timezones): return TRUE if the DTSTART or DTEND is a DATE value. We don't want to show the timezone icons for DATE values. * gui/comp-editor-factory.c (resolve_pending_requests): set the default timezone on the server. * gui/calendar-model.c: major changes to support sorting properly. For date and percent fields we now use subclasses of ECellText, so we don't use a char* as the model value. For the percent field we now use a GINT_TO_POINTER. For the date fields we now use a ECellDateEditValue* as the value. * gui/calendar-config.c (calendar_config_configure_e_cell_date_edit): set the timezone and use_24_hour flags of the new ECellDateEditText. * conduits/todo/todo-conduit.c (pre_sync): * conduits/calendar/calendar-conduit.c (pre_sync): set the default timezone on the server. * cal-util/timeutil.c (time_days_in_month): removed debug message. * cal-util/test-recur.c: try to handle timezones in the iCalendar file properly, and updated to pass default timezone. * cal-util/cal-util.c (cal_util_generate_alarms_for_comp): (cal_util_generate_alarms_for_list): added default timezone argument. * cal-util/cal-recur.c: changed many of the functions to take a default timezone, to use to resolve DATE and floating DATE-TIME values. * cal-client/cal-client.c (cal_client_set_default_timezone): new function to set the default timezone. (cal_client_ensure_timezone_on_server): new function to ensure that a given timezone is on the server. * gui/e-cell-date-edit-text.c: new subclass of ECellText to display and edit a date value. * cal-util/cal-recur.c (cal_obj_byday_expand_monthly): changed week_num to -week_num when calculating the weeks to go back from the end of the month for things like BYDAY=-2WE. Fixes bug #11525. (cal_recur_generate_instances_of_rule): only go up to MAX_YEAR (2037). We can't really handle anything past that anyway. (cal_recur_ensure_rule_end_date): initialize cb_date.end_date to 0, so if the RULE doesn't generate COUNT instances we save 0 as the time_t. svn path=/trunk/; revision=13920 --- calendar/gui/gnome-cal.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'calendar/gui/gnome-cal.c') diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index b1f7c9470c..1790739853 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1345,9 +1345,15 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da switch (status) { case CAL_CLIENT_OPEN_SUCCESS: - if (client == priv->client) + /* If this is the main CalClient, update the Date Navigator. */ + if (client == priv->client) { update_query (gcal); + } + /* Set the client's default timezone, if we have one. */ + if (priv->zone) { + cal_client_set_default_timezone (client, priv->zone); + } break; case CAL_CLIENT_OPEN_ERROR: @@ -1826,6 +1832,16 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal, location = calendar_config_get_timezone (); priv->zone = icaltimezone_get_builtin_timezone (location); + if (priv->client + && cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED) { + cal_client_set_default_timezone (priv->client, priv->zone); + } + if (priv->task_pad_client + && cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) { + cal_client_set_default_timezone (priv->task_pad_client, + priv->zone); + } + e_day_view_set_timezone (E_DAY_VIEW (priv->day_view), priv->zone); e_day_view_set_timezone (E_DAY_VIEW (priv->work_week_view), priv->zone); e_week_view_set_timezone (E_WEEK_VIEW (priv->week_view), priv->zone); @@ -1996,7 +2012,10 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal, priv = cal->priv; dt.value = &itt; - dt.tzid = icaltimezone_get_tzid (priv->zone); + if (all_day) + dt.tzid = NULL; + else + dt.tzid = icaltimezone_get_tzid (priv->zone); /* Component type */ @@ -2006,18 +2025,21 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal, /* DTSTART, DTEND */ itt = icaltime_from_timet_with_zone (dtstart, FALSE, priv->zone); - if (all_day) + if (all_day) { itt.hour = itt.minute = itt.second = 0; + itt.is_date = TRUE; + } cal_component_set_dtstart (comp, &dt); itt = icaltime_from_timet_with_zone (dtend, FALSE, priv->zone); if (all_day) { - /* If we want an all-day event and the end time isn't on a - day boundary, we move it to the end of the day it is in. */ - if (itt.hour != 0 || itt.minute != 0 || itt.second != 0) { - itt.hour = itt.minute = itt.second = 0; - icaltime_adjust (&itt, 1, 0, 0, 0); + /* We round it down to the start of the day, or the start of + the previous day if it is midnight. */ + if (itt.hour == 0 && itt.minute == 0 && itt.second == 0) { + icaltime_adjust (&itt, -1, 0, 0, 0); } + itt.hour = itt.minute = itt.second = 0; + itt.is_date = TRUE; } cal_component_set_dtend (comp, &dt); -- cgit