summaryrefslogtreecommitdiff
path: root/gtk/gtktoolbutton.c
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2010-08-11 22:51:57 +0200
committerJavier Jardón <jjardon@gnome.org>2010-08-22 21:25:23 +0200
commit7e753a9a860daceb1372bfa85472987f21443dfa (patch)
tree6a99552d237b34b3d9b8658b4b6cbc620da93ddd /gtk/gtktoolbutton.c
parent5e2c9437429f12cab3476e7b76deda5888224b61 (diff)
downloadgtk+-7e753a9a860daceb1372bfa85472987f21443dfa.tar.gz
gtk/gtktoolbutton.c: use accessor functions to access GtkWidget
Diffstat (limited to 'gtk/gtktoolbutton.c')
-rw-r--r--gtk/gtktoolbutton.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index d0c850331d..bf61d25121 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -323,6 +323,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
guint icon_spacing;
GtkOrientation text_orientation = GTK_ORIENTATION_HORIZONTAL;
GtkSizeGroup *size_group = NULL;
+ GtkWidget *parent;
button->priv->contents_invalid = FALSE;
@@ -330,16 +331,24 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
"icon-spacing", &icon_spacing,
NULL);
- if (button->priv->icon_widget && button->priv->icon_widget->parent)
+ if (button->priv->icon_widget)
{
- gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
- button->priv->icon_widget);
+ parent = gtk_widget_get_parent (button->priv->icon_widget);
+ if (parent)
+ {
+ gtk_container_remove (GTK_CONTAINER (parent),
+ button->priv->icon_widget);
+ }
}
- if (button->priv->label_widget && button->priv->label_widget->parent)
+ if (button->priv->label_widget)
{
- gtk_container_remove (GTK_CONTAINER (button->priv->label_widget->parent),
- button->priv->label_widget);
+ parent = gtk_widget_get_parent (button->priv->label_widget);
+ if (parent)
+ {
+ gtk_container_remove (GTK_CONTAINER (parent),
+ button->priv->label_widget);
+ }
}
child = gtk_bin_get_child (GTK_BIN (button->priv->button));
@@ -1193,9 +1202,12 @@ gtk_tool_button_set_icon_widget (GtkToolButton *button,
{
if (button->priv->icon_widget)
{
- if (button->priv->icon_widget->parent)
- gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
- button->priv->icon_widget);
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (button->priv->icon_widget);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent),
+ button->priv->icon_widget);
g_object_unref (button->priv->icon_widget);
}
@@ -1234,10 +1246,13 @@ gtk_tool_button_set_label_widget (GtkToolButton *button,
{
if (button->priv->label_widget)
{
- if (button->priv->label_widget->parent)
- gtk_container_remove (GTK_CONTAINER (button->priv->label_widget->parent),
- button->priv->label_widget);
-
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (button->priv->label_widget);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent),
+ button->priv->label_widget);
+
g_object_unref (button->priv->label_widget);
}