diff options
author | JP Rosevear <jpr@ximian.com> | 2002-10-16 00:45:21 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-10-16 00:45:21 +0800 |
commit | 4665c04ce8be49ff3c67749ef0c15afe1a3bc28e (patch) | |
tree | 21060f248d71b0ef38b9041a3aa4b64756046b5e /widgets/misc | |
parent | 86e5e4950f0ee568dfa837bae547242ab23a2d83 (diff) | |
download | gsoc2013-evolution-4665c04ce8be49ff3c67749ef0c15afe1a3bc28e.tar.gz gsoc2013-evolution-4665c04ce8be49ff3c67749ef0c15afe1a3bc28e.tar.zst gsoc2013-evolution-4665c04ce8be49ff3c67749ef0c15afe1a3bc28e.zip |
check if the selection fits in the leftover days
2002-10-11 JP Rosevear <jpr@ximian.com>
* e-calendar-item.c (e_calendar_item_ensure_days_visible): check
if the selection fits in the leftover days
svn path=/trunk/; revision=18368
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/ChangeLog | 5 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.c | 27 |
2 files changed, 28 insertions, 4 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 88fcdff23c..a88854c6bc 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,8 @@ +2002-10-11 JP Rosevear <jpr@ximian.com> + + * e-calendar-item.c (e_calendar_item_ensure_days_visible): check + if the selection fits in the leftover days + 2002-09-30 Ettore Perazzoli <ettore@ximian.com> [Add a small delay to the switching of pages in the multi-config diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index f6d7c03820..4a53b10e96 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -2149,7 +2149,7 @@ e_calendar_item_set_first_month(ECalendarItem *calitem, calitem->month = new_month; } else { old_days_in_selection = e_calendar_item_get_inclusive_days (calitem, calitem->selection_start_month_offset, calitem->selection_start_day, calitem->selection_end_month_offset, calitem->selection_end_day); - + /* Make sure the selection will be displayed. */ if (calitem->selection_start_month_offset < 0 || calitem->selection_start_month_offset >= num_months) { @@ -2705,9 +2705,28 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, if (end_year > current_end_year || (end_year == current_end_year && end_month > current_end_month)) { - need_update = TRUE; - calitem->year = end_year; - calitem->month = end_month - months_shown + 1; + + /* First we see if the end of the selection will fit in the + leftover days of the month after the last one shown. */ + calitem->month += (months_shown - 1); + e_calendar_item_normalize_date (calitem, &calitem->year, + &calitem->month); + + e_calendar_item_get_month_info (calitem, 0, 0, + &first_day_offset, + &days_in_month, + &days_in_prev_month); + + if (end_day >= E_CALENDAR_ROWS_PER_MONTH * E_CALENDAR_COLS_PER_MONTH - + first_day_offset - days_in_month) { + need_update = TRUE; + + calitem->year = end_year; + calitem->month = end_month - months_shown + 1; + } else { + calitem->month -= (months_shown - 1); + } + e_calendar_item_normalize_date (calitem, &calitem->year, &calitem->month); } |