diff --git a/src/gui/views/gcal-month-view.c b/src/gui/views/gcal-month-view.c index f6afb6f29a1df8d80efa1b8eab83e42c635793cd..b0b2e19770742a8007476658184e8268c1ff41ae 100644 --- a/src/gui/views/gcal-month-view.c +++ b/src/gui/views/gcal-month-view.c @@ -424,41 +424,6 @@ update_week_ranges (GcalMonthView *self, dump_row_ranges (self); } -static void -update_row_visuals (GcalMonthView *self) -{ - g_autoptr (GcalRange) first_visible_row_range = NULL; - g_autoptr (GcalRange) last_visible_row_range = NULL; - g_autoptr (GcalRange) union_range = NULL; - g_autoptr (GDateTime) start = NULL; - g_autoptr (GDateTime) middle = NULL; - g_autoptr (GDateTime) end = NULL; - GcalMonthViewRow *first_visible_row; - GcalMonthViewRow *last_visible_row; - - first_visible_row = g_ptr_array_index (self->week_rows, FIRST_VISIBLE_ROW_INDEX); - first_visible_row_range = gcal_month_view_row_get_range (first_visible_row); - - last_visible_row = g_ptr_array_index (self->week_rows, LAST_VISIBLE_ROW_INDEX); - last_visible_row_range = gcal_month_view_row_get_range (last_visible_row); - - union_range = gcal_range_union (first_visible_row_range, last_visible_row_range); - start = gcal_range_get_start (union_range); - end = gcal_range_get_end (union_range); - middle = g_date_time_add_days (start, gcal_date_time_compare_date (end, start) / 2); - - for (gint i = 0; i < self->week_rows->len; i++) - { - GcalMonthViewRow *row; - gboolean can_focus; - - row = g_ptr_array_index (self->week_rows, i); - can_focus = i >= FIRST_VISIBLE_ROW_INDEX && i <= LAST_VISIBLE_ROW_INDEX; - - gtk_widget_set_can_focus (GTK_WIDGET (row), can_focus); - } -} - static inline gint get_grid_height (GcalMonthView *self) { @@ -1198,7 +1163,6 @@ gcal_month_view_set_date (GcalView *view, #endif update_week_ranges (self, date); - update_row_visuals (self); gcal_timeline_subscriber_range_changed (GCAL_TIMELINE_SUBSCRIBER (view)); @@ -1445,6 +1409,7 @@ gcal_month_view_size_allocate (GtkWidget *widget, { GtkAllocation row_allocation; GtkWidget *row; + gboolean child_visible; row = g_ptr_array_index (self->week_rows, i); @@ -1457,6 +1422,9 @@ gcal_month_view_size_allocate (GtkWidget *widget, #undef ROW_Y + child_visible = (row_allocation.y + row_allocation.height > header_height) && row_allocation.y < height; + gtk_widget_set_child_visible (row, child_visible); + gtk_widget_size_allocate (row, &row_allocation, baseline); }