[gtk+] Silently allow child properties on grandchildren



commit e244e5050ba35dad67b96ad2e143022b49fd7d51
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 26 12:26:51 2011 -0400

    Silently allow child properties on grandchildren
    
    This commit simply removes some child->parent == container checks,
    to add some flexibility for containers with 'inner structure'.
    If these checks are considered useful, we can bring them back
    with a is_child vfunc that allows container implementations to
    decided who they consider legitimate child.

 gtk/gtkcontainer.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 4b6c584..50a4514 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -893,7 +893,6 @@ gtk_container_child_get_valist (GtkContainer *container,
 
   g_return_if_fail (GTK_IS_CONTAINER (container));
   g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
 
   g_object_ref (container);
   g_object_ref (child);
@@ -962,7 +961,6 @@ gtk_container_child_get_property (GtkContainer *container,
 
   g_return_if_fail (GTK_IS_CONTAINER (container));
   g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
   g_return_if_fail (property_name != NULL);
   g_return_if_fail (G_IS_VALUE (value));
 
@@ -1038,7 +1036,6 @@ gtk_container_child_set_valist (GtkContainer *container,
 
   g_return_if_fail (GTK_IS_CONTAINER (container));
   g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
 
   g_object_ref (container);
   g_object_ref (child);
@@ -1112,7 +1109,6 @@ gtk_container_child_set_property (GtkContainer *container,
 
   g_return_if_fail (GTK_IS_CONTAINER (container));
   g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
   g_return_if_fail (property_name != NULL);
   g_return_if_fail (G_IS_VALUE (value));
 
@@ -1151,7 +1147,7 @@ gtk_container_child_set_property (GtkContainer *container,
  *
  * Adds @widget to @container, setting child properties at the same time.
  * See gtk_container_add() and gtk_container_child_set() for more details.
- **/
+ */
 void
 gtk_container_add_with_properties (GtkContainer *container,
                                    GtkWidget    *widget,
@@ -1190,7 +1186,7 @@ gtk_container_add_with_properties (GtkContainer *container,
  *           with @first_prop_name
  *
  * Sets one or more child properties for @child and @container.
- **/
+ */
 void
 gtk_container_child_set (GtkContainer      *container,
                          GtkWidget         *child,
@@ -1199,10 +1195,6 @@ gtk_container_child_set (GtkContainer      *container,
 {
   va_list var_args;
 
-  g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
-
   va_start (var_args, first_prop_name);
   gtk_container_child_set_valist (container, child, first_prop_name, var_args);
   va_end (var_args);
@@ -1226,10 +1218,6 @@ gtk_container_child_get (GtkContainer      *container,
 {
   va_list var_args;
 
-  g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));
-
   va_start (var_args, first_prop_name);
   gtk_container_child_get_valist (container, child, first_prop_name, var_args);
   va_end (var_args);



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