diff options
author | Milan Crha <mcrha@redhat.com> | 2016-02-02 11:04:47 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2016-02-02 11:05:51 +0100 |
commit | c2727d30d72b3dbbcfd6db5553a8fcdce38e1141 (patch) | |
tree | 85d096bd6976628a33b92f772b8181fa5e2ea280 | |
parent | 3737b29a2842eb6ffab69b5aab1f2b58d065a73a (diff) | |
download | evolution-c2727d30d72b3dbbcfd6db5553a8fcdce38e1141.tar.gz |
Bug 760638 - Month view loses weeks when jumping through months
-rw-r--r-- | calendar/gui/e-week-view.c | 14 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-content.c | 15 |
2 files changed, 22 insertions, 7 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 68e9ad839f..fa3fbb65ec 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -418,8 +418,20 @@ e_week_view_precalc_visible_time_range (ECalendarView *cal_view, /* See if we need to update the first day shown. */ if (!g_date_valid (&week_view->priv->first_day_shown) || g_date_compare (&week_view->priv->first_day_shown, &base_date)) { + GDate end_date, in_end_date; gint day; + end_date = date; + g_date_add_days (&end_date, num_days); + g_date_subtract_days (&end_date, day_offset); + + time_to_gdate_with_zone (&in_end_date, in_end_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); + + while (g_date_days_between (&end_date, &in_end_date) >= 6) { + g_date_add_days (&end_date, 7); + num_days += 7; + } + in_start_time = time_add_day_with_zone (in_start_time, -((gint) day_offset), zone); in_start_time = time_day_begin_with_zone (in_start_time, zone); @@ -2236,7 +2248,7 @@ e_week_view_recalc_day_starts (EWeekView *week_view, gint num_days, day; time_t tmp_time; - num_days = e_week_view_get_weeks_shown (week_view) * 7; + num_days = E_WEEK_VIEW_MAX_WEEKS * 7; tmp_time = lower; week_view->day_starts[0] = tmp_time; diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 0831edc96b..9d9706682e 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -172,7 +172,6 @@ cal_shell_content_update_model_and_current_view_times (ECalShellContent *cal_she e_cal_shell_content_update_filters (cal_shell_content, cal_filter, visible_range_start, visible_range_end); e_calendar_view_set_selected_time_range (current_view, cmp_range_start, cmp_range_start); filters_updated = TRUE; - view_start_tt = cmp_range_start; view_end_tt = cmp_range_end; } @@ -2050,13 +2049,17 @@ cal_shell_content_move_view_range_relative (ECalShellContent *cal_shell_content, break; case E_CAL_VIEW_KIND_MONTH: case E_CAL_VIEW_KIND_LIST: - if (direction > 0) { + if (g_date_get_day (&start) != 1) { + g_date_add_months (&start, 1); + g_date_set_day (&start, 1); + } + if (direction > 0) g_date_add_months (&start, direction); - g_date_add_months (&end, direction); - } else { + else g_date_subtract_months (&start, direction * -1); - g_date_subtract_months (&end, direction * -1); - } + end = start; + g_date_set_day (&end, g_date_get_days_in_month (g_date_get_month (&start), g_date_get_year (&start))); + g_date_add_days (&end, 6); break; case E_CAL_VIEW_KIND_LAST: return; |