[gtk+] Revert "Remove _gtk_box_get_children"



commit 170cb016759c4a949c7cd81291da498395f18fb3
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Feb 12 13:21:14 2016 +0100

    Revert "Remove _gtk_box_get_children"
    
    This reverts commit 572e9a04027e213082a5b257e5d662a5daa32667.
    
    _gtk_box_get_children was not doing exactly the same than
    gtk_container_get_children does, because the latter uses the forall
    implementation of GtkBox that takes into account the children pack mode while
    the former just iterated the list of children. This broke the order of
    the buttons in a GtkButtonBox when they were packaged with PACK_END.

 gtk/gtkbbox.c       |    4 ++--
 gtk/gtkbox.c        |   24 ++++++++++++++++++++++++
 gtk/gtkboxprivate.h |    1 +
 3 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index a492a19..ab67237 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -631,7 +631,7 @@ gtk_button_box_child_requisition (GtkWidget  *widget,
 
   nchildren = 0;
   nsecondaries = 0;
-  list = children = gtk_container_get_children (GTK_CONTAINER (widget));
+  list = children = _gtk_box_get_children (GTK_BOX (bbox));
   needed_width = child_min_width;
   needed_height = child_min_height;
   needed_above = 0;
@@ -1123,7 +1123,7 @@ gtk_button_box_allocate (GtkCssGadget        *gadget,
     sizes = heights;
 
   i = 0;
-  list = children = gtk_container_get_children (GTK_CONTAINER (widget));
+  list = children = _gtk_box_get_children (GTK_BOX (widget));
   while (children)
     {
       GtkWidget *child;
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index d1a6ede..d0e9d3d 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -2674,6 +2674,30 @@ gtk_box_forall (GtkContainer *container,
     }
 }
 
+GList *
+_gtk_box_get_children (GtkBox *box)
+{
+  GtkBoxPrivate *priv;
+  GtkBoxChild *child;
+  GList *children;
+  GList *retval = NULL;
+
+  g_return_val_if_fail (GTK_IS_BOX (box), NULL);
+
+  priv = box->priv;
+
+  children = priv->children;
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      retval = g_list_prepend (retval, child->widget);
+    }
+
+  return g_list_reverse (retval);
+}
+
 /**
  * gtk_box_set_center_widget:
  * @box: a #GtkBox
diff --git a/gtk/gtkboxprivate.h b/gtk/gtkboxprivate.h
index 08f8f32..cd99758 100644
--- a/gtk/gtkboxprivate.h
+++ b/gtk/gtkboxprivate.h
@@ -29,6 +29,7 @@ void        _gtk_box_set_old_defaults   (GtkBox         *box);
 gboolean    _gtk_box_get_spacing_set    (GtkBox         *box);
 void        _gtk_box_set_spacing_set    (GtkBox         *box,
                                          gboolean        spacing_set);
+GList      *_gtk_box_get_children       (GtkBox         *box);
 
 GtkCssGadget *gtk_box_get_gadget (GtkBox *box);
 


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