diff options
Diffstat (limited to 'calendar/gui/dialogs/recurrence-page.c')
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 28858bd950..c76b6dd970 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -582,8 +582,9 @@ sensitize_recur_widgets (RecurrencePage *rpage) } } +#if 0 /* Encondes a position/weekday pair into the proper format for - * icalrecurrencetype.by_day. + * icalrecurrencetype.by_day. Not needed at present. */ static short nth_weekday (int pos, icalrecurrencetype_weekday weekday) @@ -592,6 +593,7 @@ nth_weekday (int pos, icalrecurrencetype_weekday weekday) return (pos << 3) | (int) weekday; } +#endif /* Gets the simple recurrence data from the recurrence widgets and stores it in * the calendar component. @@ -678,39 +680,42 @@ simple_recur_to_comp (RecurrencePage *rpage, CalComponent *comp) r.by_month_day[0] = day_index; break; + /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not + accept BYDAY=2TU. So we now use the same as Outlook + by default. */ case MONTH_DAY_MON: - r.by_day[0] = nth_weekday (day_index, - ICAL_MONDAY_WEEKDAY); + r.by_day[0] = ICAL_MONDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_TUE: - r.by_day[0] = nth_weekday (day_index, - ICAL_TUESDAY_WEEKDAY); + r.by_day[0] = ICAL_TUESDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_WED: - r.by_day[0] = nth_weekday (day_index, - ICAL_WEDNESDAY_WEEKDAY); + r.by_day[0] = ICAL_WEDNESDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_THU: - r.by_day[0] = nth_weekday (day_index, - ICAL_THURSDAY_WEEKDAY); + r.by_day[0] = ICAL_THURSDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_FRI: - r.by_day[0] = nth_weekday (day_index, - ICAL_FRIDAY_WEEKDAY); + r.by_day[0] = ICAL_FRIDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_SAT: - r.by_day[0] = nth_weekday (day_index, - ICAL_SATURDAY_WEEKDAY); + r.by_day[0] = ICAL_SATURDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; case MONTH_DAY_SUN: - r.by_day[0] = nth_weekday (day_index, - ICAL_SUNDAY_WEEKDAY); + r.by_day[0] = ICAL_SUNDAY_WEEKDAY; + r.by_set_pos[0] = day_index; break; default: @@ -1577,12 +1582,15 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp) if (n_by_year_day != 0 || n_by_week_no != 0 || n_by_month != 0 - || n_by_set_pos != 0) + || n_by_set_pos > 1) goto custom; if (n_by_month_day == 1) { int nth; + if (n_by_set_pos != 0) + goto custom; + nth = r->by_month_day[0]; if (nth < 1) goto custom; @@ -1594,11 +1602,20 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp) int pos; enum month_day_options month_day; + /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not + accept BYDAY=2TU. So we now use the same as Outlook + by default. */ + weekday = icalrecurrencetype_day_day_of_week (r->by_day[0]); pos = icalrecurrencetype_day_position (r->by_day[0]); - if (pos < 1) + if (pos == 0) { + if (n_by_set_pos != 1) + goto custom; + pos = r->by_set_pos[0]; + } else if (pos < 0) { goto custom; + } switch (weekday) { case ICAL_MONDAY_WEEKDAY: @@ -1799,7 +1816,10 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) static gboolean get_widgets (RecurrencePage *rpage) { + CompEditorPage *page = COMP_EDITOR_PAGE (rpage); RecurrencePagePrivate *priv; + GSList *accel_groups; + GtkWidget *toplevel; priv = rpage->priv; @@ -1809,6 +1829,15 @@ get_widgets (RecurrencePage *rpage) if (!priv->main) return FALSE; + /* Get the GtkAccelGroup from the toplevel window, so we can install + it when the notebook page is mapped. */ + toplevel = gtk_widget_get_toplevel (priv->main); + accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); + if (accel_groups) { + page->accel_group = accel_groups->data; + gtk_accel_group_ref (page->accel_group); + } + gtk_widget_ref (priv->main); gtk_widget_unparent (priv->main); |