diff --git a/src/gui/views/gcal-month-cell.c b/src/gui/views/gcal-month-cell.c index 15be47ba..fca3e87f 100644 --- a/src/gui/views/gcal-month-cell.c +++ b/src/gui/views/gcal-month-cell.c @@ -36,6 +36,7 @@ struct _GcalMonthCell GtkLabel *day_label; GtkWidget *header_box; + GtkLabel *month_name_label; GtkImage *weather_icon; GtkLabel *temp_label; @@ -321,6 +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, month_name_label); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_button); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overflow_inscription); gtk_widget_class_bind_template_child (widget_class, GcalMonthCell, overlay); @@ -365,6 +367,7 @@ gcal_month_cell_set_date (GcalMonthCell *self, GDateTime *date) { g_autofree gchar *text = NULL; + gint day_of_month; g_return_if_fail (GCAL_IS_MONTH_CELL (self)); @@ -379,6 +382,15 @@ gcal_month_cell_set_date (GcalMonthCell *self, gtk_label_set_text (self->day_label, text); update_style_flags (self); + + /* Month name */ + day_of_month = g_date_time_get_day_of_month (date); + gtk_widget_set_visible (GTK_WIDGET (self->month_name_label), day_of_month == 1); + if (g_date_time_get_day_of_month (date) == 1) + { + g_autofree gchar *month_name = g_date_time_format (date, "%b"); + gtk_label_set_text (self->month_name_label, month_name); + } } /** diff --git a/src/gui/views/gcal-month-cell.ui b/src/gui/views/gcal-month-cell.ui index 4b6096fd..f5a90466 100644 --- a/src/gui/views/gcal-month-cell.ui +++ b/src/gui/views/gcal-month-cell.ui @@ -24,6 +24,10 @@ + + + +