week-view: fix active and current date handling

The active date is the visible date, while the current date
is today. We shouldn't confuse those two.
This commit is contained in:
Georges Basile Stavracas Neto
2016-12-08 14:18:37 -02:00
parent 6fc89fb626
commit 74ac2d83ee
2 changed files with 4 additions and 6 deletions
+1
View File
@@ -857,6 +857,7 @@ gcal_week_header_finalize (GObject *object)
GcalWeekHeader *self = GCAL_WEEK_HEADER (object); GcalWeekHeader *self = GCAL_WEEK_HEADER (object);
gint i; gint i;
g_clear_pointer (&self->active_date, g_free);
g_clear_pointer (&self->current_date, g_free); g_clear_pointer (&self->current_date, g_free);
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
+3 -6
View File
@@ -456,7 +456,8 @@ gcal_week_view_set_property (GObject *object,
{ {
case PROP_DATE: case PROP_DATE:
{ {
gcal_week_view_set_current_date (self, g_value_dup_boxed (value)); g_clear_pointer (&self->date, g_free);
self->date = g_value_dup_boxed (value);
break; break;
} }
@@ -552,12 +553,8 @@ gcal_week_view_set_current_date (GcalWeekView *self,
g_return_if_fail (GCAL_IS_WEEK_VIEW (self)); g_return_if_fail (GCAL_IS_WEEK_VIEW (self));
g_clear_pointer (&self->current_date, g_free); g_clear_pointer (&self->current_date, g_free);
self->date = current_date; self->current_date = current_date;
gcal_week_header_set_current_date (GCAL_WEEK_HEADER (self->header), current_date); gcal_week_header_set_current_date (GCAL_WEEK_HEADER (self->header), current_date);
gcal_week_grid_set_current_date (GCAL_WEEK_GRID (self->week_grid), current_date); gcal_week_grid_set_current_date (GCAL_WEEK_GRID (self->week_grid), current_date);
self->current_date = current_date;
g_object_notify (G_OBJECT (self), "active-date");
} }