[gtk+/wip/baedert/drawing: 188/359] box: Use widget children list in count_expand_children



commit 86aff7364f873bebfa930f1121f7beb7e52e4f6a
Author: Timm Bäder <mail baedert org>
Date:   Tue May 23 15:05:32 2017 +0200

    box: Use widget children list in count_expand_children
    
    It's still less dereferencing than the previous code.

 gtk/gtkbox.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index ec21d97..312f535 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -332,21 +332,21 @@ count_expand_children (GtkBox *box,
                        gint *expand_children)
 {
   GtkBoxPrivate  *private = box->priv;
-  GList       *children;
-  GtkBoxChild *child;
+  GtkWidget *child;
 
   *visible_children = *expand_children = 0;
 
-  for (children = private->children; children; children = children->next)
+  for (child = _gtk_widget_get_first_child (GTK_WIDGET (box));
+       child != NULL;
+       child = _gtk_widget_get_next_sibling (child))
     {
-      child = children->data;
+      if (_gtk_widget_get_visible (child))
+        {
+          *visible_children += 1;
 
-      if (_gtk_widget_get_visible (child->widget))
-       {
-         *visible_children += 1;
-          if (gtk_widget_compute_expand (child->widget, private->orientation))
-           *expand_children += 1;
-       }
+          if (gtk_widget_compute_expand (child, private->orientation))
+            *expand_children += 1;
+        }
     }
 }
 


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