[gtk+] Add _gtk_box_get_children() internal function
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add _gtk_box_get_children() internal function
- Date: Thu, 5 Aug 2010 07:51:56 +0000 (UTC)
commit 76267f9d0621c07b13e56f6ffd93e942111dfbcf
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Mon Jul 26 15:24:15 2010 +0200
Add _gtk_box_get_children() internal function
https://bugzilla.gnome.org/show_bug.cgi?id=625300
gtk/gtkbbox.c | 4 ++--
gtk/gtkbox.c | 24 ++++++++++++++++++++++++
gtk/gtkbox.h | 1 +
gtk/gtkstatusbar.c | 10 +++++++---
4 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 582e447..1720d72 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -457,7 +457,7 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
nchildren = 0;
nsecondaries = 0;
- list = children = gtk_container_get_children (GTK_CONTAINER (bbox));
+ list = children = _gtk_box_get_children (GTK_BOX (bbox));
needed_width = child_min_width;
needed_height = child_min_height;
ipad_w = ipad_x * 2;
@@ -790,7 +790,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
childspace = child_height + childspacing;
}
- list = children = gtk_container_get_children (GTK_CONTAINER (box));
+ list = children = _gtk_box_get_children (GTK_BOX (box));
while (children)
{
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index c372a1d..84c28de 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -1770,3 +1770,27 @@ gtk_box_forall (GtkContainer *container,
(* callback) (child->widget, callback_data);
}
}
+
+GList *
+_gtk_box_get_children (GtkBox *box)
+{
+ GtkBoxPriv *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);
+}
diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h
index 0a17af2..85a2f4a 100644
--- a/gtk/gtkbox.h
+++ b/gtk/gtkbox.h
@@ -109,6 +109,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);
G_END_DECLS
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index f6972f9..ded0620 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -1034,13 +1034,14 @@ has_extra_children (GtkStatusbar *statusbar)
GtkPackType child_pack_type, frame_pack_type;
GtkWidget *child, *frame;
GList *l, *children;
+ gboolean retval = FALSE;
/* If the internal frame has been modified assume we have extra children */
if (gtk_bin_get_child (GTK_BIN (priv->frame)) != priv->label)
return TRUE;
frame = NULL;
- children = gtk_container_get_children (GTK_CONTAINER (statusbar));
+ children = _gtk_box_get_children (GTK_BOX (statusbar));
for (l = children; l; l = l->next)
{
frame = l->data;
@@ -1063,12 +1064,15 @@ has_extra_children (GtkStatusbar *statusbar)
NULL, NULL, NULL, &child_pack_type);
if (frame_pack_type == GTK_PACK_START || child_pack_type == GTK_PACK_END)
- return TRUE;
+ {
+ retval = TRUE;
+ break;
+ }
}
g_list_free (children);
- return FALSE;
+ return retval;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]