From 6b4c3984d52cfbf88ae84ee0102f4aa0c17a2a62 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 4 Mar 2003 19:52:37 +0000 Subject: If only the pipe wouldn't break. svn path=/trunk/; revision=20143 --- calendar/gui/dialogs/recurrence-page.c | 68 ++++++++++++++-------------------- 1 file changed, 27 insertions(+), 41 deletions(-) (limited to 'calendar/gui/dialogs/recurrence-page.c') diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 6370326af9..1a7c5533fd 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -410,30 +410,6 @@ clear_widgets (RecurrencePage *rpage) e_date_time_list_clear (priv->exception_list_store); } -/* Builds a static string out of an exception date */ -static char * -get_exception_string (CalComponentDateTime *dt) -{ - static char buf[256]; - struct tm tmp_tm; - - tmp_tm.tm_year = dt->value->year - 1900; - tmp_tm.tm_mon = dt->value->month - 1; - tmp_tm.tm_mday = dt->value->day; - tmp_tm.tm_hour = dt->value->hour; - tmp_tm.tm_min = dt->value->minute; - tmp_tm.tm_sec = dt->value->second; - tmp_tm.tm_isdst = -1; - - tmp_tm.tm_wday = time_day_of_week (dt->value->day, - dt->value->month - 1, - dt->value->year); - - e_time_format_date_and_time (&tmp_tm, calendar_config_get_24_hour_format(), FALSE, FALSE, buf, sizeof (buf)); - - return buf; -} - /* Appends an exception date to the list */ static void append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime) @@ -527,6 +503,12 @@ sensitize_recur_widgets (RecurrencePage *rpage) type = e_dialog_radio_get (priv->none, type_map); + /* We can't preview that well for instances right now */ + if (cal_component_is_instance (priv->comp)) + gtk_widget_set_sensitive (priv->preview_calendar, FALSE); + else + gtk_widget_set_sensitive (priv->preview_calendar, TRUE); + if (GTK_BIN (priv->custom_warning_bin)->child) gtk_widget_destroy (GTK_BIN (priv->custom_warning_bin)->child); @@ -821,7 +803,7 @@ fill_component (RecurrencePage *rpage, CalComponent *comp) if (!icaltime_is_valid_time (*dt->value)) { comp_editor_page_display_validation_error (COMP_EDITOR_PAGE (rpage), - _("Recurrent date is wrong"), + _("Recurrence date is invalid"), priv->exception_list); return FALSE; } @@ -848,13 +830,14 @@ preview_recur (RecurrencePage *rpage) CalComponent *comp; CalComponentDateTime cdt; GSList *l; - + icaltimezone *zone = NULL; + priv = rpage->priv; /* If our component has not been set yet through ::fill_widgets(), we * cannot preview the recurrence. */ - if (!priv->comp) + if (!priv->comp || cal_component_is_instance (priv->comp)) return; /* Create a scratch component with the start/end and @@ -865,6 +848,10 @@ preview_recur (RecurrencePage *rpage) cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); cal_component_get_dtstart (priv->comp, &cdt); + if (cdt.tzid != NULL) { + if (cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone) != CAL_CLIENT_GET_SUCCESS) + zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid); + } cal_component_set_dtstart (comp, &cdt); cal_component_free_datetime (&cdt); @@ -891,8 +878,8 @@ preview_recur (RecurrencePage *rpage) fill_component (rpage, comp); tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp, - COMP_EDITOR_PAGE (rpage)->client, TRUE, FALSE); - g_object_unref((comp)); + COMP_EDITOR_PAGE (rpage)->client, zone, TRUE, FALSE); + g_object_unref(comp); } /* Callback used when the recurrence weekday picker changes */ @@ -1924,19 +1911,18 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) /* Update the weekday picker if necessary */ mask = get_start_weekday_mask (priv->comp); - if (mask == priv->weekday_blocked_day_mask) - return; - - priv->weekday_day_mask = priv->weekday_day_mask | mask; - priv->weekday_blocked_day_mask = mask; - - if (priv->weekday_picker != NULL) { - weekday_picker_set_days (WEEKDAY_PICKER (priv->weekday_picker), - priv->weekday_day_mask); - weekday_picker_set_blocked_days (WEEKDAY_PICKER (priv->weekday_picker), - priv->weekday_blocked_day_mask); + if (mask != priv->weekday_blocked_day_mask) { + priv->weekday_day_mask = priv->weekday_day_mask | mask; + priv->weekday_blocked_day_mask = mask; + + if (priv->weekday_picker != NULL) { + weekday_picker_set_days (WEEKDAY_PICKER (priv->weekday_picker), + priv->weekday_day_mask); + weekday_picker_set_blocked_days (WEEKDAY_PICKER (priv->weekday_picker), + priv->weekday_blocked_day_mask); + } } - + /* Make sure the preview gets updated. */ preview_recur (rpage); } -- cgit v1.2.3