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
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
14dc32891b
commit
c49dae00bc
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user