diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index 9d952ed1..91e9fb1b 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -108,9 +108,6 @@ static void gcal_month_view_forall (GtkContainer *con GtkCallback callback, gpointer callback_data); -static void gcal_month_view_set_date (GcalMonthView *view, - icaltimetype *date); - static gdouble gcal_month_view_get_start_grid_y (GtkWidget *widget); static icaltimetype* gcal_month_view_get_initial_date (GcalView *view); @@ -231,13 +228,17 @@ gcal_month_view_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - g_return_if_fail (GCAL_IS_MONTH_VIEW (object)); + GcalMonthViewPrivate *priv; + + priv = GCAL_MONTH_VIEW (object)->priv; switch (property_id) { case PROP_DATE: - gcal_month_view_set_date (GCAL_MONTH_VIEW (object), - g_value_dup_boxed (value)); + if (priv->date != NULL) + g_free (priv->date); + + priv->date = g_value_dup_boxed (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1082,59 +1083,6 @@ gcal_month_view_forall (GtkContainer *container, } } -static void -gcal_month_view_set_date (GcalMonthView *view, - icaltimetype *date) -{ - GcalMonthViewPrivate *priv; - gboolean will_resize; - icaltimetype *first_of_month; - - gint i; - GList *l; - GList *to_remove; - - priv = view->priv; - will_resize = FALSE; - - /* if span_updated: queue_resize */ - will_resize = ! gcal_month_view_draw_event (GCAL_VIEW (view), date, NULL); - - if (priv->date != NULL) - g_free (priv->date); - - priv->date = date; - - first_of_month = gcal_dup_icaltime (priv->date); - first_of_month->day = 1; - priv->days_delay = icaltime_day_of_week (*first_of_month) - 1; - g_free (first_of_month); - - if (will_resize) - { - to_remove = NULL; - - for (i = 0; i < 31; i++) - { - for (l = priv->days[i]; l != NULL; l = l->next) - { - GcalViewChild *child; - icaltimetype *child_date; - - child = (GcalViewChild*) l->data; - child_date = - gcal_event_widget_get_date (GCAL_EVENT_WIDGET (child->widget)); - if (! gcal_month_view_draw_event (GCAL_VIEW (view), child_date, NULL)) - to_remove = g_list_append (to_remove, child->widget); - } - } - g_list_foreach (to_remove, (GFunc) gtk_widget_destroy, NULL); - - gtk_widget_queue_resize (GTK_WIDGET (view)); - gtk_widget_queue_draw (GTK_WIDGET (view)); - } -} - static gdouble gcal_month_view_get_start_grid_y (GtkWidget *widget) { diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c index 1abdbb3f..6e88abf6 100644 --- a/src/gcal-year-view.c +++ b/src/gcal-year-view.c @@ -103,9 +103,6 @@ static void gcal_year_view_forall (GtkContainer GtkCallback callback, gpointer callback_data); -static void gcal_year_view_set_date (GcalYearView *view, - icaltimetype *date); - static void gcal_year_view_draw_grid (GcalYearView *view, cairo_t *cr, GtkAllocation *alloc, @@ -227,13 +224,17 @@ gcal_year_view_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - g_return_if_fail (GCAL_IS_YEAR_VIEW (object)); + GcalYearViewPrivate *priv; + + priv = GCAL_YEAR_VIEW (object)->priv; switch (property_id) { case PROP_DATE: - gcal_year_view_set_date (GCAL_YEAR_VIEW (object), - g_value_dup_boxed (value)); + if (priv->date != NULL) + g_free (priv->date); + + priv->date = g_value_dup_boxed (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -743,53 +744,6 @@ gcal_year_view_forall (GtkContainer *container, } } -static void -gcal_year_view_set_date (GcalYearView *view, - icaltimetype *date) -{ - GcalYearViewPrivate *priv; - gboolean will_resize; - - gint i; - GList *l; - GList *to_remove; - - priv = view->priv; - will_resize = FALSE; - - /* if span_updated: queue_resize */ - will_resize = ! gcal_year_view_draw_event (GCAL_VIEW (view), date, NULL); - - if (priv->date != NULL) - g_free (priv->date); - - priv->date = date; - - if (will_resize) - { - to_remove = NULL; - - for (i = 0; i < 12; i++) - { - for (l = priv->months[i]; l != NULL; l = l->next) - { - GcalViewChild *child; - icaltimetype *child_date; - - child = (GcalViewChild*) l->data; - child_date = - gcal_event_widget_get_date (GCAL_EVENT_WIDGET (child->widget)); - if (! gcal_year_view_draw_event (GCAL_VIEW (view), child_date, NULL)) - to_remove = g_list_append (to_remove, child->widget); - } - } - g_list_foreach (to_remove, (GFunc) gtk_widget_destroy, NULL); - - gtk_widget_queue_resize (GTK_WIDGET (view)); - gtk_widget_queue_draw (GTK_WIDGET (view)); - } -} - static void gcal_year_view_draw_grid (GcalYearView *view, cairo_t *cr,