diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-04-03 12:00:19 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-04-03 12:00:19 +0800 |
commit | 7143de721bd1b16c97bd123456aa60fc7e8237bd (patch) | |
tree | 3c0d694a183f4649d1e41ca51280321e79977f47 | |
parent | 04601125b5bf376e65da35c46cf77e690e7c1132 (diff) | |
download | gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar.gz gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar.bz2 gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar.lz gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar.xz gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.tar.zst gsoc2013-evolution-7143de721bd1b16c97bd123456aa60fc7e8237bd.zip |
For example; a selection ending 2003-apr-02 does not fit into the
2003-04-02 Hans Petter Jansson <hpj@ximian.com>
* e-calendar-item.c (e_calendar_item_set_selection): For example;
a selection ending 2003-apr-02 does not fit into the remaining
shown days after 1969-dec. Stop assuming that it does.
svn path=/trunk/; revision=20652
-rw-r--r-- | widgets/misc/ChangeLog | 6 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.c | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 63b86b708b..f6ce7c1348 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,9 @@ +2003-04-02 Hans Petter Jansson <hpj@ximian.com> + + * e-calendar-item.c (e_calendar_item_set_selection): For example; + a selection ending 2003-apr-02 does not fit into the remaining + shown days after 1969-dec. Stop assuming that it does. + 2003-04-01 Hans Petter Jansson <hpj@ximian.com> * e-calendar-item.c (e_calendar_item_class_init) diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 92bd50f466..d5a9b37a7b 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -2717,7 +2717,7 @@ e_calendar_item_set_selection (ECalendarItem *calitem, end_year = g_date_get_year (end_date); end_month = g_date_get_month (end_date) - 1; end_day = g_date_get_day (end_date); - + need_update = e_calendar_item_ensure_days_visible (calitem, start_year, start_month, @@ -2788,11 +2788,9 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, ¤t_end_month); /* Try to ensure that the end month is shown. */ - if (end_year > current_end_year - || (end_year == current_end_year - && end_month > current_end_month)) { - - /* First we see if the end of the selection will fit in the + if ((end_year == current_end_year + 1 && current_end_month == 11 && end_month == 0) || + (end_year == current_end_year && end_month == current_end_month + 1)) { + /* 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, @@ -2802,7 +2800,7 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, &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; @@ -2812,7 +2810,19 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, } else { calitem->month -= (months_shown - 1); } - + + e_calendar_item_normalize_date (calitem, &calitem->year, + &calitem->month); + } + else if (end_year > current_end_year || + (end_year == current_end_year && end_month > current_end_month)) { + /* The selection will definitely not fit in the leftover days + * of the month after the last one shown. */ + need_update = TRUE; + + calitem->year = end_year; + calitem->month = end_month - months_shown + 1; + e_calendar_item_normalize_date (calitem, &calitem->year, &calitem->month); } |