window: update subscriptions after active-date

notification

Some views need to update itself when the dates changes,
e.g. WeekView. This allows to update the state of the view and be ready
properly for the components update.
This commit is contained in:
Erick Pérez Castellanos
2015-02-16 09:31:19 -05:00
parent bd2b6356b1
commit ef774ad2c2
+8 -5
View File
@@ -276,13 +276,18 @@ update_active_date (GcalWindow *window,
time_t range_start, range_end;
icaltimetype date;
icaltimetype *previous_date;
icaltimezone* default_zone;
priv = gcal_window_get_instance_private (window);
default_zone = gcal_manager_get_system_timezone (priv->manager);
previous_date = priv->active_date;
priv->active_date = new_date;
g_object_notify (G_OBJECT (window), "active-date");
/* year_view */
if (priv->active_date->year != new_date->year)
if (previous_date->year != new_date->year)
{
date = *new_date;
date.day = 1;
@@ -303,7 +308,7 @@ update_active_date (GcalWindow *window,
}
/* month_view */
if (priv->active_date->month != new_date->month || priv->active_date->year != new_date->year)
if (previous_date->month != new_date->month || previous_date->year != new_date->year)
{
date = *new_date;
date.day = 1;
@@ -321,8 +326,7 @@ update_active_date (GcalWindow *window,
gcal_manager_set_subscriber (priv->manager, E_CAL_DATA_MODEL_SUBSCRIBER (priv->month_view), range_start, range_end);
}
g_free (priv->active_date);
priv->active_date = new_date;
g_free (previous_date);
}
static gboolean
@@ -391,7 +395,6 @@ date_updated (GtkButton *button,
}
update_active_date (user_data, new_date);
g_object_notify (user_data, "active-date");
}
static void