[gnome-calendar] date-chooser-day: Add the .today style class to the current day
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] date-chooser-day: Add the .today style class to the current day
- Date: Thu, 16 Jun 2022 11:44:37 +0000 (UTC)
commit 21895416f38871bec43c2ea4a173d6bdd19c0c91
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Apr 7 08:51:22 2022 +0200
date-chooser-day: Add the .today style class to the current day
This will help making the current day pop out a bit.
src/gui/event-editor/gcal-date-chooser-day.c | 12 ++++++++++++
src/theme/Adwaita.css | 17 +++++++++++++++++
2 files changed, 29 insertions(+)
---
diff --git a/src/gui/event-editor/gcal-date-chooser-day.c b/src/gui/event-editor/gcal-date-chooser-day.c
index f7c04cf2..d5ce3570 100644
--- a/src/gui/event-editor/gcal-date-chooser-day.c
+++ b/src/gui/event-editor/gcal-date-chooser-day.c
@@ -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);
}
diff --git a/src/theme/Adwaita.css b/src/theme/Adwaita.css
index 59094207..7ea1eb3e 100644
--- a/src/theme/Adwaita.css
+++ b/src/theme/Adwaita.css
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]