Use GtkBin accessors

This commit is contained in:
Javier Jardón 2010-05-24 22:31:36 +02:00
parent 2de1f3f88c
commit 4427760bcc
45 changed files with 475 additions and 299 deletions

View File

@ -252,7 +252,7 @@ open_display_cb (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), display_entry); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), display_entry);
gtk_widget_grab_focus (display_entry); gtk_widget_grab_focus (display_entry);
gtk_widget_show_all (GTK_BIN (dialog)->child); gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
while (!result) while (!result)
{ {

View File

@ -435,7 +435,7 @@ do_combobox (GtkWidget *do_widget)
entry = g_object_new (TYPE_MASK_ENTRY, NULL); entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$"; MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
gtk_container_remove (GTK_CONTAINER (combo), GTK_BIN (combo)->child); gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry); gtk_container_add (GTK_CONTAINER (combo), entry);
} }

View File

@ -279,13 +279,15 @@ create_combo_box_entry (void)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkWidget *align; GtkWidget *align;
GtkWidget *child;
gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n" gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n"
" GtkComboBox::appears-as-list = 1\n" " GtkComboBox::appears-as-list = 1\n"
"}\n" "}\n"
"widget_class \"GtkComboBoxEntry\" style \"combo-box-entry-style\"\n" ); "widget_class \"GtkComboBoxEntry\" style \"combo-box-entry-style\"\n" );
widget = gtk_combo_box_entry_new_text (); widget = gtk_combo_box_entry_new_text ();
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (widget)->child), "Combo Box Entry"); child = gtk_bin_get_child (GTK_BIN (widget));
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget); gtk_container_add (GTK_CONTAINER (align), widget);

View File

@ -428,6 +428,8 @@ gtk_alignment_set (GtkAlignment *alignment,
gfloat xscale, gfloat xscale,
gfloat yscale) gfloat yscale)
{ {
GtkWidget *child;
g_return_if_fail (GTK_IS_ALIGNMENT (alignment)); g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
xalign = CLAMP (xalign, 0.0, 1.0); xalign = CLAMP (xalign, 0.0, 1.0);
@ -463,8 +465,9 @@ gtk_alignment_set (GtkAlignment *alignment,
} }
g_object_thaw_notify (G_OBJECT (alignment)); g_object_thaw_notify (G_OBJECT (alignment));
if (GTK_BIN (alignment)->child) child = gtk_bin_get_child (GTK_BIN (alignment));
gtk_widget_queue_resize (GTK_BIN (alignment)->child); if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment)); gtk_widget_queue_draw (GTK_WIDGET (alignment));
} }
} }
@ -477,6 +480,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
GtkAlignment *alignment; GtkAlignment *alignment;
GtkBin *bin; GtkBin *bin;
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkWidget *bin_child;
gint width, height; gint width, height;
guint border_width; guint border_width;
gint padding_horizontal, padding_vertical; gint padding_horizontal, padding_vertical;
@ -488,10 +492,11 @@ gtk_alignment_size_allocate (GtkWidget *widget,
widget->allocation = *allocation; widget->allocation = *allocation;
alignment = GTK_ALIGNMENT (widget); alignment = GTK_ALIGNMENT (widget);
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
if (bin->child && gtk_widget_get_visible (bin->child)) bin_child = gtk_bin_get_child (bin);
if (bin_child && gtk_widget_get_visible (bin_child))
{ {
GtkSizeRequest *child = GTK_SIZE_REQUEST (bin->child); GtkSizeRequest *child = GTK_SIZE_REQUEST (bin_child);
gint child_nat_width; gint child_nat_width;
gint child_nat_height; gint child_nat_height;
gint child_width, child_height; gint child_width, child_height;
@ -547,7 +552,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top; child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (bin_child, &child_allocation);
} }
} }
@ -643,6 +648,7 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
guint padding_right) guint padding_right)
{ {
GtkAlignmentPrivate *priv; GtkAlignmentPrivate *priv;
GtkWidget *child;
g_return_if_fail (GTK_IS_ALIGNMENT (alignment)); g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
@ -674,8 +680,9 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
g_object_thaw_notify (G_OBJECT (alignment)); g_object_thaw_notify (G_OBJECT (alignment));
/* Make sure that the widget and children are redrawn with the new setting: */ /* Make sure that the widget and children are redrawn with the new setting: */
if (GTK_BIN (alignment)->child) child = gtk_bin_get_child (GTK_BIN (alignment));
gtk_widget_queue_resize (GTK_BIN (alignment)->child); if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment)); gtk_widget_queue_draw (GTK_WIDGET (alignment));
} }

View File

@ -336,9 +336,11 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame); GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
GtkAspectFramePriv *priv = aspect_frame->priv; GtkAspectFramePriv *priv = aspect_frame->priv;
GtkBin *bin = GTK_BIN (frame); GtkBin *bin = GTK_BIN (frame);
GtkWidget *child;
gdouble ratio; gdouble ratio;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
GtkAllocation full_allocation; GtkAllocation full_allocation;
@ -346,7 +348,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_get_child_requisition (bin->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
if (child_requisition.height != 0) if (child_requisition.height != 0)
{ {
ratio = ((gdouble) child_requisition.width / ratio = ((gdouble) child_requisition.width /

View File

@ -625,7 +625,7 @@ gtk_button_constructor (GType type,
static GType static GType
gtk_button_child_type (GtkContainer *container) gtk_button_child_type (GtkContainer *container)
{ {
if (!GTK_BIN (container)->child) if (!gtk_bin_get_child (GTK_BIN (container)))
return GTK_TYPE_WIDGET; return GTK_TYPE_WIDGET;
else else
return G_TYPE_NONE; return G_TYPE_NONE;
@ -798,6 +798,7 @@ static void
activatable_update_short_label (GtkButton *button, activatable_update_short_label (GtkButton *button,
GtkAction *action) GtkAction *action)
{ {
GtkWidget *child;
GtkWidget *image; GtkWidget *image;
if (gtk_button_get_use_stock (button)) if (gtk_button_get_use_stock (button))
@ -806,9 +807,10 @@ activatable_update_short_label (GtkButton *button,
image = gtk_button_get_image (button); image = gtk_button_get_image (button);
/* Dont touch custom child... */ /* Dont touch custom child... */
child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_IMAGE (image) || if (GTK_IS_IMAGE (image) ||
GTK_BIN (button)->child == NULL || child == NULL ||
GTK_IS_LABEL (GTK_BIN (button)->child)) GTK_IS_LABEL (child))
{ {
gtk_button_set_label (button, gtk_action_get_short_label (action)); gtk_button_set_label (button, gtk_action_get_short_label (action));
gtk_button_set_use_underline (button, TRUE); gtk_button_set_use_underline (button, TRUE);
@ -975,6 +977,7 @@ gtk_button_construct_child (GtkButton *button)
{ {
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button); GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkStockItem item; GtkStockItem item;
GtkWidget *child;
GtkWidget *label; GtkWidget *label;
GtkWidget *box; GtkWidget *box;
GtkWidget *align; GtkWidget *align;
@ -1001,9 +1004,9 @@ gtk_button_construct_child (GtkButton *button)
priv->image = NULL; priv->image = NULL;
if (GTK_BIN (button)->child) child = gtk_bin_get_child (GTK_BIN (button));
gtk_container_remove (GTK_CONTAINER (button), if (child)
GTK_BIN (button)->child); gtk_container_remove (GTK_CONTAINER (button), child);
if (button->use_stock && if (button->use_stock &&
button->label_text && button->label_text &&
@ -1353,10 +1356,10 @@ gtk_button_update_image_spacing (GtkButton *button)
if (!button->constructed || !priv->image) if (!button->constructed || !priv->image)
return; return;
child = GTK_BIN (button)->child; child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_ALIGNMENT (child)) if (GTK_IS_ALIGNMENT (child))
{ {
child = GTK_BIN (child)->child; child = gtk_bin_get_child (GTK_BIN (child));
if (GTK_IS_BOX (child)) if (GTK_IS_BOX (child))
{ {
gtk_widget_style_get (GTK_WIDGET (button), gtk_widget_style_get (GTK_WIDGET (button),
@ -1434,6 +1437,7 @@ gtk_button_size_allocate (GtkWidget *widget,
{ {
GtkButton *button = GTK_BUTTON (widget); GtkButton *button = GTK_BUTTON (widget);
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkWidget *child;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gint xthickness = GTK_WIDGET (widget)->style->xthickness; gint xthickness = GTK_WIDGET (widget)->style->xthickness;
@ -1459,7 +1463,8 @@ gtk_button_size_allocate (GtkWidget *widget,
widget->allocation.width - border_width * 2, widget->allocation.width - border_width * 2,
widget->allocation.height - border_width * 2); widget->allocation.height - border_width * 2);
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child)) child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{ {
child_allocation.x = widget->allocation.x + border_width + inner_border.left + xthickness; child_allocation.x = widget->allocation.x + border_width + inner_border.left + xthickness;
child_allocation.y = widget->allocation.y + border_width + inner_border.top + ythickness; child_allocation.y = widget->allocation.y + border_width + inner_border.top + ythickness;
@ -1504,7 +1509,7 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.y += child_displacement_y; child_allocation.y += child_displacement_y;
} }
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
} }
@ -2166,7 +2171,7 @@ gtk_button_set_alignment (GtkButton *button,
priv->yalign = yalign; priv->yalign = yalign;
priv->align_set = 1; priv->align_set = 1;
maybe_set_alignment (button, GTK_BIN (button)->child); maybe_set_alignment (button, gtk_bin_get_child (GTK_BIN (button)));
g_object_freeze_notify (G_OBJECT (button)); g_object_freeze_notify (G_OBJECT (button));
g_object_notify (G_OBJECT (button), "xalign"); g_object_notify (G_OBJECT (button), "xalign");

View File

@ -458,7 +458,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
g_object_get (cell_text, "text", &text, NULL); g_object_get (cell_text, "text", &text, NULL);
if (text) if (text)
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (combo)->child), gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
text); text);
g_free (text); g_free (text);
} }

View File

@ -150,7 +150,7 @@ gtk_check_button_paint (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
if (gtk_widget_has_focus (widget)) if (gtk_widget_has_focus (widget))
{ {
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
if (interior_focus && child && gtk_widget_get_visible (child)) if (interior_focus && child && gtk_widget_get_visible (child))
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget), gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
@ -213,7 +213,7 @@ gtk_check_button_size_request (GtkWidget *widget,
_gtk_check_button_get_props (GTK_CHECK_BUTTON (widget), _gtk_check_button_get_props (GTK_CHECK_BUTTON (widget),
&indicator_size, &indicator_spacing); &indicator_size, &indicator_spacing);
child = GTK_BIN (widget)->child; child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child)) if (child && gtk_widget_get_visible (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
@ -248,6 +248,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
if (toggle_button->draw_indicator) if (toggle_button->draw_indicator)
{ {
GtkWidget *child;
gint indicator_size; gint indicator_size;
gint indicator_spacing; gint indicator_spacing;
gint focus_width; gint focus_width;
@ -264,13 +265,14 @@ gtk_check_button_size_allocate (GtkWidget *widget,
gdk_window_move_resize (button->event_window, gdk_window_move_resize (button->event_window,
allocation->x, allocation->y, allocation->x, allocation->y,
allocation->width, allocation->height); allocation->width, allocation->height);
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child)) child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_child_requisition (GTK_BIN (button)->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
child_allocation.width = MIN (child_requisition.width, child_allocation.width = MIN (child_requisition.width,
allocation->width - allocation->width -
@ -291,7 +293,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
child_allocation.x = allocation->x + allocation->width child_allocation.x = allocation->x + allocation->width
- (child_allocation.x - allocation->x + child_allocation.width); - (child_allocation.x - allocation->x + child_allocation.width);
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
} }
else else
@ -304,6 +306,7 @@ gtk_check_button_expose (GtkWidget *widget,
{ {
GtkToggleButton *toggle_button; GtkToggleButton *toggle_button;
GtkBin *bin; GtkBin *bin;
GtkWidget *child;
toggle_button = GTK_TOGGLE_BUTTON (widget); toggle_button = GTK_TOGGLE_BUTTON (widget);
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
@ -313,10 +316,11 @@ gtk_check_button_expose (GtkWidget *widget,
if (toggle_button->draw_indicator) if (toggle_button->draw_indicator)
{ {
gtk_check_button_paint (widget, &event->area); gtk_check_button_paint (widget, &event->area);
if (bin->child) child = gtk_bin_get_child (bin);
if (child)
gtk_container_propagate_expose (GTK_CONTAINER (widget), gtk_container_propagate_expose (GTK_CONTAINER (widget),
bin->child, child,
event); event);
} }
else if (GTK_WIDGET_CLASS (gtk_check_button_parent_class)->expose_event) else if (GTK_WIDGET_CLASS (gtk_check_button_parent_class)->expose_event)
@ -379,7 +383,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
x = widget->allocation.x + indicator_spacing + border_width; x = widget->allocation.x + indicator_spacing + border_width;
y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2; y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
child = GTK_BIN (check_button)->child; child = gtk_bin_get_child (GTK_BIN (check_button));
if (!interior_focus || !(child && gtk_widget_get_visible (child))) if (!interior_focus || !(child && gtk_widget_get_visible (child)))
x += focus_width + focus_pad; x += focus_width + focus_pad;

View File

@ -1182,6 +1182,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
{ {
GtkComboBox *combo_box = GTK_COMBO_BOX (widget); GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
gtk_combo_box_check_appearance (combo_box); gtk_combo_box_check_appearance (combo_box);
@ -1189,8 +1190,9 @@ gtk_combo_box_style_set (GtkWidget *widget,
gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
&widget->style->base[gtk_widget_get_state (widget)]); &widget->style->base[gtk_widget_get_state (widget)]);
if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child)) child = gtk_bin_get_child (GTK_BIN (combo_box));
g_object_set (GTK_BIN (combo_box)->child, "shadow-type", if (GTK_IS_ENTRY (child))
g_object_set (child, "shadow-type",
GTK_SHADOW_NONE == priv->shadow_type ? GTK_SHADOW_NONE == priv->shadow_type ?
GTK_SHADOW_IN : GTK_SHADOW_NONE, NULL); GTK_SHADOW_IN : GTK_SHADOW_NONE, NULL);
} }
@ -1489,7 +1491,7 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
GdkRectangle monitor; GdkRectangle monitor;
/* FIXME: is using the size request here broken? */ /* FIXME: is using the size request here broken? */
child = GTK_BIN (combo_box)->child; child = gtk_bin_get_child (GTK_BIN (combo_box));
sx = sy = 0; sx = sy = 0;
@ -1791,7 +1793,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
for (child = children; child; child = child->next) for (child = children; child; child = child->next)
{ {
item = GTK_WIDGET (child->data); item = GTK_WIDGET (child->data);
cell_view = GTK_BIN (item)->child; cell_view = gtk_bin_get_child (GTK_BIN (item));
if (!GTK_IS_CELL_VIEW (cell_view)) if (!GTK_IS_CELL_VIEW (cell_view))
continue; continue;
@ -2175,7 +2177,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
/* common */ /* common */
gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req); gtk_widget_size_request (gtk_bin_get_child (GTK_BIN (widget)), &bin_req);
gtk_combo_box_remeasure (combo_box); gtk_combo_box_remeasure (combo_box);
bin_req.width = MAX (bin_req.width, priv->width); bin_req.width = MAX (bin_req.width, priv->width);
bin_req.height = MAX (bin_req.height, priv->height); bin_req.height = MAX (bin_req.height, priv->height);
@ -2186,7 +2188,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
"arrow-size", &arrow_size, "arrow-size", &arrow_size,
NULL); NULL);
font_desc = GTK_BIN (widget)->child->style->font_desc; font_desc = gtk_bin_get_child (GTK_BIN (widget))->style->font_desc;
context = gtk_widget_get_pango_context (widget); context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context, font_desc, metrics = pango_context_get_metrics (context, font_desc,
pango_context_get_language (context)); pango_context_get_language (context));
@ -2297,6 +2299,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
{ {
GtkComboBox *combo_box = GTK_COMBO_BOX (widget); GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child_widget;
gint shadow_width, shadow_height; gint shadow_width, shadow_height;
gint focus_width, focus_pad; gint focus_width, focus_pad;
GtkAllocation child; GtkAllocation child;
@ -2304,6 +2307,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
widget->allocation = *allocation; widget->allocation = *allocation;
child_widget = gtk_bin_get_child (GTK_BIN (widget));
gtk_widget_style_get (GTK_WIDGET (widget), gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width, "focus-line-width", &focus_width,
@ -2408,7 +2412,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = MAX (1, child.width); child.width = MAX (1, child.width);
child.height = MAX (1, child.height); child.height = MAX (1, child.height);
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child); gtk_widget_size_allocate (child_widget, &child);
} }
else else
{ {
@ -2422,7 +2426,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = allocation->width - req.width - 2 * shadow_width; child.width = allocation->width - req.width - 2 * shadow_width;
child.width = MAX (1, child.width); child.width = MAX (1, child.width);
child.height = MAX (1, child.height); child.height = MAX (1, child.height);
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child); gtk_widget_size_allocate (child_widget, &child);
} }
} }
else else
@ -2488,7 +2492,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = MAX (1, child.width); child.width = MAX (1, child.width);
child.height = MAX (1, child.height); child.height = MAX (1, child.height);
gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child); gtk_widget_size_allocate (child_widget, &child);
} }
} }
@ -2543,6 +2547,7 @@ gtk_combo_box_forall (GtkContainer *container,
{ {
GtkComboBox *combo_box = GTK_COMBO_BOX (container); GtkComboBox *combo_box = GTK_COMBO_BOX (container);
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
if (include_internals) if (include_internals)
{ {
@ -2552,8 +2557,9 @@ gtk_combo_box_forall (GtkContainer *container,
(* callback) (priv->cell_view_frame, callback_data); (* callback) (priv->cell_view_frame, callback_data);
} }
if (GTK_BIN (container)->child) child = gtk_bin_get_child (GTK_BIN (container));
(* callback) (GTK_BIN (container)->child, callback_data); if (child)
(* callback) (child, callback_data);
} }
static void static void
@ -2603,7 +2609,8 @@ gtk_combo_box_expose_event (GtkWidget *widget,
} }
gtk_container_propagate_expose (GTK_CONTAINER (widget), gtk_container_propagate_expose (GTK_CONTAINER (widget),
GTK_BIN (widget)->child, event); gtk_bin_get_child (GTK_BIN (widget)),
event);
return FALSE; return FALSE;
} }
@ -2883,8 +2890,11 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
gboolean add_children) gboolean add_children)
{ {
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
GtkWidget *menu; GtkWidget *menu;
child = gtk_bin_get_child (GTK_BIN (combo_box));
if (priv->cell_view) if (priv->cell_view)
{ {
priv->button = gtk_toggle_button_new (); priv->button = gtk_toggle_button_new ();
@ -2894,7 +2904,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
g_signal_connect (priv->button, "toggled", g_signal_connect (priv->button, "toggled",
G_CALLBACK (gtk_combo_box_button_toggled), combo_box); G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
gtk_widget_set_parent (priv->button, gtk_widget_set_parent (priv->button,
GTK_BIN (combo_box)->child->parent); gtk_widget_get_parent (child));
priv->box = gtk_hbox_new (FALSE, 0); priv->box = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (priv->button), priv->box); gtk_container_add (GTK_CONTAINER (priv->button), priv->box);
@ -2916,7 +2926,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
g_signal_connect (priv->button, "toggled", g_signal_connect (priv->button, "toggled",
G_CALLBACK (gtk_combo_box_button_toggled), combo_box); G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
gtk_widget_set_parent (priv->button, gtk_widget_set_parent (priv->button,
GTK_BIN (combo_box)->child->parent); gtk_widget_get_parent (child));
priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow); gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow);
@ -3259,7 +3269,7 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
GtkTreePath *path; GtkTreePath *path;
GtkTreeIter iter; GtkTreeIter iter;
cell_view = GTK_BIN (item)->child; cell_view = gtk_bin_get_child (GTK_BIN (item));
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view)); g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
@ -3440,6 +3450,7 @@ find_menu_by_path (GtkWidget *menu,
gboolean skip_first) gboolean skip_first)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *item; GtkWidget *item;
GtkWidget *submenu; GtkWidget *submenu;
GtkTreeRowReference *mref; GtkTreeRowReference *mref;
@ -3451,6 +3462,7 @@ find_menu_by_path (GtkWidget *menu,
item = NULL; item = NULL;
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
child = gtk_bin_get_child (i->data);
if (GTK_IS_SEPARATOR_MENU_ITEM (i->data)) if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
{ {
mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path"); mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
@ -3461,7 +3473,7 @@ find_menu_by_path (GtkWidget *menu,
else else
mpath = gtk_tree_row_reference_get_path (mref); mpath = gtk_tree_row_reference_get_path (mref);
} }
else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child)) else if (GTK_IS_CELL_VIEW (child))
{ {
if (skip) if (skip)
{ {
@ -3469,7 +3481,7 @@ find_menu_by_path (GtkWidget *menu,
continue; continue;
} }
mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (GTK_BIN (i->data)->child)); mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (child));
} }
else else
continue; continue;
@ -3580,7 +3592,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
combo_box); combo_box);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator); gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
if (cell_view_is_sensitive (GTK_CELL_VIEW (GTK_BIN (item)->child))) if (cell_view_is_sensitive (GTK_CELL_VIEW (gtk_bin_get_child (GTK_BIN (item)))))
{ {
gtk_widget_show (item); gtk_widget_show (item);
gtk_widget_show (separator); gtk_widget_show (separator);
@ -3747,11 +3759,13 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GtkTreeSelection *sel; GtkTreeSelection *sel;
GtkStyle *style; GtkStyle *style;
GtkWidget *child;
GtkWidget *widget = GTK_WIDGET (combo_box); GtkWidget *widget = GTK_WIDGET (combo_box);
priv->button = gtk_toggle_button_new (); priv->button = gtk_toggle_button_new ();
child = gtk_bin_get_child (GTK_BIN (combo_box));
gtk_widget_set_parent (priv->button, gtk_widget_set_parent (priv->button,
GTK_BIN (combo_box)->child->parent); gtk_widget_get_parent (child));
g_signal_connect (priv->button, "button-press-event", g_signal_connect (priv->button, "button-press-event",
G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box); G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box);
g_signal_connect (priv->button, "toggled", g_signal_connect (priv->button, "toggled",
@ -3784,9 +3798,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame), gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame),
FALSE); FALSE);
} }
gtk_widget_set_parent (priv->cell_view_frame, gtk_widget_set_parent (priv->cell_view_frame,
GTK_BIN (combo_box)->child->parent); gtk_widget_get_parent (child));
gtk_container_add (GTK_CONTAINER (priv->cell_view_frame), priv->box); gtk_container_add (GTK_CONTAINER (priv->cell_view_frame), priv->box);
gtk_widget_show_all (priv->cell_view_frame); gtk_widget_show_all (priv->cell_view_frame);
@ -4262,14 +4276,15 @@ pack_start_recurse (GtkWidget *menu,
gboolean expand) gboolean expand)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *submenu; GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (child),
cell, expand); cell, expand);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
@ -4316,14 +4331,15 @@ pack_end_recurse (GtkWidget *menu,
gboolean expand) gboolean expand)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *submenu; GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (child),
cell, expand); cell, expand);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
@ -4385,13 +4401,14 @@ static void
clear_recurse (GtkWidget *menu) clear_recurse (GtkWidget *menu)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *submenu; GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_clear (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child)); gtk_cell_layout_clear (GTK_CELL_LAYOUT (child));
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
@ -4437,14 +4454,15 @@ add_attribute_recurse (GtkWidget *menu,
gint column) gint column)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *submenu; GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (child),
cell, attribute, column); cell, attribute, column);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
@ -4520,7 +4538,7 @@ set_cell_data_func_recurse (GtkWidget *menu,
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
cell_view = GTK_BIN (i->data)->child; cell_view = gtk_bin_get_child (GTK_BIN (i->data));
if (GTK_IS_CELL_LAYOUT (cell_view)) if (GTK_IS_CELL_LAYOUT (cell_view))
{ {
/* Override sensitivity for inner nodes; we don't /* Override sensitivity for inner nodes; we don't
@ -4582,15 +4600,15 @@ clear_attributes_recurse (GtkWidget *menu,
GtkCellRenderer *cell) GtkCellRenderer *cell)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *submenu; GtkWidget *submenu;
GtkWidget *child;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (child), cell);
cell);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
clear_attributes_recurse (submenu, cell); clear_attributes_recurse (submenu, cell);
@ -4640,15 +4658,16 @@ reorder_recurse (GtkWidget *menu,
gint position) gint position)
{ {
GList *i, *list; GList *i, *list;
GtkWidget *child;
GtkWidget *submenu; GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu)); list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next) for (i = list; i; i = i->next)
{ {
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child)) child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), gtk_cell_layout_reorder (GTK_CELL_LAYOUT (child),
cell, position); cell, position);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data)); submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL) if (submenu != NULL)
reorder_recurse (submenu, cell, position); reorder_recurse (submenu, cell, position);
@ -5670,6 +5689,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event) GdkEvent *event)
{ {
GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable); GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable);
GtkWidget *child;
combo_box->priv->is_cell_renderer = TRUE; combo_box->priv->is_cell_renderer = TRUE;
@ -5683,11 +5703,13 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
} }
else else
{ {
g_signal_connect_object (GTK_BIN (combo_box)->child, "key-press-event", child = gtk_bin_get_child (GTK_BIN (combo_box));
g_signal_connect_object (child, "key-press-event",
G_CALLBACK (gtk_cell_editable_key_press), G_CALLBACK (gtk_cell_editable_key_press),
cell_editable, 0); cell_editable, 0);
gtk_widget_grab_focus (GTK_WIDGET (GTK_BIN (combo_box)->child)); gtk_widget_grab_focus (child);
gtk_widget_set_can_focus (combo_box->priv->button, FALSE); gtk_widget_set_can_focus (combo_box->priv->button, FALSE);
} }

View File

@ -226,7 +226,10 @@ static void
gtk_combo_box_entry_remove (GtkContainer *container, gtk_combo_box_entry_remove (GtkContainer *container,
GtkWidget *child) GtkWidget *child)
{ {
if (child && child == GTK_BIN (container)->child) GtkWidget *child_widget;
child_widget = gtk_bin_get_child (GTK_BIN (container));
if (child && child == child_widget)
{ {
g_signal_handlers_disconnect_by_func (child, g_signal_handlers_disconnect_by_func (child,
gtk_combo_box_entry_contents_changed, gtk_combo_box_entry_contents_changed,
@ -248,7 +251,7 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
if (gtk_combo_box_get_active_iter (combo_box, &iter)) if (gtk_combo_box_get_active_iter (combo_box, &iter))
{ {
GtkEntry *entry = GTK_ENTRY (GTK_BIN (combo_box)->child); GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box)));
if (entry) if (entry)
{ {
@ -276,13 +279,16 @@ has_frame_changed (GtkComboBoxEntry *entry_box,
GParamSpec *pspec, GParamSpec *pspec,
gpointer data) gpointer data)
{ {
if (GTK_BIN (entry_box)->child) GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (entry_box));
if (child)
{ {
gboolean has_frame; gboolean has_frame;
g_object_get (entry_box, "has-frame", &has_frame, NULL); g_object_get (entry_box, "has-frame", &has_frame, NULL);
gtk_entry_set_has_frame (GTK_ENTRY (GTK_BIN (entry_box)->child), has_frame); gtk_entry_set_has_frame (GTK_ENTRY (child), has_frame);
} }
} }
@ -405,9 +411,11 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling) gboolean group_cycling)
{ {
GtkBin *entry_box = GTK_BIN (widget); GtkBin *entry_box = GTK_BIN (widget);
GtkWidget* child;
if (entry_box->child) child = gtk_bin_get_child (entry_box);
gtk_widget_grab_focus (entry_box->child); if (child)
gtk_widget_grab_focus (child);
return TRUE; return TRUE;
} }
@ -416,9 +424,11 @@ static void
gtk_combo_box_entry_grab_focus (GtkWidget *widget) gtk_combo_box_entry_grab_focus (GtkWidget *widget)
{ {
GtkBin *entry_box = GTK_BIN (widget); GtkBin *entry_box = GTK_BIN (widget);
GtkWidget *child;
if (entry_box->child) child = gtk_bin_get_child (entry_box);
gtk_widget_grab_focus (entry_box->child); if (child)
gtk_widget_grab_focus (child);
} }
@ -456,9 +466,11 @@ static gchar *
gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box) gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box)
{ {
GtkBin *combo = GTK_BIN (combo_box); GtkBin *combo = GTK_BIN (combo_box);
GtkWidget *child;
if (combo->child) child = gtk_bin_get_child (combo);
return g_strdup (gtk_entry_get_text (GTK_ENTRY (combo->child))); if (child)
return g_strdup (gtk_entry_get_text (GTK_ENTRY (child)));
return NULL; return NULL;
} }

View File

@ -484,16 +484,18 @@ gtk_event_box_size_request (GtkWidget *widget,
{ {
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
guint border_width; guint border_width;
GtkWidget *child;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
requisition->width = border_width * 2; requisition->width = border_width * 2;
requisition->height = border_width * 2; requisition->height = border_width * 2;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition); gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width; requisition->width += child_requisition.width;
requisition->height += child_requisition.height; requisition->height += child_requisition.height;
@ -508,7 +510,8 @@ gtk_event_box_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkEventBoxPrivate *priv; GtkEventBoxPrivate *priv;
guint border_width; guint border_width;
GtkWidget *child;
widget->allocation = *allocation; widget->allocation = *allocation;
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -544,9 +547,10 @@ gtk_event_box_size_allocate (GtkWidget *widget,
child_allocation.width, child_allocation.width,
child_allocation.height); child_allocation.height);
} }
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_size_allocate (bin->child, &child_allocation); if (child)
gtk_widget_size_allocate (child, &child_allocation);
} }
static void static void

View File

@ -464,6 +464,7 @@ gtk_expander_size_request (GtkWidget *widget,
GtkExpander *expander; GtkExpander *expander;
GtkBin *bin; GtkBin *bin;
GtkExpanderPrivate *priv; GtkExpanderPrivate *priv;
GtkWidget *child;
gint border_width; gint border_width;
gint expander_size; gint expander_size;
gint expander_spacing; gint expander_spacing;
@ -504,11 +505,12 @@ gtk_expander_size_request (GtkWidget *widget,
if (!interior_focus) if (!interior_focus)
requisition->height += 2 * focus_width + 2 * focus_pad; requisition->height += 2 * focus_width + 2 * focus_pad;
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child)) child = gtk_bin_get_child (bin);
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition); gtk_widget_size_request (child, &child_requisition);
requisition->width = MAX (requisition->width, child_requisition.width); requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height + priv->spacing; requisition->height += child_requisition.height + priv->spacing;
@ -592,6 +594,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
GtkBin *bin; GtkBin *bin;
GtkExpanderPrivate *priv; GtkExpanderPrivate *priv;
GtkRequisition child_requisition; GtkRequisition child_requisition;
GtkWidget *child;
gboolean child_visible = FALSE; gboolean child_visible = FALSE;
guint border_width; guint border_width;
gint expander_size; gint expander_size;
@ -617,10 +620,12 @@ gtk_expander_size_allocate (GtkWidget *widget,
child_requisition.width = 0; child_requisition.width = 0;
child_requisition.height = 0; child_requisition.height = 0;
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
child = gtk_bin_get_child (bin);
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
{ {
child_visible = TRUE; child_visible = TRUE;
gtk_widget_get_child_requisition (bin->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
} }
widget->allocation = *allocation; widget->allocation = *allocation;
@ -703,7 +708,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
(!interior_focus ? 2 * focus_width + 2 * focus_pad : 0); (!interior_focus ? 2 * focus_width + 2 * focus_pad : 0);
child_allocation.height = MAX (child_allocation.height, 1); child_allocation.height = MAX (child_allocation.height, 1);
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
} }
@ -1257,9 +1262,11 @@ gtk_expander_forall (GtkContainer *container,
{ {
GtkBin *bin = GTK_BIN (container); GtkBin *bin = GTK_BIN (container);
GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv; GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv;
GtkWidget *child;
if (bin->child) child = gtk_bin_get_child (bin);
(* callback) (bin->child, callback_data); if (child)
(* callback) (child, callback_data);
if (priv->label_widget) if (priv->label_widget)
(* callback) (priv->label_widget, callback_data); (* callback) (priv->label_widget, callback_data);
@ -1316,6 +1323,7 @@ static gboolean
gtk_expander_animation_timeout (GtkExpander *expander) gtk_expander_animation_timeout (GtkExpander *expander)
{ {
GtkExpanderPrivate *priv = expander->priv; GtkExpanderPrivate *priv = expander->priv;
GtkWidget *child;
GdkRectangle area; GdkRectangle area;
gboolean finish = FALSE; gboolean finish = FALSE;
@ -1353,8 +1361,10 @@ gtk_expander_animation_timeout (GtkExpander *expander)
if (finish) if (finish)
{ {
priv->animation_timeout = 0; priv->animation_timeout = 0;
if (GTK_BIN (expander)->child)
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded); child = gtk_bin_get_child (GTK_BIN (expander));
if (child)
gtk_widget_set_child_visible (child, priv->expanded);
gtk_widget_queue_resize (GTK_WIDGET (expander)); gtk_widget_queue_resize (GTK_WIDGET (expander));
} }
@ -1391,6 +1401,7 @@ gtk_expander_set_expanded (GtkExpander *expander,
gboolean expanded) gboolean expanded)
{ {
GtkExpanderPrivate *priv; GtkExpanderPrivate *priv;
GtkWidget *child;
g_return_if_fail (GTK_IS_EXPANDER (expander)); g_return_if_fail (GTK_IS_EXPANDER (expander));
@ -1416,9 +1427,10 @@ gtk_expander_set_expanded (GtkExpander *expander,
priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED : priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
GTK_EXPANDER_COLLAPSED; GTK_EXPANDER_COLLAPSED;
if (GTK_BIN (expander)->child) child = gtk_bin_get_child (GTK_BIN (expander));
if (child)
{ {
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded); gtk_widget_set_child_visible (child, priv->expanded);
gtk_widget_queue_resize (GTK_WIDGET (expander)); gtk_widget_queue_resize (GTK_WIDGET (expander));
} }
} }

View File

@ -302,9 +302,11 @@ gtk_frame_forall (GtkContainer *container,
{ {
GtkBin *bin = GTK_BIN (container); GtkBin *bin = GTK_BIN (container);
GtkFrame *frame = GTK_FRAME (container); GtkFrame *frame = GTK_FRAME (container);
GtkWidget *child;
if (bin->child) child = gtk_bin_get_child (bin);
(* callback) (bin->child, callback_data); if (child)
(* callback) (child, callback_data);
if (frame->label_widget) if (frame->label_widget)
(* callback) (frame->label_widget, callback_data); (* callback) (frame->label_widget, callback_data);
@ -615,6 +617,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
GtkFrame *frame = GTK_FRAME (widget); GtkFrame *frame = GTK_FRAME (widget);
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkAllocation new_allocation; GtkAllocation new_allocation;
GtkWidget *child;
widget->allocation = *allocation; widget->allocation = *allocation;
@ -633,9 +636,10 @@ gtk_frame_size_allocate (GtkWidget *widget,
#endif #endif
) )
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE); gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
gtk_widget_size_allocate (bin->child, &new_allocation); if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &new_allocation);
frame->child_allocation = new_allocation; frame->child_allocation = new_allocation;
@ -712,6 +716,7 @@ gtk_frame_get_size (GtkSizeRequest *request,
gint *natural_size) gint *natural_size)
{ {
GtkWidget *widget = GTK_WIDGET (request); GtkWidget *widget = GTK_WIDGET (request);
GtkWidget *child;
GtkFrame *frame = GTK_FRAME (widget); GtkFrame *frame = GTK_FRAME (widget);
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
gint child_min, child_nat; gint child_min, child_nat;
@ -741,18 +746,19 @@ gtk_frame_get_size (GtkSizeRequest *request,
natural = 0; natural = 0;
} }
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
if (orientation == GTK_ORIENTATION_HORIZONTAL) if (orientation == GTK_ORIENTATION_HORIZONTAL)
{ {
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin->child), gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
&child_min, &child_nat); &child_min, &child_nat);
minimum = MAX (minimum, child_min); minimum = MAX (minimum, child_min);
natural = MAX (natural, child_nat); natural = MAX (natural, child_nat);
} }
else else
{ {
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin->child), gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
&child_min, &child_nat); &child_min, &child_nat);
minimum += child_min; minimum += child_min;
natural += child_nat; natural += child_nat;

View File

@ -348,16 +348,17 @@ gtk_handle_box_map (GtkWidget *widget)
{ {
GtkBin *bin; GtkBin *bin;
GtkHandleBox *hb; GtkHandleBox *hb;
GtkWidget *child;
gtk_widget_set_mapped (widget, TRUE); gtk_widget_set_mapped (widget, TRUE);
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
hb = GTK_HANDLE_BOX (widget); hb = GTK_HANDLE_BOX (widget);
if (bin->child && child = gtk_bin_get_child (bin);
gtk_widget_get_visible (bin->child) && if (gtk_widget_get_visible (child) &&
!gtk_widget_get_mapped (bin->child)) !gtk_widget_get_mapped (child))
gtk_widget_map (bin->child); gtk_widget_map (child);
if (hb->child_detached && !hb->float_window_mapped) if (hb->child_detached && !hb->float_window_mapped)
{ {
@ -389,9 +390,10 @@ gtk_handle_box_unmap (GtkWidget *widget)
static void static void
gtk_handle_box_realize (GtkWidget *widget) gtk_handle_box_realize (GtkWidget *widget)
{ {
GtkHandleBox *hb;
GtkWidget *child;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
GtkHandleBox *hb;
hb = GTK_HANDLE_BOX (widget); hb = GTK_HANDLE_BOX (widget);
@ -425,8 +427,10 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
hb->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask); hb->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (hb->bin_window, widget); gdk_window_set_user_data (hb->bin_window, widget);
if (GTK_BIN (hb)->child)
gtk_widget_set_parent_window (GTK_BIN (hb)->child, hb->bin_window); child = gtk_bin_get_child (GTK_BIN (hb));
if (child)
gtk_widget_set_parent_window (child, hb->bin_window);
attributes.x = 0; attributes.x = 0;
attributes.y = 0; attributes.y = 0;
@ -521,6 +525,7 @@ gtk_handle_box_size_request (GtkWidget *widget,
GtkBin *bin; GtkBin *bin;
GtkHandleBox *hb; GtkHandleBox *hb;
GtkRequisition child_requisition; GtkRequisition child_requisition;
GtkWidget *child;
gint handle_position; gint handle_position;
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
@ -540,11 +545,12 @@ gtk_handle_box_size_request (GtkWidget *widget,
requisition->height = DRAG_HANDLE_SIZE; requisition->height = DRAG_HANDLE_SIZE;
} }
child = gtk_bin_get_child (bin);
/* if our child is not visible, we still request its size, since we /* if our child is not visible, we still request its size, since we
* won't have any useful hint for our size otherwise. * won't have any useful hint for our size otherwise.
*/ */
if (bin->child) if (child)
gtk_widget_size_request (bin->child, &child_requisition); gtk_widget_size_request (child, &child_requisition);
else else
{ {
child_requisition.width = 0; child_requisition.width = 0;
@ -579,7 +585,7 @@ gtk_handle_box_size_request (GtkWidget *widget,
requisition->width += border_width * 2; requisition->width += border_width * 2;
requisition->height += border_width * 2; requisition->height += border_width * 2;
if (bin->child) if (child)
{ {
requisition->width += child_requisition.width; requisition->width += child_requisition.width;
requisition->height += child_requisition.height; requisition->height += child_requisition.height;
@ -599,6 +605,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
GtkBin *bin; GtkBin *bin;
GtkHandleBox *hb; GtkHandleBox *hb;
GtkRequisition child_requisition; GtkRequisition child_requisition;
GtkWidget *child;
gint handle_position; gint handle_position;
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
@ -606,8 +613,10 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
handle_position = effective_handle_position (hb); handle_position = effective_handle_position (hb);
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_get_child_requisition (bin->child, &child_requisition);
if (child)
gtk_widget_get_child_requisition (child, &child_requisition);
else else
{ {
child_requisition.width = 0; child_requisition.width = 0;
@ -624,7 +633,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
widget->allocation.height); widget->allocation.height);
if (bin->child && gtk_widget_get_visible (bin->child)) if (gtk_widget_get_visible (child))
{ {
GtkAllocation child_allocation; GtkAllocation child_allocation;
guint border_width; guint border_width;
@ -686,7 +695,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
widget->allocation.height); widget->allocation.height);
} }
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
} }
@ -955,7 +964,7 @@ gtk_handle_box_paint (GtkWidget *widget,
event ? &event->area : area, event ? &event->area : area,
handle_orientation); handle_orientation);
if (bin->child && gtk_widget_get_visible (bin->child)) if (gtk_widget_get_visible (gtk_bin_get_child (bin)))
GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->expose_event (widget, event); GTK_WIDGET_CLASS (gtk_handle_box_parent_class)->expose_event (widget, event);
} }
@ -1044,7 +1053,7 @@ gtk_handle_box_button_press (GtkWidget *widget,
if (event->window != hb->bin_window) if (event->window != hb->bin_window)
return FALSE; return FALSE;
child = GTK_BIN (hb)->child; child = gtk_bin_get_child (GTK_BIN (hb));
if (child) if (child)
{ {
@ -1163,6 +1172,7 @@ gtk_handle_box_motion (GtkWidget *widget,
GdkEventMotion *event) GdkEventMotion *event)
{ {
GtkHandleBox *hb = GTK_HANDLE_BOX (widget); GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
GtkWidget *child;
gint new_x, new_y; gint new_x, new_y;
gint snap_edge; gint snap_edge;
gboolean is_snapped = FALSE; gboolean is_snapped = FALSE;
@ -1268,6 +1278,8 @@ gtk_handle_box_motion (GtkWidget *widget,
(float_pos2 + TOLERANCE > attach_pos2)); (float_pos2 + TOLERANCE > attach_pos2));
} }
child = gtk_bin_get_child (GTK_BIN (hb));
if (is_snapped) if (is_snapped)
{ {
if (hb->child_detached) if (hb->child_detached)
@ -1279,7 +1291,7 @@ gtk_handle_box_motion (GtkWidget *widget,
g_signal_emit (hb, g_signal_emit (hb,
handle_box_signals[SIGNAL_CHILD_ATTACHED], handle_box_signals[SIGNAL_CHILD_ATTACHED],
0, 0,
GTK_BIN (hb)->child); child);
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
@ -1324,8 +1336,8 @@ gtk_handle_box_motion (GtkWidget *widget,
hb->child_detached = TRUE; hb->child_detached = TRUE;
if (GTK_BIN (hb)->child) if (child)
gtk_widget_get_child_requisition (GTK_BIN (hb)->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
else else
{ {
child_requisition.width = 0; child_requisition.width = 0;
@ -1357,7 +1369,7 @@ gtk_handle_box_motion (GtkWidget *widget,
g_signal_emit (hb, g_signal_emit (hb,
handle_box_signals[SIGNAL_CHILD_DETACHED], handle_box_signals[SIGNAL_CHILD_DETACHED],
0, 0,
GTK_BIN (hb)->child); child);
gtk_handle_box_draw_ghost (hb); gtk_handle_box_draw_ghost (hb);
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
@ -1403,6 +1415,7 @@ gtk_handle_box_delete_event (GtkWidget *widget,
static void static void
gtk_handle_box_reattach (GtkHandleBox *hb) gtk_handle_box_reattach (GtkHandleBox *hb)
{ {
GtkWidget *child;
GtkWidget *widget = GTK_WIDGET (hb); GtkWidget *widget = GTK_WIDGET (hb);
if (hb->child_detached) if (hb->child_detached)
@ -1413,11 +1426,12 @@ gtk_handle_box_reattach (GtkHandleBox *hb)
gdk_window_hide (hb->float_window); gdk_window_hide (hb->float_window);
gdk_window_reparent (hb->bin_window, widget->window, 0, 0); gdk_window_reparent (hb->bin_window, widget->window, 0, 0);
if (GTK_BIN (hb)->child) child = gtk_bin_get_child (GTK_BIN (hb));
if (child)
g_signal_emit (hb, g_signal_emit (hb,
handle_box_signals[SIGNAL_CHILD_ATTACHED], handle_box_signals[SIGNAL_CHILD_ATTACHED],
0, 0,
GTK_BIN (hb)->child); child);
} }
hb->float_window_mapped = FALSE; hb->float_window_mapped = FALSE;

View File

@ -1783,7 +1783,7 @@ gtk_menu_popdown (GtkMenu *menu)
{ {
gtk_widget_set_size_request (menu->tearoff_window, -1, -1); gtk_widget_set_size_request (menu->tearoff_window, -1, -1);
if (GTK_BIN (menu->toplevel)->child) if (gtk_bin_get_child (GTK_BIN (menu->toplevel)))
{ {
gtk_menu_reparent (menu, menu->tearoff_hbox, TRUE); gtk_menu_reparent (menu, menu->tearoff_hbox, TRUE);
} }
@ -1843,7 +1843,7 @@ gtk_menu_get_active (GtkMenu *menu)
child = children->data; child = children->data;
children = children->next; children = children->next;
if (GTK_BIN (child)->child) if (gtk_bin_get_child (GTK_BIN (child)))
break; break;
child = NULL; child = NULL;
} }
@ -1869,7 +1869,7 @@ gtk_menu_set_active (GtkMenu *menu,
if (tmp_list) if (tmp_list)
{ {
child = tmp_list->data; child = tmp_list->data;
if (GTK_BIN (child)->child) if (gtk_bin_get_child (GTK_BIN (child)))
{ {
if (menu->old_active_menu_item) if (menu->old_active_menu_item)
g_object_unref (menu->old_active_menu_item); g_object_unref (menu->old_active_menu_item);
@ -2080,7 +2080,7 @@ gtk_menu_update_title (GtkMenu *menu)
attach_widget = gtk_menu_get_attach_widget (menu); attach_widget = gtk_menu_get_attach_widget (menu);
if (GTK_IS_MENU_ITEM (attach_widget)) if (GTK_IS_MENU_ITEM (attach_widget))
{ {
GtkWidget *child = GTK_BIN (attach_widget)->child; GtkWidget *child = gtk_bin_get_child (GTK_BIN (attach_widget));
if (GTK_IS_LABEL (child)) if (GTK_IS_LABEL (child))
title = gtk_label_get_text (GTK_LABEL (child)); title = gtk_label_get_text (GTK_LABEL (child));
} }
@ -3147,7 +3147,7 @@ get_accel_path (GtkWidget *menu_item,
{ {
*locked = TRUE; *locked = TRUE;
label = GTK_BIN (menu_item)->child; label = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_ACCEL_LABEL (label)) if (GTK_IS_ACCEL_LABEL (label))
{ {
@ -3250,7 +3250,7 @@ gtk_menu_key_press (GtkWidget *widget,
/* Modify the accelerators */ /* Modify the accelerators */
if (can_change_accels && if (can_change_accels &&
menu_shell->active_menu_item && menu_shell->active_menu_item &&
GTK_BIN (menu_shell->active_menu_item)->child && /* no separators */ gtk_bin_get_child (GTK_BIN (menu_shell->active_menu_item)) && /* no separators */
GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL && /* no submenus */ GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL && /* no submenus */
(delete || gtk_accelerator_valid (accel_key, accel_mods))) (delete || gtk_accelerator_valid (accel_key, accel_mods)))
{ {

View File

@ -628,7 +628,9 @@ gtk_menu_item_activatable_interface_init (GtkActivatableIface *iface)
static void static void
activatable_update_label (GtkMenuItem *menu_item, GtkAction *action) activatable_update_label (GtkMenuItem *menu_item, GtkAction *action)
{ {
GtkWidget *child = GTK_BIN (menu_item)->child; GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_LABEL (child)) if (GTK_IS_LABEL (child))
{ {
@ -667,12 +669,11 @@ gtk_menu_item_sync_action_properties (GtkActivatable *activatable,
{ {
GtkMenuItem *menu_item = GTK_MENU_ITEM (activatable); GtkMenuItem *menu_item = GTK_MENU_ITEM (activatable);
GtkMenuItemPrivate *priv = GET_PRIVATE (menu_item); GtkMenuItemPrivate *priv = GET_PRIVATE (menu_item);
GtkWidget *label;
if (!priv->use_action_appearance || !action) if (!priv->use_action_appearance || !action)
{ {
GtkWidget *label = GTK_BIN (menu_item)->child; label = gtk_bin_get_child (GTK_BIN (menu_item));
label = GTK_BIN (menu_item)->child;
if (GTK_IS_ACCEL_LABEL (label)) if (GTK_IS_ACCEL_LABEL (label))
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), GTK_WIDGET (menu_item)); gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), GTK_WIDGET (menu_item));
@ -688,7 +689,7 @@ gtk_menu_item_sync_action_properties (GtkActivatable *activatable,
if (priv->use_action_appearance) if (priv->use_action_appearance)
{ {
GtkWidget *label = GTK_BIN (menu_item)->child; label = gtk_bin_get_child (GTK_BIN (menu_item));
/* make sure label is a label */ /* make sure label is a label */
if (label && !GTK_IS_LABEL (label)) if (label && !GTK_IS_LABEL (label))
@ -700,8 +701,6 @@ gtk_menu_item_sync_action_properties (GtkActivatable *activatable,
gtk_menu_item_ensure_label (menu_item); gtk_menu_item_ensure_label (menu_item);
gtk_menu_item_set_use_underline (menu_item, TRUE); gtk_menu_item_set_use_underline (menu_item, TRUE);
label = GTK_BIN (menu_item)->child;
if (GTK_IS_ACCEL_LABEL (label) && gtk_action_get_accel_path (action)) if (GTK_IS_ACCEL_LABEL (label) && gtk_action_get_accel_path (action))
{ {
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), NULL); gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), NULL);
@ -934,6 +933,7 @@ gtk_menu_item_size_request (GtkWidget *widget,
{ {
GtkMenuItem *menu_item; GtkMenuItem *menu_item;
GtkBin *bin; GtkBin *bin;
GtkWidget *child;
guint accel_width; guint accel_width;
guint horizontal_padding; guint horizontal_padding;
guint border_width; guint border_width;
@ -972,11 +972,12 @@ gtk_menu_item_size_request (GtkWidget *widget,
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT)) (child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
requisition->height += 2 * horizontal_padding; requisition->height += 2 * horizontal_padding;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition); gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width; requisition->width += child_requisition.width;
requisition->height += child_requisition.height; requisition->height += child_requisition.height;
@ -1028,6 +1029,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
GtkTextDirection direction; GtkTextDirection direction;
GtkPackDirection pack_dir; GtkPackDirection pack_dir;
GtkPackDirection child_pack_dir; GtkPackDirection child_pack_dir;
GtkWidget *child;
g_return_if_fail (GTK_IS_MENU_ITEM (widget)); g_return_if_fail (GTK_IS_MENU_ITEM (widget));
g_return_if_fail (allocation != NULL); g_return_if_fail (allocation != NULL);
@ -1050,7 +1052,8 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
widget->allocation = *allocation; widget->allocation = *allocation;
if (bin->child) child = gtk_bin_get_child (bin);
if (child)
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
guint horizontal_padding; guint horizontal_padding;
@ -1091,7 +1094,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
child_allocation.x += widget->allocation.x; child_allocation.x += widget->allocation.x;
child_allocation.y += widget->allocation.y; child_allocation.y += widget->allocation.y;
gtk_widget_get_child_requisition (bin->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
if (menu_item->submenu && menu_item->show_submenu_indicator) if (menu_item->submenu && menu_item->show_submenu_indicator)
{ {
if (direction == GTK_TEXT_DIR_RTL) if (direction == GTK_TEXT_DIR_RTL)
@ -1102,7 +1105,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
if (child_allocation.width < 1) if (child_allocation.width < 1)
child_allocation.width = 1; child_allocation.width = 1;
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
if (gtk_widget_get_realized (widget)) if (gtk_widget_get_realized (widget))
@ -1185,6 +1188,7 @@ gtk_menu_item_paint (GtkWidget *widget,
GtkMenuItem *menu_item; GtkMenuItem *menu_item;
GtkStateType state_type; GtkStateType state_type;
GtkShadowType shadow_type, selected_shadow_type; GtkShadowType shadow_type, selected_shadow_type;
GtkWidget *child;
gint width, height; gint width, height;
gint x, y; gint x, y;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -1199,9 +1203,10 @@ gtk_menu_item_paint (GtkWidget *widget,
y = widget->allocation.y + border_width; y = widget->allocation.y + border_width;
width = widget->allocation.width - border_width * 2; width = widget->allocation.width - border_width * 2;
height = widget->allocation.height - border_width * 2; height = widget->allocation.height - border_width * 2;
child = gtk_bin_get_child (GTK_BIN (menu_item));
if ((state_type == GTK_STATE_PRELIGHT) && if (child && state_type == GTK_STATE_PRELIGHT)
(GTK_BIN (menu_item)->child))
{ {
gtk_widget_style_get (widget, gtk_widget_style_get (widget,
"selected-shadow-type", &selected_shadow_type, "selected-shadow-type", &selected_shadow_type,
@ -1233,9 +1238,9 @@ gtk_menu_item_paint (GtkWidget *widget,
"arrow-scaling", &arrow_scaling, "arrow-scaling", &arrow_scaling,
NULL); NULL);
context = gtk_widget_get_pango_context (GTK_BIN (menu_item)->child); context = gtk_widget_get_pango_context (child);
metrics = pango_context_get_metrics (context, metrics = pango_context_get_metrics (context,
GTK_WIDGET (GTK_BIN (menu_item)->child)->style->font_desc, child->style->font_desc,
pango_context_get_language (context)); pango_context_get_language (context));
arrow_size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + arrow_size = (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
@ -1269,7 +1274,7 @@ gtk_menu_item_paint (GtkWidget *widget,
arrow_x, arrow_y, arrow_x, arrow_y,
arrow_extent, arrow_extent); arrow_extent, arrow_extent);
} }
else if (!GTK_BIN (menu_item)->child) else if (!child)
{ {
gboolean wide_separators; gboolean wide_separators;
gint separator_height; gint separator_height;
@ -1448,11 +1453,14 @@ static void
gtk_real_menu_item_set_label (GtkMenuItem *menu_item, gtk_real_menu_item_set_label (GtkMenuItem *menu_item,
const gchar *label) const gchar *label)
{ {
GtkWidget *child;
gtk_menu_item_ensure_label (menu_item); gtk_menu_item_ensure_label (menu_item);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child)) child = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_LABEL (child))
{ {
gtk_label_set_label (GTK_LABEL (GTK_BIN (menu_item)->child), label ? label : ""); gtk_label_set_label (GTK_LABEL (child), label ? label : "");
g_object_notify (G_OBJECT (menu_item), "label"); g_object_notify (G_OBJECT (menu_item), "label");
} }
@ -1461,10 +1469,13 @@ gtk_real_menu_item_set_label (GtkMenuItem *menu_item,
static G_CONST_RETURN gchar * static G_CONST_RETURN gchar *
gtk_real_menu_item_get_label (GtkMenuItem *menu_item) gtk_real_menu_item_get_label (GtkMenuItem *menu_item)
{ {
GtkWidget *child;
gtk_menu_item_ensure_label (menu_item); gtk_menu_item_ensure_label (menu_item);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child)) child = gtk_bin_get_child (GTK_BIN (menu_item));
return gtk_label_get_label (GTK_LABEL (GTK_BIN (menu_item)->child)); if (GTK_IS_LABEL (child))
return gtk_label_get_label (GTK_LABEL (child));
return NULL; return NULL;
} }
@ -2076,21 +2087,20 @@ gtk_menu_item_forall (GtkContainer *container,
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
GtkBin *bin; GtkWidget *child;
g_return_if_fail (GTK_IS_MENU_ITEM (container)); g_return_if_fail (GTK_IS_MENU_ITEM (container));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != NULL);
bin = GTK_BIN (container); child = gtk_bin_get_child (GTK_BIN (container));
if (child)
if (bin->child) callback (child, callback_data);
callback (bin->child, callback_data);
} }
gboolean gboolean
_gtk_menu_item_is_selectable (GtkWidget *menu_item) _gtk_menu_item_is_selectable (GtkWidget *menu_item)
{ {
if ((!GTK_BIN (menu_item)->child && if ((!gtk_bin_get_child (GTK_BIN (menu_item)) &&
G_OBJECT_TYPE (menu_item) == GTK_TYPE_MENU_ITEM) || G_OBJECT_TYPE (menu_item) == GTK_TYPE_MENU_ITEM) ||
GTK_IS_SEPARATOR_MENU_ITEM (menu_item) || GTK_IS_SEPARATOR_MENU_ITEM (menu_item) ||
!gtk_widget_is_sensitive (menu_item) || !gtk_widget_is_sensitive (menu_item) ||
@ -2105,7 +2115,7 @@ gtk_menu_item_ensure_label (GtkMenuItem *menu_item)
{ {
GtkWidget *accel_label; GtkWidget *accel_label;
if (!GTK_BIN (menu_item)->child) if (!gtk_bin_get_child (GTK_BIN (menu_item)))
{ {
accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
@ -2168,13 +2178,16 @@ void
gtk_menu_item_set_use_underline (GtkMenuItem *menu_item, gtk_menu_item_set_use_underline (GtkMenuItem *menu_item,
gboolean setting) gboolean setting)
{ {
GtkWidget *child;
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
gtk_menu_item_ensure_label (menu_item); gtk_menu_item_ensure_label (menu_item);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child)) child = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_LABEL (child))
{ {
gtk_label_set_use_underline (GTK_LABEL (GTK_BIN (menu_item)->child), setting); gtk_label_set_use_underline (GTK_LABEL (child), setting);
g_object_notify (G_OBJECT (menu_item), "use-underline"); g_object_notify (G_OBJECT (menu_item), "use-underline");
} }
@ -2195,12 +2208,15 @@ gtk_menu_item_set_use_underline (GtkMenuItem *menu_item,
gboolean gboolean
gtk_menu_item_get_use_underline (GtkMenuItem *menu_item) gtk_menu_item_get_use_underline (GtkMenuItem *menu_item)
{ {
GtkWidget *child;
g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), FALSE); g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), FALSE);
gtk_menu_item_ensure_label (menu_item); gtk_menu_item_ensure_label (menu_item);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child)) child = gtk_bin_get_child (GTK_BIN (menu_item));
return gtk_label_get_use_underline (GTK_LABEL (GTK_BIN (menu_item)->child)); if (GTK_IS_LABEL (child))
return gtk_label_get_use_underline (GTK_LABEL (child));
return FALSE; return FALSE;
} }

View File

@ -382,7 +382,7 @@ gtk_menu_tool_button_init (GtkMenuToolButton *button)
box = gtk_hbox_new (FALSE, 0); box = gtk_hbox_new (FALSE, 0);
real_button = GTK_BIN (button)->child; real_button = gtk_bin_get_child (GTK_BIN (button));
g_object_ref (real_button); g_object_ref (real_button);
gtk_container_remove (GTK_CONTAINER (button), real_button); gtk_container_remove (GTK_CONTAINER (button), real_button);
gtk_container_add (GTK_CONTAINER (box), real_button); gtk_container_add (GTK_CONTAINER (box), real_button);

View File

@ -3299,12 +3299,13 @@ on_drag_icon_expose (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
gpointer data) gpointer data)
{ {
GtkWidget *notebook, *child = GTK_WIDGET (data); GtkWidget *notebook, *child;
GtkRequisition requisition; GtkRequisition requisition;
gint gap_pos; gint gap_pos;
notebook = GTK_WIDGET (data); notebook = GTK_WIDGET (data);
child = GTK_BIN (widget)->child; child = gtk_bin_get_child (GTK_BIN (widget));
gtk_widget_size_request (widget, &requisition); gtk_widget_size_request (widget, &requisition);
gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook)); gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
@ -6276,7 +6277,7 @@ static void
gtk_notebook_menu_label_unparent (GtkWidget *widget, gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gtk_widget_unparent (GTK_BIN (widget)->child); gtk_widget_unparent (gtk_bin_get_child (GTK_BIN (widget)));
GTK_BIN (widget)->child = NULL; GTK_BIN (widget)->child = NULL;
} }

View File

@ -54,6 +54,7 @@ gtk_offscreen_window_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
gint border_width; gint border_width;
gint default_width, default_height; gint default_width, default_height;
@ -62,11 +63,12 @@ gtk_offscreen_window_size_request (GtkWidget *widget,
requisition->width = border_width * 2; requisition->width = border_width * 2;
requisition->height = border_width * 2; requisition->height = border_width * 2;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
{ {
GtkRequisition child_req; GtkRequisition child_req;
gtk_widget_size_request (bin->child, &child_req); gtk_widget_size_request (child, &child_req);
requisition->width += child_req.width; requisition->width += child_req.width;
requisition->height += child_req.height; requisition->height += child_req.height;
@ -86,6 +88,7 @@ gtk_offscreen_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
gint border_width; gint border_width;
widget->allocation = *allocation; widget->allocation = *allocation;
@ -99,7 +102,8 @@ gtk_offscreen_window_size_allocate (GtkWidget *widget,
allocation->width, allocation->width,
allocation->height); allocation->height);
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
{ {
GtkAllocation child_alloc; GtkAllocation child_alloc;
@ -108,7 +112,7 @@ gtk_offscreen_window_size_allocate (GtkWidget *widget,
child_alloc.width = allocation->width - 2 * border_width; child_alloc.width = allocation->width - 2 * border_width;
child_alloc.height = allocation->height - 2 * border_width; child_alloc.height = allocation->height - 2 * border_width;
gtk_widget_size_allocate (bin->child, &child_alloc); gtk_widget_size_allocate (child, &child_alloc);
} }
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
@ -118,6 +122,7 @@ static void
gtk_offscreen_window_realize (GtkWidget *widget) gtk_offscreen_window_realize (GtkWidget *widget)
{ {
GtkBin *bin; GtkBin *bin;
GtkWidget *child;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
gint border_width; gint border_width;
@ -144,8 +149,9 @@ gtk_offscreen_window_realize (GtkWidget *widget)
&attributes, attributes_mask); &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget); gdk_window_set_user_data (widget->window, widget);
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_set_parent_window (bin->child, widget->window); if (child)
gtk_widget_set_parent_window (child, widget->window);
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -705,13 +705,14 @@ gtk_plug_map (GtkWidget *widget)
{ {
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkPlug *plug = GTK_PLUG (widget); GtkPlug *plug = GTK_PLUG (widget);
GtkWidget *child;
gtk_widget_set_mapped (widget, TRUE); gtk_widget_set_mapped (widget, TRUE);
if (bin->child && child = gtk_bin_get_child (bin);
gtk_widget_get_visible (bin->child) && if (gtk_widget_get_visible (child) &&
!gtk_widget_get_mapped (bin->child)) !gtk_widget_get_mapped (child))
gtk_widget_map (bin->child); gtk_widget_map (child);
_gtk_plug_windowing_map_toplevel (plug); _gtk_plug_windowing_map_toplevel (plug);
@ -748,6 +749,8 @@ static void
gtk_plug_size_allocate (GtkWidget *widget, gtk_plug_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkWidget *child;
if (gtk_widget_is_toplevel (widget)) if (gtk_widget_is_toplevel (widget))
GTK_WIDGET_CLASS (gtk_plug_parent_class)->size_allocate (widget, allocation); GTK_WIDGET_CLASS (gtk_plug_parent_class)->size_allocate (widget, allocation);
else else
@ -761,7 +764,8 @@ gtk_plug_size_allocate (GtkWidget *widget,
allocation->x, allocation->y, allocation->x, allocation->y,
allocation->width, allocation->height); allocation->width, allocation->height);
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child))
{ {
GtkAllocation child_allocation; GtkAllocation child_allocation;
@ -771,7 +775,7 @@ gtk_plug_size_allocate (GtkWidget *widget,
child_allocation.height = child_allocation.height =
MAX (1, (gint)allocation->height - child_allocation.y * 2); MAX (1, (gint)allocation->height - child_allocation.y * 2);
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
} }
@ -947,6 +951,7 @@ gtk_plug_focus (GtkWidget *widget,
GtkPlug *plug = GTK_PLUG (widget); GtkPlug *plug = GTK_PLUG (widget);
GtkWindow *window = GTK_WINDOW (widget); GtkWindow *window = GTK_WINDOW (widget);
GtkContainer *container = GTK_CONTAINER (widget); GtkContainer *container = GTK_CONTAINER (widget);
GtkWidget *child;
GtkWidget *old_focus_child; GtkWidget *old_focus_child;
GtkWidget *parent; GtkWidget *parent;
@ -974,7 +979,8 @@ gtk_plug_focus (GtkWidget *widget,
else else
{ {
/* Try to focus the first widget in the window */ /* Try to focus the first widget in the window */
if (bin->child && gtk_widget_child_focus (bin->child, direction)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_child_focus (child, direction))
return TRUE; return TRUE;
} }

View File

@ -3719,7 +3719,7 @@ create_optional_page (GtkPrintUnixDialog *dialog,
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled),
table); table);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN(scrolled)->child), gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (scrolled))),
GTK_SHADOW_NONE); GTK_SHADOW_NONE);
label = gtk_label_new (text); label = gtk_label_new (text);
@ -3750,7 +3750,7 @@ create_advanced_page (GtkPrintUnixDialog *dialog)
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled),
main_vbox); main_vbox);
gtk_viewport_set_shadow_type (GTK_VIEWPORT (GTK_BIN(scrolled)->child), gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (scrolled))),
GTK_SHADOW_NONE); GTK_SHADOW_NONE);
priv->advanced_vbox = main_vbox; priv->advanced_vbox = main_vbox;

View File

@ -830,7 +830,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
x = widget->allocation.x + indicator_spacing + border_width; x = widget->allocation.x + indicator_spacing + border_width;
y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2; y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
child = GTK_BIN (check_button)->child; child = gtk_bin_get_child (GTK_BIN (check_button));
if (!interior_focus || !(child && gtk_widget_get_visible (child))) if (!interior_focus || !(child && gtk_widget_get_visible (child)))
x += focus_width + focus_pad; x += focus_width + focus_pad;

View File

@ -865,7 +865,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
/* ellipsize the menu item label, in case the recent document /* ellipsize the menu item label, in case the recent document
* display name is huge. * display name is huge.
*/ */
label = GTK_BIN (item)->child; label = gtk_bin_get_child (GTK_BIN (item));
if (GTK_IS_LABEL (label)) if (GTK_IS_LABEL (label))
{ {
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);

View File

@ -437,6 +437,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
GtkAdjustment *hadjustment) GtkAdjustment *hadjustment)
{ {
GtkBin *bin; GtkBin *bin;
GtkWidget *child;
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
if (hadjustment) if (hadjustment)
@ -477,9 +478,10 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
G_CALLBACK (gtk_scrolled_window_adjustment_changed), G_CALLBACK (gtk_scrolled_window_adjustment_changed),
scrolled_window); scrolled_window);
gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window); gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window);
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_set_scroll_adjustments (bin->child, if (child)
gtk_widget_set_scroll_adjustments (child,
gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)), gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)),
gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar))); gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)));
@ -498,6 +500,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
GtkAdjustment *vadjustment) GtkAdjustment *vadjustment)
{ {
GtkBin *bin; GtkBin *bin;
GtkWidget *child;
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
if (vadjustment) if (vadjustment)
@ -539,8 +542,9 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
scrolled_window); scrolled_window);
gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window); gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window);
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_set_scroll_adjustments (bin->child, if (child)
gtk_widget_set_scroll_adjustments (child,
gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)), gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)),
gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar))); gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)));
@ -1317,6 +1321,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
GtkBin *bin; GtkBin *bin;
GtkAllocation relative_allocation; GtkAllocation relative_allocation;
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkWidget *child;
gboolean scrollbars_within_bevel; gboolean scrollbars_within_bevel;
gint scrollbar_spacing; gint scrollbar_spacing;
guint border_width; guint border_width;
@ -1344,7 +1349,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
else if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER) else if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
scrolled_window->vscrollbar_visible = FALSE; scrolled_window->vscrollbar_visible = FALSE;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
gboolean previous_hvis; gboolean previous_hvis;
gboolean previous_vvis; gboolean previous_vvis;
@ -1362,7 +1368,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
previous_hvis = scrolled_window->hscrollbar_visible; previous_hvis = scrolled_window->hscrollbar_visible;
previous_vvis = scrolled_window->vscrollbar_visible; previous_vvis = scrolled_window->vscrollbar_visible;
gtk_widget_size_allocate (bin->child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
/* If, after the first iteration, the hscrollbar and the /* If, after the first iteration, the hscrollbar and the
* vscrollbar flip visiblity, then we need both. * vscrollbar flip visiblity, then we need both.
@ -1527,10 +1533,11 @@ gtk_scrolled_window_focus (GtkWidget *widget,
GtkDirectionType direction) GtkDirectionType direction)
{ {
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget); GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkWidget *child;
gboolean had_focus_child; gboolean had_focus_child;
had_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget)) != NULL; had_focus_child = gtk_container_get_focus_child (GTK_CONTAINER (widget)) != NULL;
if (scrolled_window->focus_out) if (scrolled_window->focus_out)
{ {
scrolled_window->focus_out = FALSE; /* Clear this to catch the wrap-around case */ scrolled_window->focus_out = FALSE; /* Clear this to catch the wrap-around case */
@ -1543,9 +1550,10 @@ gtk_scrolled_window_focus (GtkWidget *widget,
/* We only put the scrolled window itself in the focus chain if it /* We only put the scrolled window itself in the focus chain if it
* isn't possible to focus any children. * isn't possible to focus any children.
*/ */
if (GTK_BIN (widget)->child) child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
{ {
if (gtk_widget_child_focus (GTK_BIN (widget)->child, direction)) if (gtk_widget_child_focus (child, direction))
return TRUE; return TRUE;
} }
@ -1605,9 +1613,11 @@ gtk_scrolled_window_add (GtkContainer *container,
{ {
GtkScrolledWindow *scrolled_window; GtkScrolledWindow *scrolled_window;
GtkBin *bin; GtkBin *bin;
GtkWidget *child_widget;
bin = GTK_BIN (container); bin = GTK_BIN (container);
g_return_if_fail (bin->child == NULL); child_widget = gtk_bin_get_child (bin);
g_return_if_fail (child_widget == NULL);
scrolled_window = GTK_SCROLLED_WINDOW (container); scrolled_window = GTK_SCROLLED_WINDOW (container);
@ -1628,7 +1638,7 @@ gtk_scrolled_window_remove (GtkContainer *container,
{ {
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container)); g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
g_return_if_fail (child != NULL); g_return_if_fail (child != NULL);
g_return_if_fail (GTK_BIN (container)->child == child); g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == child);
gtk_widget_set_scroll_adjustments (child, NULL, NULL); gtk_widget_set_scroll_adjustments (child, NULL, NULL);
@ -1665,19 +1675,21 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
{ {
GtkBin *bin; GtkBin *bin;
GtkWidget *viewport; GtkWidget *viewport;
GtkWidget *child_widget;
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (child->parent == NULL); g_return_if_fail (child->parent == NULL);
bin = GTK_BIN (scrolled_window); bin = GTK_BIN (scrolled_window);
child_widget = gtk_bin_get_child (bin);
if (bin->child != NULL) if (child_widget)
{ {
g_return_if_fail (GTK_IS_VIEWPORT (bin->child)); g_return_if_fail (GTK_IS_VIEWPORT (child_widget));
g_return_if_fail (GTK_BIN (bin->child)->child == NULL); g_return_if_fail (gtk_bin_get_child (GTK_BIN (child_widget)) == NULL);
viewport = bin->child; viewport = child_widget;
} }
else else
{ {
@ -1747,6 +1759,7 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
GtkRequisition hscrollbar_requisition; GtkRequisition hscrollbar_requisition;
GtkRequisition vscrollbar_requisition; GtkRequisition vscrollbar_requisition;
GtkRequisition minimum_req, natural_req; GtkRequisition minimum_req, natural_req;
GtkWidget *child;
gint min_child_size, nat_child_size; gint min_child_size, nat_child_size;
guint border_width; guint border_width;
@ -1766,15 +1779,16 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
&hscrollbar_requisition); &hscrollbar_requisition);
gtk_widget_size_request (scrolled_window->vscrollbar, gtk_widget_size_request (scrolled_window->vscrollbar,
&vscrollbar_requisition); &vscrollbar_requisition);
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
if (orientation == GTK_ORIENTATION_HORIZONTAL) if (orientation == GTK_ORIENTATION_HORIZONTAL)
{ {
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin->child), gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
&min_child_size, &min_child_size,
&nat_child_size); &nat_child_size);
if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER) if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER)
{ {
minimum_req.width += min_child_size; minimum_req.width += min_child_size;
@ -1782,7 +1796,7 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
} }
else else
{ {
GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (bin->child, FALSE); GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (child, FALSE);
if (aux_info && aux_info->width > 0) if (aux_info && aux_info->width > 0)
{ {
@ -1799,10 +1813,10 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
} }
else /* GTK_ORIENTATION_VERTICAL */ else /* GTK_ORIENTATION_VERTICAL */
{ {
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin->child), gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
&min_child_size, &min_child_size,
&nat_child_size); &nat_child_size);
if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER) if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
{ {
minimum_req.height += min_child_size; minimum_req.height += min_child_size;
@ -1810,7 +1824,7 @@ gtk_scrolled_window_get_size (GtkSizeRequest *widget,
} }
else else
{ {
GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (bin->child, FALSE); GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (child, FALSE);
if (aux_info && aux_info->height > 0) if (aux_info && aux_info->height > 0)
{ {

View File

@ -988,6 +988,7 @@ _gtk_socket_advance_toplevel_focus (GtkSocket *socket,
GtkBin *bin; GtkBin *bin;
GtkWindow *window; GtkWindow *window;
GtkContainer *container; GtkContainer *container;
GtkWidget *child;
GtkWidget *toplevel; GtkWidget *toplevel;
GtkWidget *old_focus_child; GtkWidget *old_focus_child;
GtkWidget *parent; GtkWidget *parent;
@ -1039,9 +1040,10 @@ _gtk_socket_advance_toplevel_focus (GtkSocket *socket,
} }
/* Now try to focus the first widget in the window */ /* Now try to focus the first widget in the window */
if (bin->child) child = gtk_bin_get_child (bin);
if (child)
{ {
if (gtk_widget_child_focus (bin->child, direction)) if (gtk_widget_child_focus (child, direction))
return; return;
} }
} }

View File

@ -421,7 +421,7 @@ gtk_toggle_button_expose (GtkWidget *widget,
{ {
if (gtk_widget_is_drawable (widget)) if (gtk_widget_is_drawable (widget))
{ {
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
GtkButton *button = GTK_BUTTON (widget); GtkButton *button = GTK_BUTTON (widget);
GtkStateType state_type; GtkStateType state_type;
GtkShadowType shadow_type; GtkShadowType shadow_type;

View File

@ -311,6 +311,7 @@ static void
gtk_tool_button_construct_contents (GtkToolItem *tool_item) gtk_tool_button_construct_contents (GtkToolItem *tool_item)
{ {
GtkToolButton *button = GTK_TOOL_BUTTON (tool_item); GtkToolButton *button = GTK_TOOL_BUTTON (tool_item);
GtkWidget *child;
GtkWidget *label = NULL; GtkWidget *label = NULL;
GtkWidget *icon = NULL; GtkWidget *icon = NULL;
GtkToolbarStyle style; GtkToolbarStyle style;
@ -340,12 +341,13 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
button->priv->label_widget); button->priv->label_widget);
} }
if (GTK_BIN (button->priv->button)->child) child = gtk_bin_get_child (GTK_BIN (button->priv->button));
if (child)
{ {
/* Note: we are not destroying the label_widget or icon_widget /* Note: we are not destroying the label_widget or icon_widget
* here because they were removed from their containers above * here because they were removed from their containers above
*/ */
gtk_widget_destroy (GTK_BIN (button->priv->button)->child); gtk_widget_destroy (child);
} }
style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button)); style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
@ -781,7 +783,7 @@ gtk_tool_button_update_icon_spacing (GtkToolButton *button)
GtkWidget *box; GtkWidget *box;
guint spacing; guint spacing;
box = GTK_BIN (button->priv->button)->child; box = gtk_bin_get_child (GTK_BIN (button->priv->button));
if (GTK_IS_BOX (box)) if (GTK_IS_BOX (box))
{ {
gtk_widget_style_get (GTK_WIDGET (button), gtk_widget_style_get (GTK_WIDGET (button),

View File

@ -488,9 +488,10 @@ static void
gtk_tool_item_size_request (GtkWidget *widget, gtk_tool_item_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child;
guint border_width; guint border_width;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child)) if (child && gtk_widget_get_visible (child))
{ {
gtk_widget_size_request (child, requisition); gtk_widget_size_request (child, requisition);
@ -513,8 +514,9 @@ gtk_tool_item_size_allocate (GtkWidget *widget,
GtkToolItem *toolitem = GTK_TOOL_ITEM (widget); GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
GtkAllocation child_allocation; GtkAllocation child_allocation;
gint border_width; gint border_width;
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (widget));
widget->allocation = *allocation; widget->allocation = *allocation;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -1063,8 +1065,7 @@ gtk_tool_item_set_tooltip_text (GtkToolItem *tool_item,
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item)); g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
child = GTK_BIN (tool_item)->child; child = gtk_bin_get_child (GTK_BIN (tool_item));
if (child) if (child)
gtk_widget_set_tooltip_text (child, text); gtk_widget_set_tooltip_text (child, text);
} }
@ -1087,8 +1088,7 @@ gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item)); g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
child = GTK_BIN (tool_item)->child; child = gtk_bin_get_child (GTK_BIN (tool_item));
if (child) if (child)
gtk_widget_set_tooltip_markup (child, markup); gtk_widget_set_tooltip_markup (child, markup);
} }

View File

@ -909,10 +909,10 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if (! tree_column->button) if (! tree_column->button)
return; return;
hbox = GTK_BIN (tree_column->button)->child; hbox = gtk_bin_get_child (GTK_BIN (tree_column->button));
alignment = tree_column->alignment; alignment = tree_column->alignment;
arrow = tree_column->arrow; arrow = tree_column->arrow;
current_child = GTK_BIN (alignment)->child; current_child = gtk_bin_get_child (GTK_BIN (alignment));
/* Set up the actual button */ /* Set up the actual button */
gtk_alignment_set (GTK_ALIGNMENT (alignment), tree_column->xalign, gtk_alignment_set (GTK_ALIGNMENT (alignment), tree_column->xalign,

View File

@ -393,6 +393,7 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
GtkBin *bin = GTK_BIN (viewport); GtkBin *bin = GTK_BIN (viewport);
GtkAllocation view_allocation; GtkAllocation view_allocation;
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
GtkWidget *child;
gdouble old_page_size; gdouble old_page_size;
gdouble old_upper; gdouble old_upper;
gdouble old_value; gdouble old_value;
@ -408,11 +409,12 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
hadjustment->lower = 0; hadjustment->lower = 0;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
GtkRequisition child_requisition; GtkRequisition child_requisition;
gtk_widget_get_child_requisition (bin->child, &child_requisition); gtk_widget_get_child_requisition (child, &child_requisition);
hadjustment->upper = MAX (child_requisition.width, view_allocation.width); hadjustment->upper = MAX (child_requisition.width, view_allocation.width);
} }
else else
@ -436,6 +438,7 @@ viewport_set_vadjustment_values (GtkViewport *viewport,
GtkBin *bin = GTK_BIN (viewport); GtkBin *bin = GTK_BIN (viewport);
GtkAllocation view_allocation; GtkAllocation view_allocation;
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport); GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
GtkWidget *child;
viewport_get_view_allocation (viewport, &view_allocation); viewport_get_view_allocation (viewport, &view_allocation);
@ -445,14 +448,15 @@ viewport_set_vadjustment_values (GtkViewport *viewport,
vadjustment->lower = 0; vadjustment->lower = 0;
if (bin->child && gtk_widget_get_visible (bin->child)) child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{ {
gint natural_height; gint natural_height;
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (bin->child), gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
view_allocation.width, view_allocation.width,
NULL, NULL,
&natural_height); &natural_height);
vadjustment->upper = MAX (natural_height, view_allocation.height); vadjustment->upper = MAX (natural_height, view_allocation.height);
} }
else else
@ -632,12 +636,12 @@ gtk_viewport_realize (GtkWidget *widget)
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport); GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
guint border_width;
GtkAllocation view_allocation; GtkAllocation view_allocation;
GtkWidget *child;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
gint event_mask; gint event_mask;
guint border_width;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -686,8 +690,9 @@ gtk_viewport_realize (GtkWidget *widget)
viewport->bin_window = gdk_window_new (viewport->view_window, &attributes, attributes_mask); viewport->bin_window = gdk_window_new (viewport->view_window, &attributes, attributes_mask);
gdk_window_set_user_data (viewport->bin_window, viewport); gdk_window_set_user_data (viewport->bin_window, viewport);
if (bin->child) child = gtk_bin_get_child (bin);
gtk_widget_set_parent_window (bin->child, viewport->bin_window); if (child)
gtk_widget_set_parent_window (child, viewport->bin_window);
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
@ -767,7 +772,7 @@ gtk_viewport_add (GtkContainer *container,
{ {
GtkBin *bin = GTK_BIN (container); GtkBin *bin = GTK_BIN (container);
g_return_if_fail (bin->child == NULL); g_return_if_fail (gtk_bin_get_child (bin) == NULL);
gtk_widget_set_parent_window (child, GTK_VIEWPORT (bin)->bin_window); gtk_widget_set_parent_window (child, GTK_VIEWPORT (bin)->bin_window);
@ -785,6 +790,7 @@ gtk_viewport_size_allocate (GtkWidget *widget,
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);
GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport); GtkAdjustment *vadjustment = gtk_viewport_get_vadjustment (viewport);
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkWidget *child;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@ -827,8 +833,10 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation.width, child_allocation.width,
child_allocation.height); child_allocation.height);
} }
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_widget_size_allocate (bin->child, &child_allocation); child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation);
gtk_adjustment_changed (hadjustment); gtk_adjustment_changed (hadjustment);
gtk_adjustment_changed (vadjustment); gtk_adjustment_changed (vadjustment);
@ -844,8 +852,10 @@ gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
{ {
GtkViewport *viewport = GTK_VIEWPORT (data); GtkViewport *viewport = GTK_VIEWPORT (data);
GtkBin *bin = GTK_BIN (data); GtkBin *bin = GTK_BIN (data);
GtkWidget *child;
if (bin->child && gtk_widget_get_visible (bin->child) && child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child) &&
gtk_widget_get_realized (GTK_WIDGET (viewport))) gtk_widget_get_realized (GTK_WIDGET (viewport)))
{ {
GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport); GtkAdjustment *hadjustment = gtk_viewport_get_hadjustment (viewport);

View File

@ -4553,6 +4553,7 @@ gtk_window_hide (GtkWidget *widget)
static void static void
gtk_window_map (GtkWidget *widget) gtk_window_map (GtkWidget *widget)
{ {
GtkWidget *child;
GtkWindow *window = GTK_WINDOW (widget); GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window); GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
GdkWindow *toplevel; GdkWindow *toplevel;
@ -4560,10 +4561,11 @@ gtk_window_map (GtkWidget *widget)
gtk_widget_set_mapped (widget, TRUE); gtk_widget_set_mapped (widget, TRUE);
if (window->bin.child && child = gtk_bin_get_child (&(window->bin));
gtk_widget_get_visible (window->bin.child) && if (child &&
!gtk_widget_get_mapped (window->bin.child)) gtk_widget_get_visible (child) &&
gtk_widget_map (window->bin.child); !gtk_widget_get_mapped (child))
gtk_widget_map (child);
if (window->frame) if (window->frame)
toplevel = window->frame; toplevel = window->frame;
@ -4929,12 +4931,14 @@ gtk_window_size_allocate (GtkWidget *widget,
{ {
GtkWindow *window; GtkWindow *window;
GtkAllocation child_allocation; GtkAllocation child_allocation;
GtkWidget *child;
guint border_width; guint border_width;
window = GTK_WINDOW (widget); window = GTK_WINDOW (widget);
widget->allocation = *allocation; widget->allocation = *allocation;
if (window->bin.child && gtk_widget_get_visible (window->bin.child)) child = gtk_bin_get_child (&(window->bin));
if (child && gtk_widget_get_visible (child))
{ {
border_width = gtk_container_get_border_width (GTK_CONTAINER (window)); border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
child_allocation.x = border_width; child_allocation.x = border_width;
@ -4944,7 +4948,7 @@ gtk_window_size_allocate (GtkWidget *widget,
child_allocation.height = child_allocation.height =
MAX (1, (gint)allocation->height - child_allocation.y * 2); MAX (1, (gint)allocation->height - child_allocation.y * 2);
gtk_widget_size_allocate (window->bin.child, &child_allocation); gtk_widget_size_allocate (child, &child_allocation);
} }
if (gtk_widget_get_realized (widget) && window->frame) if (gtk_widget_get_realized (widget) && window->frame)
@ -5396,6 +5400,7 @@ gtk_window_focus (GtkWidget *widget,
GtkBin *bin; GtkBin *bin;
GtkWindow *window; GtkWindow *window;
GtkContainer *container; GtkContainer *container;
GtkWidget *child;
GtkWidget *old_focus_child; GtkWidget *old_focus_child;
GtkWidget *parent; GtkWidget *parent;
@ -5437,9 +5442,10 @@ gtk_window_focus (GtkWidget *widget,
} }
/* Now try to focus the first widget in the window */ /* Now try to focus the first widget in the window */
if (bin->child) child = gtk_bin_get_child (bin);
if (child)
{ {
if (gtk_widget_child_focus (bin->child, direction)) if (gtk_widget_child_focus (child, direction))
return TRUE; return TRUE;
} }

View File

@ -355,7 +355,7 @@ test_uimanager_simple (void)
g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0);
g_list_free (children); g_list_free (children);
label = G_OBJECT (GTK_BIN (menu)->child); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu)));
g_assert (GTK_IS_LABEL (label)); g_assert (GTK_IS_LABEL (label));
g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0); g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0);
@ -2292,7 +2292,7 @@ test_add_objects (void)
g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0);
g_list_free (children); g_list_free (children);
label = G_OBJECT (GTK_BIN (menu)->child); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu)));
g_assert (label != NULL); g_assert (label != NULL);
g_assert (GTK_IS_LABEL (label)); g_assert (GTK_IS_LABEL (label));
g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0); g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0);
@ -2319,7 +2319,7 @@ test_add_objects (void)
g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0); g_assert (strcmp (GTK_WIDGET (menu)->name, "file") == 0);
g_list_free (children); g_list_free (children);
label = G_OBJECT (GTK_BIN (menu)->child); label = G_OBJECT (gtk_bin_get_child (GTK_BIN (menu)));
g_assert (label != NULL); g_assert (label != NULL);
g_assert (GTK_IS_LABEL (label)); g_assert (GTK_IS_LABEL (label));
g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0); g_assert (strcmp (gtk_label_get_text (GTK_LABEL (label)), "File") == 0);
@ -2423,6 +2423,7 @@ test_menus (void)
"<object class=\"GtkAccelGroup\" id=\"accelgroup1\"/>" "<object class=\"GtkAccelGroup\" id=\"accelgroup1\"/>"
"</interface>"; "</interface>";
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *child;
GtkWidget *window, *item; GtkWidget *window, *item;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
GtkWidget *item_accel_label, *sample_accel_label, *sample_menu_item, *custom; GtkWidget *item_accel_label, *sample_accel_label, *sample_menu_item, *custom;
@ -2438,14 +2439,16 @@ test_menus (void)
sample_menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accel_group); sample_menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accel_group);
g_assert (GTK_BIN (sample_menu_item)->child); child = gtk_bin_get_child (GTK_BIN (sample_menu_item));
g_assert (GTK_IS_ACCEL_LABEL (GTK_BIN (sample_menu_item)->child)); g_assert (child);
sample_accel_label = GTK_WIDGET (GTK_BIN (sample_menu_item)->child); g_assert (GTK_IS_ACCEL_LABEL (child));
sample_accel_label = child;
gtk_widget_show (sample_accel_label); gtk_widget_show (sample_accel_label);
g_assert (GTK_BIN (item)->child); child = gtk_bin_get_child (GTK_BIN (item));
g_assert (GTK_IS_ACCEL_LABEL (GTK_BIN (item)->child)); g_assert (child);
item_accel_label = GTK_WIDGET (GTK_BIN (item)->child); g_assert (GTK_IS_ACCEL_LABEL (child));
item_accel_label = child;
gtk_accel_label_refetch (GTK_ACCEL_LABEL (sample_accel_label)); gtk_accel_label_refetch (GTK_ACCEL_LABEL (sample_accel_label));
gtk_accel_label_refetch (GTK_ACCEL_LABEL (item_accel_label)); gtk_accel_label_refetch (GTK_ACCEL_LABEL (item_accel_label));

View File

@ -34,7 +34,7 @@ test_click_expander (void)
gboolean expanded; gboolean expanded;
gboolean simsuccess; gboolean simsuccess;
gtk_container_add (GTK_CONTAINER (expander), label); gtk_container_add (GTK_CONTAINER (expander), label);
gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), expander); gtk_container_add (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window))), expander);
gtk_widget_show (expander); gtk_widget_show (expander);
gtk_widget_show (label); gtk_widget_show (label);
gtk_widget_show_now (window); gtk_widget_show_now (window);
@ -66,7 +66,7 @@ test_click_content_widget (void)
gboolean expanded; gboolean expanded;
gboolean simsuccess; gboolean simsuccess;
gtk_container_add (GTK_CONTAINER (expander), entry); gtk_container_add (GTK_CONTAINER (expander), entry);
gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), expander); gtk_container_add (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window))), expander);
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE); gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
gtk_widget_show (expander); gtk_widget_show (expander);
gtk_widget_show (entry); gtk_widget_show (entry);

View File

@ -74,9 +74,12 @@ test_button_keys (void)
static void static void
test_slider_ranges (void) test_slider_ranges (void)
{ {
GtkWidget *child;
GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: gtk_test_warp_slider"); GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: gtk_test_warp_slider");
GtkWidget *hscale = gtk_hscale_new_with_range (-50, +50, 5); GtkWidget *hscale = gtk_hscale_new_with_range (-50, +50, 5);
gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), hscale);
child = gtk_bin_get_child (GTK_BIN (window));
gtk_container_add (GTK_CONTAINER (child), hscale);
gtk_widget_show (hscale); gtk_widget_show (hscale);
gtk_widget_show_now (window); gtk_widget_show_now (window);
while (gtk_events_pending ()) while (gtk_events_pending ())
@ -128,10 +131,13 @@ test_xserver_sync (void)
{ {
GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: test_xserver_sync"); GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: test_xserver_sync");
GtkWidget *darea = gtk_drawing_area_new (); GtkWidget *darea = gtk_drawing_area_new ();
GtkWidget *child;
GTimer *gtimer = g_timer_new(); GTimer *gtimer = g_timer_new();
gint sync_is_slower = 0, repeat = 5; gint sync_is_slower = 0, repeat = 5;
child = gtk_bin_get_child (GTK_BIN (window));
gtk_widget_set_size_request (darea, 320, 200); gtk_widget_set_size_request (darea, 320, 200);
gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), darea); gtk_container_add (GTK_CONTAINER (child), darea);
gtk_widget_show (darea); gtk_widget_show (darea);
gtk_widget_show_now (window); gtk_widget_show_now (window);
while (repeat--) while (repeat--)
@ -171,11 +177,14 @@ test_xserver_sync (void)
static void static void
test_spin_button_arrows (void) test_spin_button_arrows (void)
{ {
GtkWidget *child;
GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: test_spin_button_arrows"); GtkWidget *window = gtk_test_create_simple_window ("Test Window", "Test: test_spin_button_arrows");
GtkWidget *spinner = gtk_spin_button_new_with_range (0, 100, 5); GtkWidget *spinner = gtk_spin_button_new_with_range (0, 100, 5);
gboolean simsuccess; gboolean simsuccess;
double oldval, newval; double oldval, newval;
gtk_container_add (GTK_CONTAINER (GTK_BIN (window)->child), spinner);
child = gtk_bin_get_child (GTK_BIN (window));
gtk_container_add (GTK_CONTAINER (child), spinner);
gtk_widget_show (spinner); gtk_widget_show (spinner);
gtk_widget_show_now (window); gtk_widget_show_now (window);
gtk_test_slider_set_perc (spinner, 0); gtk_test_slider_set_perc (spinner, 0);

View File

@ -1849,7 +1849,7 @@ status_window_set_text (StatusWindow *status_window,
if (!status_window->window) if (!status_window->window)
status_window_make_window (status_window); status_window_make_window (status_window);
label = GTK_BIN (status_window->window)->child; label = gtk_bin_get_child (GTK_BIN (status_window->window));
gtk_label_set_text (GTK_LABEL (label), text); gtk_label_set_text (GTK_LABEL (label), text);
gtk_widget_show (status_window->window); gtk_widget_show (status_window->window);

View File

@ -240,7 +240,7 @@ gail_button_is_default_press (GtkWidget *widget)
gboolean ret = FALSE; gboolean ret = FALSE;
const gchar *parent_type_name; const gchar *parent_type_name;
child = GTK_BIN (widget)->child; child = gtk_bin_get_child (GTK_BIN (widget));
if (GTK_IS_ARROW (child)) if (GTK_IS_ARROW (child))
{ {
g_object_get (child, g_object_get (child,

View File

@ -500,7 +500,7 @@ gail_label_ref_relation_set (AtkObject *obj)
{ {
GtkWidget *temp_widget; GtkWidget *temp_widget;
temp_widget = GTK_BIN (list->data)->child; temp_widget = gtk_bin_get_child (GTK_BIN (list->data));
if (GTK_IS_BUTTON (temp_widget)) if (GTK_IS_BUTTON (temp_widget))
mnemonic_widget = temp_widget; mnemonic_widget = temp_widget;
} }

View File

@ -520,7 +520,7 @@ gail_menu_item_get_keybinding (AtkAction *action,
* we get here. * we get here.
*/ */
key = NULL; key = NULL;
child = GTK_BIN (item)->child; child = gtk_bin_get_child (GTK_BIN (item));
if (GTK_IS_ACCEL_LABEL (child)) if (GTK_IS_ACCEL_LABEL (child))
{ {
GtkAccelLabel *accel_label; GtkAccelLabel *accel_label;

View File

@ -323,9 +323,10 @@ _gail_toplevel_remove_child (GailToplevel *toplevel,
static gboolean static gboolean
is_attached_menu_window (GtkWidget *widget) is_attached_menu_window (GtkWidget *widget)
{ {
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child;
gboolean ret = FALSE; gboolean ret = FALSE;
child = gtk_bin_get_child (GTK_BIN (widget));
if (GTK_IS_MENU (child)) if (GTK_IS_MENU (child))
{ {
GtkWidget *attach; GtkWidget *attach;
@ -342,19 +343,21 @@ is_attached_menu_window (GtkWidget *widget)
static gboolean static gboolean
is_combo_window (GtkWidget *widget) is_combo_window (GtkWidget *widget)
{ {
GtkWidget *child = GTK_BIN (widget)->child; GtkWidget *child;
AtkObject *obj; AtkObject *obj;
GtkAccessible *accessible; GtkAccessible *accessible;
child = gtk_bin_get_child (GTK_BIN (widget));
if (!GTK_IS_EVENT_BOX (child)) if (!GTK_IS_EVENT_BOX (child))
return FALSE; return FALSE;
child = GTK_BIN (child)->child; child = gtk_bin_get_child (GTK_BIN (child));
if (!GTK_IS_FRAME (child)) if (!GTK_IS_FRAME (child))
return FALSE; return FALSE;
child = GTK_BIN (child)->child; child = gtk_bin_get_child (GTK_BIN (child));
if (!GTK_IS_SCROLLED_WINDOW (child)) if (!GTK_IS_SCROLLED_WINDOW (child))
return FALSE; return FALSE;

View File

@ -375,6 +375,7 @@ static void
bool_changed (GObject *object, GParamSpec *pspec, gpointer data) bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
{ {
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data); GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data);
GtkWidget *child;
GValue val = { 0, }; GValue val = { 0, };
g_value_init (&val, G_TYPE_BOOLEAN); g_value_init (&val, G_TYPE_BOOLEAN);
@ -387,8 +388,9 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
unblock_controller (G_OBJECT (tb)); unblock_controller (G_OBJECT (tb));
} }
gtk_label_set_text (GTK_LABEL (GTK_BIN (tb)->child), g_value_get_boolean (&val) ? child = gtk_bin_get_child (GTK_BIN (tb));
"TRUE" : "FALSE"); gtk_label_set_text (GTK_LABEL (child),
g_value_get_boolean (&val) ? "TRUE" : "FALSE");
g_value_unset (&val); g_value_unset (&val);
} }

View File

@ -116,7 +116,7 @@ progress_timeout (GtkWidget *assistant)
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (assistant)); current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (assistant));
page = gtk_assistant_get_nth_page (GTK_ASSISTANT (assistant), current_page); page = gtk_assistant_get_nth_page (GTK_ASSISTANT (assistant), current_page);
progress = GTK_BIN (page)->child; progress = gtk_bin_get_child (GTK_BIN (page));
value = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress)); value = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress));
value += 0.1; value += 0.1;
@ -140,7 +140,7 @@ prepare_callback (GtkWidget *widget, GtkWidget *page)
{ {
GtkWidget *progress; GtkWidget *progress;
progress = GTK_BIN (page)->child; progress = gtk_bin_get_child (GTK_BIN (page));
gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE); gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.0); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.0);
gdk_threads_add_timeout (300, (GSourceFunc) progress_timeout, widget); gdk_threads_add_timeout (300, (GSourceFunc) progress_timeout, widget);

View File

@ -2840,7 +2840,7 @@ create_rotated_text (GtkWidget *widget)
g_signal_connect (drawing_area, "unrealize", g_signal_connect (drawing_area, "unrealize",
G_CALLBACK (on_rotated_text_unrealize), NULL); G_CALLBACK (on_rotated_text_unrealize), NULL);
gtk_widget_show_all (GTK_BIN (window)->child); gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (window)));
gtk_widget_set_size_request (drawing_area, DEFAULT_TEXT_RADIUS * 2, DEFAULT_TEXT_RADIUS * 2); gtk_widget_set_size_request (drawing_area, DEFAULT_TEXT_RADIUS * 2, DEFAULT_TEXT_RADIUS * 2);
gtk_widget_size_request (window, &requisition); gtk_widget_size_request (window, &requisition);
@ -4835,7 +4835,7 @@ static void
size_group_hsize_changed (GtkSpinButton *spin_button, size_group_hsize_changed (GtkSpinButton *spin_button,
GtkWidget *button) GtkWidget *button)
{ {
gtk_widget_set_size_request (GTK_BIN (button)->child, gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (button)),
gtk_spin_button_get_value_as_int (spin_button), gtk_spin_button_get_value_as_int (spin_button),
-1); -1);
} }
@ -4844,7 +4844,7 @@ static void
size_group_vsize_changed (GtkSpinButton *spin_button, size_group_vsize_changed (GtkSpinButton *spin_button,
GtkWidget *button) GtkWidget *button)
{ {
gtk_widget_set_size_request (GTK_BIN (button)->child, gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (button)),
-1, -1,
gtk_spin_button_get_value_as_int (spin_button)); gtk_spin_button_get_value_as_int (spin_button));
} }
@ -4900,7 +4900,7 @@ create_size_group_window (GdkScreen *screen,
gtk_size_group_add_widget (master_size_group, main_button); gtk_size_group_add_widget (master_size_group, main_button);
gtk_size_group_add_widget (hgroup1, main_button); gtk_size_group_add_widget (hgroup1, main_button);
gtk_size_group_add_widget (vgroup1, main_button); gtk_size_group_add_widget (vgroup1, main_button);
gtk_widget_set_size_request (GTK_BIN (main_button)->child, gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (main_button)),
SIZE_GROUP_INITIAL_SIZE, SIZE_GROUP_INITIAL_SIZE,
SIZE_GROUP_INITIAL_SIZE); SIZE_GROUP_INITIAL_SIZE);
@ -10464,7 +10464,8 @@ create_styles (GtkWidget *widget)
font_desc = pango_font_description_from_string ("Helvetica,Sans Oblique 18"); font_desc = pango_font_description_from_string ("Helvetica,Sans Oblique 18");
button = gtk_button_new_with_label ("Some Text"); button = gtk_button_new_with_label ("Some Text");
gtk_widget_modify_font (GTK_BIN (button)->child, font_desc); gtk_widget_modify_font (gtk_bin_get_child (GTK_BIN (button)),
font_desc);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Foreground:"); label = gtk_label_new ("Foreground:");
@ -10472,7 +10473,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text"); button = gtk_button_new_with_label ("Some Text");
gtk_widget_modify_fg (GTK_BIN (button)->child, GTK_STATE_NORMAL, &red); gtk_widget_modify_fg (gtk_bin_get_child (GTK_BIN (button)),
GTK_STATE_NORMAL, &red);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Background:"); label = gtk_label_new ("Background:");
@ -10532,7 +10534,7 @@ create_styles (GtkWidget *widget)
rc_style->ythickness = 5; rc_style->ythickness = 5;
gtk_widget_modify_style (button, rc_style); gtk_widget_modify_style (button, rc_style);
gtk_widget_modify_style (GTK_BIN (button)->child, rc_style); gtk_widget_modify_style (gtk_bin_get_child (GTK_BIN (button)), rc_style);
g_object_unref (rc_style); g_object_unref (rc_style);

View File

@ -57,6 +57,7 @@ create_menubar (GtkPackDirection pack_dir,
GtkPackDirection child_pack_dir, GtkPackDirection child_pack_dir,
gdouble angle) gdouble angle)
{ {
GtkWidget *child;
GtkWidget *menubar; GtkWidget *menubar;
GtkWidget *menuitem; GtkWidget *menuitem;
GtkWidget *menu; GtkWidget *menu;
@ -69,19 +70,22 @@ create_menubar (GtkPackDirection pack_dir,
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_HOME, NULL); menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_HOME, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); child = gtk_bin_get_child (GTK_BIN (menuitem));
gtk_label_set_angle (GTK_LABEL (child), angle);
menu = create_menu (2); menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_menu_item_new_with_label ("foo"); menuitem = gtk_menu_item_new_with_label ("foo");
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); child = gtk_bin_get_child (GTK_BIN (menuitem));
gtk_label_set_angle (GTK_LABEL (child), angle);
menu = create_menu (2); menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_menu_item_new_with_label ("bar"); menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); child = gtk_bin_get_child (GTK_BIN (menuitem));
gtk_label_set_angle (GTK_LABEL (child), angle);
menu = create_menu (2); menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);

View File

@ -130,7 +130,7 @@ main (int argc, char *argv[])
G_CALLBACK (get_screen_response), display_entry); G_CALLBACK (get_screen_response), display_entry);
gtk_widget_grab_focus (display_entry); gtk_widget_grab_focus (display_entry);
gtk_widget_show_all (GTK_BIN (dialog)->child); gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
while (!correct_second_display) while (!correct_second_display)
{ {

View File

@ -163,7 +163,7 @@ main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>"); button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>");
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (button)->child), TRUE); gtk_label_set_use_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), TRUE);
g_signal_connect (button, "clicked", G_CALLBACK (futz), NULL); g_signal_connect (button, "clicked", G_CALLBACK (futz), NULL);
g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL); g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400); gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);