Commit 4427760b authored by Javier Jardón's avatar Javier Jardón

Use GtkBin accessors

parent 2de1f3f8
......@@ -252,7 +252,7 @@ open_display_cb (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 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)
{
......
......@@ -435,7 +435,7 @@ do_combobox (GtkWidget *do_widget)
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
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);
}
......
......@@ -279,13 +279,15 @@ create_combo_box_entry (void)
{
GtkWidget *widget;
GtkWidget *align;
GtkWidget *child;
gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n"
" GtkComboBox::appears-as-list = 1\n"
"}\n"
"widget_class \"GtkComboBoxEntry\" style \"combo-box-entry-style\"\n" );
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);
gtk_container_add (GTK_CONTAINER (align), widget);
......
......@@ -428,6 +428,8 @@ gtk_alignment_set (GtkAlignment *alignment,
gfloat xscale,
gfloat yscale)
{
GtkWidget *child;
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
xalign = CLAMP (xalign, 0.0, 1.0);
......@@ -463,8 +465,9 @@ gtk_alignment_set (GtkAlignment *alignment,
}
g_object_thaw_notify (G_OBJECT (alignment));
if (GTK_BIN (alignment)->child)
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
child = gtk_bin_get_child (GTK_BIN (alignment));
if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment));
}
}
......@@ -477,6 +480,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
GtkAlignment *alignment;
GtkBin *bin;
GtkAllocation child_allocation;
GtkWidget *bin_child;
gint width, height;
guint border_width;
gint padding_horizontal, padding_vertical;
......@@ -488,10 +492,11 @@ gtk_alignment_size_allocate (GtkWidget *widget,
widget->allocation = *allocation;
alignment = GTK_ALIGNMENT (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_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;
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)
{
GtkAlignmentPrivate *priv;
GtkWidget *child;
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));
/* Make sure that the widget and children are redrawn with the new setting: */
if (GTK_BIN (alignment)->child)
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
child = gtk_bin_get_child (GTK_BIN (alignment));
if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment));
}
......
......@@ -336,9 +336,11 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
GtkAspectFramePriv *priv = aspect_frame->priv;
GtkBin *bin = GTK_BIN (frame);
GtkWidget *child;
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;
......@@ -346,7 +348,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
{
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)
{
ratio = ((gdouble) child_requisition.width /
......
......@@ -625,7 +625,7 @@ gtk_button_constructor (GType type,
static GType
gtk_button_child_type (GtkContainer *container)
{
if (!GTK_BIN (container)->child)
if (!gtk_bin_get_child (GTK_BIN (container)))
return GTK_TYPE_WIDGET;
else
return G_TYPE_NONE;
......@@ -798,6 +798,7 @@ static void
activatable_update_short_label (GtkButton *button,
GtkAction *action)
{
GtkWidget *child;
GtkWidget *image;
if (gtk_button_get_use_stock (button))
......@@ -806,9 +807,10 @@ activatable_update_short_label (GtkButton *button,
image = gtk_button_get_image (button);
/* Dont touch custom child... */
child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_IMAGE (image) ||
GTK_BIN (button)->child == NULL ||
GTK_IS_LABEL (GTK_BIN (button)->child))
child == NULL ||
GTK_IS_LABEL (child))
{
gtk_button_set_label (button, gtk_action_get_short_label (action));
gtk_button_set_use_underline (button, TRUE);
......@@ -975,6 +977,7 @@ gtk_button_construct_child (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkStockItem item;
GtkWidget *child;
GtkWidget *label;
GtkWidget *box;
GtkWidget *align;
......@@ -1001,9 +1004,9 @@ gtk_button_construct_child (GtkButton *button)
priv->image = NULL;
if (GTK_BIN (button)->child)
gtk_container_remove (GTK_CONTAINER (button),
GTK_BIN (button)->child);
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gtk_container_remove (GTK_CONTAINER (button), child);
if (button->use_stock &&
button->label_text &&
......@@ -1353,10 +1356,10 @@ gtk_button_update_image_spacing (GtkButton *button)
if (!button->constructed || !priv->image)
return;
child = GTK_BIN (button)->child;
child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_ALIGNMENT (child))
{
child = GTK_BIN (child)->child;
child = gtk_bin_get_child (GTK_BIN (child));
if (GTK_IS_BOX (child))
{
gtk_widget_style_get (GTK_WIDGET (button),
......@@ -1434,6 +1437,7 @@ gtk_button_size_allocate (GtkWidget *widget,
{
GtkButton *button = GTK_BUTTON (widget);
GtkAllocation child_allocation;
GtkWidget *child;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
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.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.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;
}
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->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_notify (G_OBJECT (button), "xalign");
......
......@@ -458,7 +458,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
g_object_get (cell_text, "text", &text, NULL);
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);
g_free (text);
}
......
......@@ -150,7 +150,7 @@ gtk_check_button_paint (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (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))
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),
&indicator_size, &indicator_spacing);
child = GTK_BIN (widget)->child;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
......@@ -248,6 +248,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
if (toggle_button->draw_indicator)
{
GtkWidget *child;
gint indicator_size;
gint indicator_spacing;
gint focus_width;
......@@ -264,13 +265,14 @@ gtk_check_button_size_allocate (GtkWidget *widget,
gdk_window_move_resize (button->event_window,
allocation->x, allocation->y,
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;
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,
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 + child_allocation.width);
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
gtk_widget_size_allocate (child, &child_allocation);
}
}
else
......@@ -304,6 +306,7 @@ gtk_check_button_expose (GtkWidget *widget,
{
GtkToggleButton *toggle_button;
GtkBin *bin;
GtkWidget *child;
toggle_button = GTK_TOGGLE_BUTTON (widget);
bin = GTK_BIN (widget);
......@@ -313,10 +316,11 @@ gtk_check_button_expose (GtkWidget *widget,
if (toggle_button->draw_indicator)
{
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),
bin->child,
child,
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;
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)))
x += focus_width + focus_pad;
......
......@@ -1182,6 +1182,7 @@ gtk_combo_box_style_set (GtkWidget *widget,
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
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),
&widget->style->base[gtk_widget_get_state (widget)]);
if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child))
g_object_set (GTK_BIN (combo_box)->child, "shadow-type",
child = gtk_bin_get_child (GTK_BIN (combo_box));
if (GTK_IS_ENTRY (child))
g_object_set (child, "shadow-type",
GTK_SHADOW_NONE == priv->shadow_type ?
GTK_SHADOW_IN : GTK_SHADOW_NONE, NULL);
}
......@@ -1489,7 +1491,7 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
GdkRectangle monitor;
/* 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;
......@@ -1791,7 +1793,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
for (child = children; child; child = child->next)
{
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))
continue;
......@@ -2175,7 +2177,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
GtkComboBoxPrivate *priv = combo_box->priv;
/* 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);
bin_req.width = MAX (bin_req.width, priv->width);
bin_req.height = MAX (bin_req.height, priv->height);
......@@ -2186,7 +2188,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
"arrow-size", &arrow_size,
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);
metrics = pango_context_get_metrics (context, font_desc,
pango_context_get_language (context));
......@@ -2297,6 +2299,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
{
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child_widget;
gint shadow_width, shadow_height;
gint focus_width, focus_pad;
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;
widget->allocation = *allocation;
child_widget = gtk_bin_get_child (GTK_BIN (widget));
gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width,
......@@ -2408,7 +2412,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = MAX (1, child.width);
child.height = MAX (1, child.height);
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
gtk_widget_size_allocate (child_widget, &child);
}
else
{
......@@ -2422,7 +2426,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = allocation->width - req.width - 2 * shadow_width;
child.width = MAX (1, child.width);
child.height = MAX (1, child.height);
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
gtk_widget_size_allocate (child_widget, &child);
}
}
else
......@@ -2488,7 +2492,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
child.width = MAX (1, child.width);
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);
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
if (include_internals)
{
......@@ -2552,8 +2557,9 @@ gtk_combo_box_forall (GtkContainer *container,
(* callback) (priv->cell_view_frame, callback_data);
}
if (GTK_BIN (container)->child)
(* callback) (GTK_BIN (container)->child, callback_data);
child = gtk_bin_get_child (GTK_BIN (container));
if (child)
(* callback) (child, callback_data);
}
static void
......@@ -2603,7 +2609,8 @@ gtk_combo_box_expose_event (GtkWidget *widget,
}
gtk_container_propagate_expose (GTK_CONTAINER (widget),
GTK_BIN (widget)->child, event);
gtk_bin_get_child (GTK_BIN (widget)),
event);
return FALSE;
}
......@@ -2883,8 +2890,11 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
gboolean add_children)
{
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *child;
GtkWidget *menu;
child = gtk_bin_get_child (GTK_BIN (combo_box));
if (priv->cell_view)
{
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_CALLBACK (gtk_combo_box_button_toggled), combo_box);
gtk_widget_set_parent (priv->button,
GTK_BIN (combo_box)->child->parent);
gtk_widget_get_parent (child));
priv->box = gtk_hbox_new (FALSE, 0);
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_CALLBACK (gtk_combo_box_button_toggled), combo_box);
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);
gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow);
......@@ -3259,7 +3269,7 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
GtkTreePath *path;
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));
......@@ -3440,6 +3450,7 @@ find_menu_by_path (GtkWidget *menu,
gboolean skip_first)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *item;
GtkWidget *submenu;
GtkTreeRowReference *mref;
......@@ -3451,6 +3462,7 @@ find_menu_by_path (GtkWidget *menu,
item = NULL;
for (i = list; i; i = i->next)
{
child = gtk_bin_get_child (i->data);
if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
{
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
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)
{
......@@ -3469,7 +3481,7 @@ find_menu_by_path (GtkWidget *menu,
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
continue;
......@@ -3580,7 +3592,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
combo_box);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
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 (separator);
......@@ -3747,11 +3759,13 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
GtkComboBoxPrivate *priv = combo_box->priv;
GtkTreeSelection *sel;
GtkStyle *style;
GtkWidget *child;
GtkWidget *widget = GTK_WIDGET (combo_box);
priv->button = gtk_toggle_button_new ();
child = gtk_bin_get_child (GTK_BIN (combo_box));
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_CALLBACK (gtk_combo_box_list_button_pressed), combo_box);
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),
FALSE);
}
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_widget_show_all (priv->cell_view_frame);
......@@ -4262,14 +4276,15 @@ pack_start_recurse (GtkWidget *menu,
gboolean expand)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
cell, expand);
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (child),
cell, expand);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
......@@ -4316,14 +4331,15 @@ pack_end_recurse (GtkWidget *menu,
gboolean expand)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
cell, expand);
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (child),
cell, expand);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
......@@ -4385,13 +4401,14 @@ static void
clear_recurse (GtkWidget *menu)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_clear (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child));
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_clear (GTK_CELL_LAYOUT (child));
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
......@@ -4437,14 +4454,15 @@ add_attribute_recurse (GtkWidget *menu,
gint column)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
cell, attribute, column);
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (child),
cell, attribute, column);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
......@@ -4520,7 +4538,7 @@ set_cell_data_func_recurse (GtkWidget *menu,
list = gtk_container_get_children (GTK_CONTAINER (menu));
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))
{
/* Override sensitivity for inner nodes; we don't
......@@ -4582,15 +4600,15 @@ clear_attributes_recurse (GtkWidget *menu,
GtkCellRenderer *cell)
{
GList *i, *list;
GtkWidget *submenu;
GtkWidget *submenu;
GtkWidget *child;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
cell);
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (child), cell);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
clear_attributes_recurse (submenu, cell);
......@@ -4640,15 +4658,16 @@ reorder_recurse (GtkWidget *menu,
gint position)
{
GList *i, *list;
GtkWidget *child;
GtkWidget *submenu;
list = gtk_container_get_children (GTK_CONTAINER (menu));
for (i = list; i; i = i->next)
{
if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
cell, position);
child = gtk_bin_get_child (GTK_BIN (i->data));
gtk_cell_layout_reorder (GTK_CELL_LAYOUT (child),
cell, position);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
if (submenu != NULL)
reorder_recurse (submenu, cell, position);
......@@ -5670,6 +5689,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable);
GtkWidget *child;
combo_box->priv->is_cell_renderer = TRUE;
......@@ -5683,11 +5703,13 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
}
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),
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);
}
......
......@@ -226,7 +226,10 @@ static void
gtk_combo_box_entry_remove (GtkContainer *container,
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,
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))
{
GtkEntry *entry = GTK_ENTRY (GTK_BIN (combo_box)->child);
GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box)));
if (entry)