[gnome-calendar] date-chooser-day: Add .non-workday class to the current day



commit 54e0a5784ca2d4b1a05cb3261a39332fe93e1da7
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Apr 7 08:55:16 2022 +0200

    date-chooser-day: Add .non-workday class to the current day
    
    This will help making the non worked days let prominent.

 src/gui/event-editor/gcal-date-chooser-day.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/gui/event-editor/gcal-date-chooser-day.c b/src/gui/event-editor/gcal-date-chooser-day.c
index d5ce3570..559daeec 100644
--- a/src/gui/event-editor/gcal-date-chooser-day.c
+++ b/src/gui/event-editor/gcal-date-chooser-day.c
@@ -23,6 +23,7 @@
 
 #include "gcal-date-chooser-day.h"
 #include "gcal-date-time-utils.h"
+#include "gcal-utils.h"
 
 #include <stdlib.h>
 #include <langinfo.h>
@@ -171,18 +172,27 @@ gcal_date_chooser_day_set_date (GcalDateChooserDay *self,
   g_autoptr (GDateTime) now = NULL;
   g_autofree gchar *text = NULL;
   gboolean today;
+  gint weekday;
+
+  g_assert (date != NULL);
 
   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;
+  weekday = g_date_time_get_day_of_week (date) % 7;
 
   if (G_UNLIKELY (today))
     gtk_widget_add_css_class (widget, "today");
   else
     gtk_widget_remove_css_class (widget, "today");
 
+  if (G_LIKELY (is_workday (weekday)))
+    gtk_widget_remove_css_class (widget, "non-workday");
+  else
+    gtk_widget_add_css_class (widget, "non-workday");
+
   text = g_strdup_printf ("%d", g_date_time_get_day_of_month (date));
   gtk_label_set_label (GTK_LABEL (self->label), text);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]