[gnome-calendar] gcal-window: fixed update_view method
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] gcal-window: fixed update_view method
- Date: Thu, 4 Dec 2014 22:24:59 +0000 (UTC)
commit b54ac5510b6710b722f4116fd07b8b3e66a46553
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Wed Jun 19 16:05:07 2013 -0400
gcal-window: fixed update_view method
Used new GcalView:clear to destroy all the event-widget children of a view
src/gcal-day-view.c | 16 ++++++++++++++++
src/gcal-window.c | 3 +--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-day-view.c b/src/gcal-day-view.c
index 9b098de..9316705 100644
--- a/src/gcal-day-view.c
+++ b/src/gcal-day-view.c
@@ -86,6 +86,8 @@ static gboolean gcal_day_view_draw_event (GcalView *view,
static GtkWidget* gcal_day_view_get_by_uuid (GcalView *view,
const gchar *uuid);
+static void gcal_day_view_clear (GcalView *view);
+
G_DEFINE_TYPE_WITH_CODE (GcalDayView,
gcal_day_view,
GTK_TYPE_GRID,
@@ -161,6 +163,7 @@ gcal_view_interface_init (GcalViewIface *iface)
iface->draw_event = gcal_day_view_draw_event;
iface->get_by_uuid = gcal_day_view_get_by_uuid;
+ iface->clear = gcal_day_view_clear;
}
static void
@@ -463,6 +466,19 @@ gcal_day_view_get_by_uuid (GcalView *view,
return NULL;
}
+static void
+gcal_day_view_clear (GcalView *view)
+{
+ GcalDayViewPrivate *priv;
+
+ priv = GCAL_DAY_VIEW (view)->priv;
+
+ gtk_container_foreach (GTK_CONTAINER (priv->all_day_grid),
+ (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_container_foreach (GTK_CONTAINER (priv->day_grid),
+ (GtkCallback) gtk_widget_destroy, NULL);
+}
+
/* Public API */
/**
* gcal_day_view_new:
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 083fd45..27ce7a2 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -230,8 +230,7 @@ update_view (GcalWindow *window)
widget = priv->views[priv->active_view];
/* destroying old children */
- /* gtk_container_foreach (GTK_CONTAINER (widget), */
- /* (GtkCallback) gtk_widget_destroy, NULL); */
+ gcal_view_clear (GCAL_VIEW (widget));
first_day = gcal_view_get_initial_date (GCAL_VIEW (widget));
last_day = gcal_view_get_final_date (GCAL_VIEW (widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]