From c49dae00bcd2585fab4c0739ba7988997662ac94 Mon Sep 17 00:00:00 2001 From: Monique Faria Date: Sat, 12 Mar 2016 00:00:21 -0300 Subject: [PATCH] event-widget: fade out past events When an event is earlier than the current date, it gets faded out. Every event from the same calendar showed the same shade of color, either it was an old, current or forward event. That could be tricky for the user to identify which ones were already over. Now, events that are earlier thant the current date are half transparent to allow the user to easily track where the current date/time is. https://bugzilla.gnome.org/show_bug.cgi?id=746267 --- src/gcal-event-widget.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c index 06185308..e4227134 100644 --- a/src/gcal-event-widget.c +++ b/src/gcal-event-widget.c @@ -102,9 +102,16 @@ update_color (GcalEventWidget *self) GQuark color_id; gchar *color_str; gchar *css_class; + GDateTime *now; + gboolean date_compare; context = gtk_widget_get_style_context (GTK_WIDGET (self)); color = gcal_event_get_color (self->event); + now = g_date_time_new_now_local (); + date_compare = g_date_time_compare (self->dt_end, now); + + /* Fades out an event that's earlier than the current date */ + gtk_widget_set_opacity (GTK_WIDGET (self), date_compare < 0 ? 0.6 : 1.0); /* Remove the old style class */ if (self->css_class) @@ -133,6 +140,7 @@ update_color (GcalEventWidget *self) /* Keep the current style around, so we can remove it later */ self->css_class = css_class; + g_clear_pointer (&now, g_date_time_unref); g_free (color_str); }