From b5ad14926119a64447107e7ab66d2ff45a6ba8ae Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 11 Nov 2017 18:08:57 -0200 Subject: [PATCH] month-cell: improve calculation of header box height Should also consider the top and bottom margins. --- data/ui/month-cell.ui | 2 +- src/views/gcal-month-cell.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/data/ui/month-cell.ui b/data/ui/month-cell.ui index afdcb972..fef72806 100644 --- a/data/ui/month-cell.ui +++ b/data/ui/month-cell.ui @@ -18,7 +18,7 @@ start 6 6 - 3 + 0 True diff --git a/src/views/gcal-month-cell.c b/src/views/gcal-month-cell.c index 5ce2af21..1d90fa9f 100644 --- a/src/views/gcal-month-cell.c +++ b/src/views/gcal-month-cell.c @@ -590,9 +590,21 @@ gcal_month_cell_get_real_height (GcalMonthCell *self) gint 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); - return gtk_widget_get_allocated_height (self->header_box); + context = gtk_widget_get_style_context (GTK_WIDGET (self->header_box)); + gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding); + gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border); + + return gtk_widget_get_allocated_height (self->header_box) + + gtk_widget_get_margin_top (self->header_box) + + gtk_widget_get_margin_bottom (self->header_box) + + padding.top + padding.bottom + + border.top + border.bottom; } gboolean