[gnome-calendar] event-widget: fade out past events
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: fade out past events
- Date: Mon, 14 Mar 2016 22:50:33 +0000 (UTC)
commit c49dae00bcd2585fab4c0739ba7988997662ac94
Author: Monique Faria <mnfaria inf ufpel edu br>
Date: Sat Mar 12 00:00:21 2016 -0300
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 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 0618530..e422713 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]