Add _gtk_bin_set_widget() internal function

This commit is contained in:
Javier Jardón 2010-05-28 05:49:30 +02:00
parent 4427760bcc
commit 63d3b197c2
5 changed files with 18 additions and 8 deletions

View File

@ -277,3 +277,10 @@ gtk_bin_get_child (GtkBin *bin)
return bin->child; return bin->child;
} }
void
_gtk_bin_set_child (GtkBin *bin,
GtkWidget *widget)
{
bin->priv->child = widget;
}

View File

@ -65,6 +65,9 @@ GType gtk_bin_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_bin_get_child (GtkBin *bin); GtkWidget *gtk_bin_get_child (GtkBin *bin);
void _gtk_bin_set_child (GtkBin *bin,
GtkWidget *widget);
G_END_DECLS G_END_DECLS
#endif /* __GTK_BIN_H__ */ #endif /* __GTK_BIN_H__ */

View File

@ -935,7 +935,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
priv->cell_view = gtk_cell_view_new (); priv->cell_view = gtk_cell_view_new ();
gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box)); gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box));
GTK_BIN (combo_box)->child = priv->cell_view; _gtk_bin_set_child (GTK_BIN (combo_box), priv->cell_view);
gtk_widget_show (priv->cell_view); gtk_widget_show (priv->cell_view);
priv->width = 0; priv->width = 0;
@ -1222,12 +1222,12 @@ gtk_combo_box_add (GtkContainer *container,
if (priv->cell_view && priv->cell_view->parent) if (priv->cell_view && priv->cell_view->parent)
{ {
gtk_widget_unparent (priv->cell_view); gtk_widget_unparent (priv->cell_view);
GTK_BIN (container)->child = NULL; _gtk_bin_set_child (GTK_BIN (container), NULL);
gtk_widget_queue_resize (GTK_WIDGET (container)); gtk_widget_queue_resize (GTK_WIDGET (container));
} }
gtk_widget_set_parent (widget, GTK_WIDGET (container)); gtk_widget_set_parent (widget, GTK_WIDGET (container));
GTK_BIN (container)->child = widget; _gtk_bin_set_child (GTK_BIN (container), widget);
if (priv->cell_view && if (priv->cell_view &&
widget != priv->cell_view) widget != priv->cell_view)
@ -1265,7 +1265,7 @@ gtk_combo_box_remove (GtkContainer *container,
priv->cell_view = NULL; priv->cell_view = NULL;
gtk_widget_unparent (widget); gtk_widget_unparent (widget);
GTK_BIN (container)->child = NULL; _gtk_bin_set_child (GTK_BIN (container), NULL);
if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION) if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION)
return; return;
@ -1290,7 +1290,7 @@ gtk_combo_box_remove (GtkContainer *container,
{ {
priv->cell_view = gtk_cell_view_new (); priv->cell_view = gtk_cell_view_new ();
gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container)); gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container));
GTK_BIN (container)->child = priv->cell_view; _gtk_bin_set_child (GTK_BIN (container), priv->cell_view);
gtk_widget_show (priv->cell_view); gtk_widget_show (priv->cell_view);
gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view),

View File

@ -3372,7 +3372,7 @@ gtk_notebook_drag_end (GtkWidget *widget,
if (priv->detached_tab) if (priv->detached_tab)
gtk_notebook_switch_page (notebook, priv->detached_tab); gtk_notebook_switch_page (notebook, priv->detached_tab);
GTK_BIN (priv->dnd_window)->child = NULL; _gtk_bin_set_child (GTK_BIN (priv->dnd_window), NULL);
gtk_widget_destroy (priv->dnd_window); gtk_widget_destroy (priv->dnd_window);
priv->dnd_window = NULL; priv->dnd_window = NULL;
@ -6278,7 +6278,7 @@ gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data) gpointer data)
{ {
gtk_widget_unparent (gtk_bin_get_child (GTK_BIN (widget))); gtk_widget_unparent (gtk_bin_get_child (GTK_BIN (widget)));
GTK_BIN (widget)->child = NULL; _gtk_bin_set_child (GTK_BIN (widget), NULL);
} }
static void static void

View File

@ -1621,7 +1621,7 @@ gtk_scrolled_window_add (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container); scrolled_window = GTK_SCROLLED_WINDOW (container);
bin->child = child; _gtk_bin_set_child (bin, child);
gtk_widget_set_parent (child, GTK_WIDGET (bin)); gtk_widget_set_parent (child, GTK_WIDGET (bin));
/* this is a temporary message */ /* this is a temporary message */