[gtk+/refactor: 38/106] Add _gtk_bin_set_widget() internal function
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 38/106] Add _gtk_bin_set_widget() internal function
- Date: Tue, 13 Jul 2010 17:33:12 +0000 (UTC)
commit 1d31145eac9007b5bb17292daa85c096e44ce580
Author: Javier Jardón <jjardon gnome org>
Date: Fri May 28 05:49:30 2010 +0200
Add _gtk_bin_set_widget() internal function
gtk/gtkbin.c | 7 +++++++
gtk/gtkbin.h | 3 +++
gtk/gtkcombobox.c | 10 +++++-----
gtk/gtknotebook.c | 4 ++--
gtk/gtkscrolledwindow.c | 2 +-
5 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index bef71f5..95d814e 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -277,3 +277,10 @@ gtk_bin_get_child (GtkBin *bin)
return bin->child;
}
+
+void
+_gtk_bin_set_child (GtkBin *bin,
+ GtkWidget *widget)
+{
+ bin->priv->child = widget;
+}
diff --git a/gtk/gtkbin.h b/gtk/gtkbin.h
index 7db2a5a..9a3a460 100644
--- a/gtk/gtkbin.h
+++ b/gtk/gtkbin.h
@@ -65,6 +65,9 @@ GType gtk_bin_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_bin_get_child (GtkBin *bin);
+void _gtk_bin_set_child (GtkBin *bin,
+ GtkWidget *widget);
+
G_END_DECLS
#endif /* __GTK_BIN_H__ */
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 500662d..d91561a 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -935,7 +935,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
priv->cell_view = gtk_cell_view_new ();
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);
priv->width = 0;
@@ -1222,12 +1222,12 @@ gtk_combo_box_add (GtkContainer *container,
if (priv->cell_view && priv->cell_view->parent)
{
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_set_parent (widget, GTK_WIDGET (container));
- GTK_BIN (container)->child = widget;
+ _gtk_bin_set_child (GTK_BIN (container), widget);
if (priv->cell_view &&
widget != priv->cell_view)
@@ -1265,7 +1265,7 @@ gtk_combo_box_remove (GtkContainer *container,
priv->cell_view = NULL;
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)
return;
@@ -1290,7 +1290,7 @@ gtk_combo_box_remove (GtkContainer *container,
{
priv->cell_view = gtk_cell_view_new ();
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_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view),
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index ef561bc..56fa0d1 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3371,7 +3371,7 @@ gtk_notebook_drag_end (GtkWidget *widget,
if (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);
priv->dnd_window = NULL;
@@ -6277,7 +6277,7 @@ gtk_notebook_menu_label_unparent (GtkWidget *widget,
gpointer data)
{
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
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index b22f005..6bbe37b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1621,7 +1621,7 @@ gtk_scrolled_window_add (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container);
- bin->child = child;
+ _gtk_bin_set_child (bin, child);
gtk_widget_set_parent (child, GTK_WIDGET (bin));
/* this is a temporary message */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]