date-chooser-day: Add the .today style class to the current day

This will help making the current day pop out a bit.
This commit is contained in:
Adrien Plazas
2022-06-16 08:14:54 -03:00
committed by Georges Basile Stavracas Neto
parent d76617f809
commit 21895416f3
2 changed files with 29 additions and 0 deletions
@@ -22,6 +22,7 @@
#include "config.h"
#include "gcal-date-chooser-day.h"
#include "gcal-date-time-utils.h"
#include <stdlib.h>
#include <langinfo.h>
@@ -166,11 +167,22 @@ void
gcal_date_chooser_day_set_date (GcalDateChooserDay *self,
GDateTime *date)
{
GtkWidget *widget = GTK_WIDGET (self);
g_autoptr (GDateTime) now = NULL;
g_autofree gchar *text = NULL;
gboolean today;
g_clear_pointer (&self->date, g_date_time_unref);
self->date = g_date_time_ref (date);
now = g_date_time_new_now (g_date_time_get_timezone (date));
today = gcal_date_time_compare_date (date, now) == 0;
if (G_UNLIKELY (today))
gtk_widget_add_css_class (widget, "today");
else
gtk_widget_remove_css_class (widget, "today");
text = g_strdup_printf ("%d", g_date_time_get_day_of_month (date));
gtk_label_set_label (GTK_LABEL (self->label), text);
}
+17
View File
@@ -208,6 +208,23 @@ datechooser button.day:selected dot {
background-color: @accent_fg_color;
}
datechooser button.day.today {
color: @accent_color;
}
datechooser button.day.today dot {
background-color: @accent_color;
}
datechooser button.day.today:selected {
background-color: @accent_bg_color;
color: @accent_fg_color;
}
datechooser button.day.today:selected dot {
background-color: @accent_fg_color;
}
datechooser button.day.other-month:not(:hover),
datechooser button.day.other-month:backdrop {
color: alpha(currentColor, 0.1);