views/month-cell: Use GtkWidget APIs for retrieving margin

GtkStyleContext is deprecated.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/601>
This commit is contained in:
Hari Rana
2025-07-05 18:05:07 -04:00
parent 11ac0e43e8
commit 8dd8538014
+2 -22
View File
@@ -592,40 +592,20 @@ gcal_month_cell_set_overflow (GcalMonthCell *self,
gint gint
gcal_month_cell_get_content_space (GcalMonthCell *self) gcal_month_cell_get_content_space (GcalMonthCell *self)
{ {
GtkStyleContext *context;
GtkBorder padding;
GtkBorder border;
g_return_val_if_fail (GCAL_IS_MONTH_CELL (self), -1); g_return_val_if_fail (GCAL_IS_MONTH_CELL (self), -1);
context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_get_padding (context, &padding);
gtk_style_context_get_border (context, &border);
return gtk_widget_get_height (GTK_WIDGET (self)) - return gtk_widget_get_height (GTK_WIDGET (self)) -
gcal_month_cell_get_header_height (self) - gcal_month_cell_get_header_height (self);
padding.top - padding.bottom -
border.top - border.bottom;
} }
gint gint
gcal_month_cell_get_header_height (GcalMonthCell *self) gcal_month_cell_get_header_height (GcalMonthCell *self)
{ {
GtkStyleContext *context;
GtkBorder padding;
GtkBorder border;
g_return_val_if_fail (GCAL_IS_MONTH_CELL (self), -1); g_return_val_if_fail (GCAL_IS_MONTH_CELL (self), -1);
context = gtk_widget_get_style_context (GTK_WIDGET (self->header_box));
gtk_style_context_get_padding (context, &padding);
gtk_style_context_get_border (context, &border);
return gtk_widget_get_height (self->header_box) + return gtk_widget_get_height (self->header_box) +
gtk_widget_get_margin_top (self->header_box) + gtk_widget_get_margin_top (self->header_box) +
gtk_widget_get_margin_bottom (self->header_box) + gtk_widget_get_margin_bottom (self->header_box);
padding.top + padding.bottom +
border.top + border.bottom;
} }
gint gint