diff --git a/src/gui/views/gcal-month-view-row.c b/src/gui/views/gcal-month-view-row.c index 6b85139f..64456b26 100644 --- a/src/gui/views/gcal-month-view-row.c +++ b/src/gui/views/gcal-month-view-row.c @@ -721,3 +721,28 @@ gcal_month_view_row_remove_event (GcalMonthViewRow *self, GCAL_EXIT; } + +void +gcal_month_view_row_update_style_for_date (GcalMonthViewRow *self, + GDateTime *date) +{ + g_autoptr (GDateTime) range_start = NULL; + + g_assert (GCAL_IS_MONTH_VIEW_ROW (self)); + g_assert (date != NULL); + g_assert (self->range != NULL); + + range_start = gcal_range_get_start (self->range); + + for (guint i = 0; i < 7; i++) + { + g_autoptr (GDateTime) cell_date = NULL; + gboolean different_month; + + cell_date = g_date_time_add_days (range_start, i); + different_month = g_date_time_get_year (cell_date) != g_date_time_get_year (date) || + g_date_time_get_month (cell_date) != g_date_time_get_month (date); + + gcal_month_cell_set_different_month (GCAL_MONTH_CELL (self->day_cells[i]), different_month); + } +} diff --git a/src/gui/views/gcal-month-view-row.h b/src/gui/views/gcal-month-view-row.h index 1852f791..8b8ec4df 100644 --- a/src/gui/views/gcal-month-view-row.h +++ b/src/gui/views/gcal-month-view-row.h @@ -50,4 +50,7 @@ void gcal_month_view_row_add_event (GcalMonthViewR void gcal_month_view_row_remove_event (GcalMonthViewRow *self, GcalEvent *event); +void gcal_month_view_row_update_style_for_date (GcalMonthViewRow *self, + GDateTime *date); + G_END_DECLS diff --git a/src/gui/views/gcal-month-view.c b/src/gui/views/gcal-month-view.c index de8719c3..0642e136 100644 --- a/src/gui/views/gcal-month-view.c +++ b/src/gui/views/gcal-month-view.c @@ -320,6 +320,12 @@ update_week_ranges (GcalMonthView *self, } } + for (gint i = 0; i < self->week_rows->len; i++) + { + GcalMonthViewRow *row = g_ptr_array_index (self->week_rows, i); + gcal_month_view_row_update_style_for_date (row, new_date); + } + dump_row_ranges (self); }