[evolution] I#599 - Calendar List view changes selected day



commit b6c973fb0ef49843c59fd78dee3cd7641751c29c
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 19 14:44:46 2020 +0100

    I#599 - Calendar List view changes selected day
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/599

 src/modules/calendar/e-cal-shell-content.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index e2ed40cff8..4a986d46df 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -684,9 +684,13 @@ cal_shell_content_current_view_id_changed_cb (ECalShellContent *cal_shell_conten
                case E_CAL_VIEW_KIND_MONTH:
                case E_CAL_VIEW_KIND_LIST:
                        if (!calendar_config_get_month_start_with_current_week ()) {
-                               if (g_date_get_day (&sel_start) != 1 &&
-                                   (g_date_get_julian (&sel_end) - g_date_get_julian (&sel_start) + 1) / 7 
= 3 &&
-                                   g_date_get_month (&sel_start) != g_date_get_month (&sel_end)) {
+                               if (g_date_get_days_in_month (g_date_get_month (&sel_start), g_date_get_year 
(&sel_start)) - g_date_get_day (&sel_start) <= 7) {
+                                       /* Keep the sel_start unchanged, because it's within the last week of 
the month,
+                                          which can be covered by the mini-calendar. Setting to the first 
day of the month
+                                          may mean the mini-calendar would go back by one month. */
+                               } else if (g_date_get_day (&sel_start) != 1 &&
+                                          (g_date_get_julian (&sel_end) - g_date_get_julian (&sel_start) + 
1) / 7 >= 3 &&
+                                          g_date_get_month (&sel_start) != g_date_get_month (&sel_end)) {
                                        g_date_set_day (&sel_start, 1);
                                        g_date_add_months (&sel_start, 1);
                                } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]