From b775256ef8a8ce053737a528794a5c9f73a920f3 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 4 Aug 2023 10:04:09 -0300 Subject: [PATCH] views/month-cell: Use GtkInscription It allows us to change text without causing a relayout. This will be important later. --- src/gui/views/gcal-month-cell.c | 8 ++++---- src/gui/views/gcal-month-cell.ui | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/views/gcal-month-cell.c b/src/gui/views/gcal-month-cell.c index 1e9e5005..2aaba8dd 100644 --- a/src/gui/views/gcal-month-cell.c +++ b/src/gui/views/gcal-month-cell.c @@ -40,7 +40,7 @@ struct _GcalMonthCell GtkLabel *temp_label; GtkWidget *overflow_button; - GtkWidget *overflow_label; + GtkInscription *overflow_inscription; GtkWidget *overlay; gboolean different_month; @@ -322,7 +322,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, day_label); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, header_box); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_button); - gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_label); + gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_inscription); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overlay); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, temp_label); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, weather_icon); @@ -488,7 +488,7 @@ gcal_month_cell_set_overflow (GcalMonthCell *self, g_return_if_fail (GCAL_IS_MONTH_CELL (self)); - gtk_widget_set_visible (self->overflow_label, n_overflow > 0); + gtk_widget_set_child_visible (GTK_WIDGET (self->overflow_inscription), n_overflow > 0); gtk_widget_set_sensitive (self->overflow_button, n_overflow > 0); if (self->n_overflow == n_overflow) @@ -497,7 +497,7 @@ gcal_month_cell_set_overflow (GcalMonthCell *self, self->n_overflow = n_overflow; text = g_strdup_printf ("+%d", n_overflow); - gtk_label_set_text (GTK_LABEL (self->overflow_label), text); + gtk_inscription_set_text (self->overflow_inscription, text); } gint diff --git a/src/gui/views/gcal-month-cell.ui b/src/gui/views/gcal-month-cell.ui index 46291a2c..e108cd35 100644 --- a/src/gui/views/gcal-month-cell.ui +++ b/src/gui/views/gcal-month-cell.ui @@ -54,8 +54,8 @@ - - end + + ellipsize-end