[gnome-calendar/ui-rewrite] gcal-day-view: implemented GtkContainer:remove



commit 60b566209d5d733c4d5293781b2f2bf8ea6c1680
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Jun 20 10:37:38 2013 -0400

    gcal-day-view: implemented GtkContainer:remove

 src/gcal-day-view.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-day-view.c b/src/gcal-day-view.c
index 9316705..b934af2 100644
--- a/src/gcal-day-view.c
+++ b/src/gcal-day-view.c
@@ -71,6 +71,9 @@ static void           gcal_day_view_get_property          (GObject        *objec
 static void           gcal_day_view_add                   (GtkContainer   *container,
                                                            GtkWidget      *widget);
 
+static void           gcal_day_view_remove                (GtkContainer   *container,
+                                                           GtkWidget      *widget);
+
 static icaltimetype*  gcal_day_view_get_initial_date      (GcalView       *view);
 
 static icaltimetype*  gcal_day_view_get_final_date        (GcalView       *view);
@@ -130,9 +133,8 @@ gcal_day_view_class_init (GcalDayViewClass *klass)
 
   container_class = GTK_CONTAINER_CLASS (klass);
   container_class->add = gcal_day_view_add;
+  container_class->remove = gcal_day_view_remove;
   /* FIXME: Uncomment stuff here */
-  /* container_class->remove = gcal_day_view_remove; */
-  /* container_class->forall = gcal_day_view_forall; */
   /* gtk_container_class_handle_border_width (container_class); */
 
   g_object_class_override_property (object_class, PROP_DATE, "active-date");
@@ -342,6 +344,26 @@ gcal_day_view_add (GtkContainer *container,
   g_free (summ);
 }
 
+static void
+gcal_day_view_remove (GtkContainer *container,
+                      GtkWidget    *widget)
+{
+  GcalDayViewPrivate *priv;
+
+  priv = GCAL_DAY_VIEW (container)->priv;
+
+  if (gtk_widget_get_parent (widget) == (GtkWidget*) container)
+    {
+      GTK_CONTAINER_CLASS (gcal_day_view_parent_class)->remove (container,
+                                                                widget);
+    }
+  else
+    {
+      gtk_container_remove (GTK_CONTAINER (priv->all_day_grid), widget);
+      gtk_container_remove (GTK_CONTAINER (priv->day_grid), widget);
+    }
+}
+
 /* GcalView API */
 static icaltimetype*
 gcal_day_view_get_initial_date (GcalView *view)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]