From 7702d2f8fcd8a8c81bbc5c556124303a04ecc522 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 14 Jul 1998 17:48:28 +0000 Subject: [PATCH] don't destroy a buttons child if it isn't a label. Tue Jul 14 19:12:12 1998 Tim Janik * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons child if it isn't a label. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkbutton.c | 18 ++++++++++-------- 8 files changed, 45 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a3a1d27bea..87d08235e2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Tue Jul 14 19:12:12 1998 Tim Janik + + * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons + child if it isn't a label. + Tue Jul 14 11:41:38 1998 Tim Janik * gtk/gtkdialog.h: diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index decbbe6812..d8002c62f1 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -234,16 +234,18 @@ gtk_button_set_arg (GtkObject *object, switch (arg_id) { - GtkWidget *label; + GtkWidget *child; case ARG_LABEL: - if (GTK_BIN (button)->child) - gtk_container_remove (GTK_CONTAINER (button), GTK_BIN (button)->child); - - label = gtk_label_new (GTK_VALUE_STRING(*arg) ? GTK_VALUE_STRING(*arg) : ""); - gtk_widget_show (label); - - gtk_container_add (GTK_CONTAINER (button), label); + child = GTK_BIN (button)->child; + if (!child) + child = gtk_widget_new (GTK_TYPE_LABEL, + "visible", TRUE, + "parent", button, + NULL); + if (GTK_IS_LABEL (child)) + gtk_label_set (GTK_LABEL (child), + GTK_VALUE_STRING (*arg) ? GTK_VALUE_STRING (*arg) : ""); break; case ARG_RELIEF: gtk_button_set_relief (button, GTK_VALUE_ENUM (*arg));