gtkbin: replace internal api

This commit is contained in:
Stefan Sauer 2014-06-04 21:23:01 +02:00
parent aba6871dba
commit 0f4751c08e
6 changed files with 13 additions and 36 deletions

View File

@ -1434,8 +1434,7 @@ gtk_assistant_add (GtkContainer *container,
*/ */
if (!gtk_bin_get_child (GTK_BIN (container))) if (!gtk_bin_get_child (GTK_BIN (container)))
{ {
gtk_widget_set_parent (page, GTK_WIDGET (container)); GTK_CONTAINER_CLASS (gtk_assistant_parent_class)->add (container, page);
_gtk_bin_set_child (GTK_BIN (container), page);
return; return;
} }

View File

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

View File

@ -79,9 +79,6 @@ GType gtk_bin_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
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

@ -1587,13 +1587,10 @@ gtk_combo_box_add (GtkContainer *container,
if (priv->cell_view && if (priv->cell_view &&
gtk_widget_get_parent (priv->cell_view)) gtk_widget_get_parent (priv->cell_view))
{ {
gtk_widget_unparent (priv->cell_view); GTK_CONTAINER_CLASS (gtk_combo_box_parent_class)->remove (container, priv->cell_view);
_gtk_bin_set_child (GTK_BIN (container), NULL);
gtk_widget_queue_resize (GTK_WIDGET (container));
} }
gtk_widget_set_parent (widget, GTK_WIDGET (container)); GTK_CONTAINER_CLASS (gtk_combo_box_parent_class)->add (container, 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)
@ -1657,14 +1654,11 @@ gtk_combo_box_remove (GtkContainer *container,
if (widget == priv->cell_view) if (widget == priv->cell_view)
priv->cell_view = NULL; priv->cell_view = NULL;
gtk_widget_unparent (widget); GTK_CONTAINER_CLASS (gtk_combo_box_parent_class)->remove (container, widget);
_gtk_bin_set_child (GTK_BIN (container), NULL);
if (gtk_widget_in_destruction (GTK_WIDGET (combo_box))) if (gtk_widget_in_destruction (GTK_WIDGET (combo_box)))
return; return;
gtk_widget_queue_resize (GTK_WIDGET (container));
if (!priv->tree_view) if (!priv->tree_view)
appears_as_list = FALSE; appears_as_list = FALSE;
else else
@ -1682,8 +1676,7 @@ gtk_combo_box_remove (GtkContainer *container,
if (!priv->cell_view) if (!priv->cell_view)
{ {
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_CONTAINER_CLASS (gtk_combo_box_parent_class)->add (container, 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),
@ -4817,8 +4810,7 @@ gtk_combo_box_constructor (GType type,
priv->cell_view = gtk_cell_view_new_with_context (priv->area, NULL); priv->cell_view = gtk_cell_view_new_with_context (priv->area, NULL);
gtk_cell_view_set_fit_model (GTK_CELL_VIEW (priv->cell_view), TRUE); gtk_cell_view_set_fit_model (GTK_CELL_VIEW (priv->cell_view), TRUE);
gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), priv->model); gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), priv->model);
gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box)); GTK_CONTAINER_CLASS (gtk_combo_box_parent_class)->add (GTK_CONTAINER (combo_box),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);
gtk_combo_box_check_appearance (combo_box); gtk_combo_box_check_appearance (combo_box);

View File

@ -3717,7 +3717,8 @@ 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_set_child (GTK_BIN (priv->dnd_window), NULL); GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->remove (GTK_CONTAINER (priv->dnd_window),
gtk_bin_get_child (GTK_BIN (priv->dnd_window)));
gtk_widget_destroy (priv->dnd_window); gtk_widget_destroy (priv->dnd_window);
priv->dnd_window = NULL; priv->dnd_window = NULL;
@ -6904,8 +6905,8 @@ 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_get_child (GTK_BIN (widget))); GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->remove (GTK_CONTAINER (widget),
_gtk_bin_set_child (GTK_BIN (widget), NULL); gtk_bin_get_child (GTK_BIN (widget)));
} }
static void static void

View File

@ -2727,14 +2727,9 @@ gtk_scrolled_window_add (GtkContainer *container,
{ {
GtkScrolledWindowPrivate *priv; GtkScrolledWindowPrivate *priv;
GtkScrolledWindow *scrolled_window; GtkScrolledWindow *scrolled_window;
GtkBin *bin; GtkWidget *scrollable_child;
GtkWidget *child_widget, *scrollable_child;
GtkAdjustment *hadj, *vadj; GtkAdjustment *hadj, *vadj;
bin = GTK_BIN (container);
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);
priv = scrolled_window->priv; priv = scrolled_window->priv;
@ -2765,11 +2760,10 @@ gtk_scrolled_window_add (GtkContainer *container,
gtk_container_add (GTK_CONTAINER (scrollable_child), child); gtk_container_add (GTK_CONTAINER (scrollable_child), child);
} }
if (gtk_widget_get_realized (GTK_WIDGET (bin))) if (gtk_widget_get_realized (GTK_WIDGET (container)))
gtk_widget_set_parent_window (scrollable_child, priv->overshoot_window); gtk_widget_set_parent_window (scrollable_child, priv->overshoot_window);
_gtk_bin_set_child (bin, scrollable_child); GTK_CONTAINER_CLASS (gtk_scrolled_window_parent_class)->add (container, scrollable_child);
gtk_widget_set_parent (scrollable_child, GTK_WIDGET (bin));
g_object_set (scrollable_child, "hadjustment", hadj, "vadjustment", vadj, NULL); g_object_set (scrollable_child, "hadjustment", hadj, "vadjustment", vadj, NULL);
} }