Add _gtk_box_get_children() internal function

https://bugzilla.gnome.org/show_bug.cgi?id=625300
This commit is contained in:
Carlos Garcia Campos 2010-07-26 15:24:15 +02:00
parent dcdb00adb4
commit 76267f9d06
4 changed files with 34 additions and 5 deletions

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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

View File

@ -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