[evolution/gnome-3-18] Bug 760638 - Month view loses weeks when jumping through months
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-18] Bug 760638 - Month view loses weeks when jumping through months
- Date: Tue, 2 Feb 2016 10:07:56 +0000 (UTC)
commit c2727d30d72b3dbbcfd6db5553a8fcdce38e1141
Author: Milan Crha <mcrha redhat com>
Date: Tue Feb 2 11:04:47 2016 +0100
Bug 760638 - Month view loses weeks when jumping through months
calendar/gui/e-week-view.c | 14 +++++++++++++-
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 68e9ad8..fa3fbb6 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 0831edc..9d97066 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]