diff --git a/ChangeLog b/ChangeLog index 81db898015..120c6cc7bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-10-28 Mark McLoughlin + + * gtk/gtkexpander.c: + (gtk_expander_class_init): hook up the destroy handler. + (gtk_expander_destroy), (gtk_expander_unrealize): + remove the expand/collapse timeout on destroy instead + of unrealize to avoid leaving the expander in a inconsistent + state when unrealizing during animation. + (gtk_expander_start_animation): remove realized check. + (gtk_expander_set_expanded): if the widget isn't realized, + expand immediately. + Tue Oct 28 09:44:16 2003 Owen Taylor * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 81db898015..120c6cc7bf 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +2003-10-28 Mark McLoughlin + + * gtk/gtkexpander.c: + (gtk_expander_class_init): hook up the destroy handler. + (gtk_expander_destroy), (gtk_expander_unrealize): + remove the expand/collapse timeout on destroy instead + of unrealize to avoid leaving the expander in a inconsistent + state when unrealizing during animation. + (gtk_expander_start_animation): remove realized check. + (gtk_expander_set_expanded): if the widget isn't realized, + expand immediately. + Tue Oct 28 09:44:16 2003 Owen Taylor * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 81db898015..120c6cc7bf 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +2003-10-28 Mark McLoughlin + + * gtk/gtkexpander.c: + (gtk_expander_class_init): hook up the destroy handler. + (gtk_expander_destroy), (gtk_expander_unrealize): + remove the expand/collapse timeout on destroy instead + of unrealize to avoid leaving the expander in a inconsistent + state when unrealizing during animation. + (gtk_expander_start_animation): remove realized check. + (gtk_expander_set_expanded): if the widget isn't realized, + expand immediately. + Tue Oct 28 09:44:16 2003 Owen Taylor * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 81db898015..120c6cc7bf 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +2003-10-28 Mark McLoughlin + + * gtk/gtkexpander.c: + (gtk_expander_class_init): hook up the destroy handler. + (gtk_expander_destroy), (gtk_expander_unrealize): + remove the expand/collapse timeout on destroy instead + of unrealize to avoid leaving the expander in a inconsistent + state when unrealizing during animation. + (gtk_expander_start_animation): remove realized check. + (gtk_expander_set_expanded): if the widget isn't realized, + expand immediately. + Tue Oct 28 09:44:16 2003 Owen Taylor * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 81db898015..120c6cc7bf 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +2003-10-28 Mark McLoughlin + + * gtk/gtkexpander.c: + (gtk_expander_class_init): hook up the destroy handler. + (gtk_expander_destroy), (gtk_expander_unrealize): + remove the expand/collapse timeout on destroy instead + of unrealize to avoid leaving the expander in a inconsistent + state when unrealizing during animation. + (gtk_expander_start_animation): remove realized check. + (gtk_expander_set_expanded): if the widget isn't realized, + expand immediately. + Tue Oct 28 09:44:16 2003 Owen Taylor * gtk/gtkxembed.c (_gtk_xembed_send_focus_message): Silently diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 4f44baa68b..8f739f0278 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -75,6 +75,8 @@ static void gtk_expander_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static void gtk_expander_destroy (GtkObject *object); + static void gtk_expander_realize (GtkWidget *widget); static void gtk_expander_unrealize (GtkWidget *widget); static void gtk_expander_size_request (GtkWidget *widget, @@ -145,18 +147,22 @@ static void gtk_expander_class_init (GtkExpanderClass *klass) { GObjectClass *gobject_class; + GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; parent_class = g_type_class_peek_parent (klass); gobject_class = (GObjectClass *) klass; + object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; gobject_class->set_property = gtk_expander_set_property; gobject_class->get_property = gtk_expander_get_property; + object_class->destroy = gtk_expander_destroy; + widget_class->realize = gtk_expander_realize; widget_class->unrealize = gtk_expander_unrealize; widget_class->size_request = gtk_expander_size_request; @@ -338,6 +344,20 @@ gtk_expander_get_property (GObject *object, } } +static void +gtk_expander_destroy (GtkObject *object) +{ + GtkExpanderPrivate *priv = GTK_EXPANDER (object)->priv; + + if (priv->animation_timeout) + { + g_source_remove (priv->animation_timeout); + priv->animation_timeout = 0; + } + + GTK_OBJECT_CLASS (parent_class)->destroy (object); +} + static void gtk_expander_realize (GtkWidget *widget) { @@ -388,12 +408,6 @@ gtk_expander_unrealize (GtkWidget *widget) priv->event_window = NULL; } - if (priv->animation_timeout) - { - g_source_remove (priv->animation_timeout); - priv->animation_timeout = 0; - } - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); } @@ -1176,9 +1190,6 @@ gtk_expander_start_animation (GtkExpander *expander) { GtkExpanderPrivate *priv = expander->priv; - if (!GTK_WIDGET_REALIZED (expander)) - return; - if (priv->animation_timeout) g_source_remove (priv->animation_timeout); @@ -1215,15 +1226,20 @@ gtk_expander_set_expanded (GtkExpander *expander, { priv->expanded = expanded; - if (GTK_WIDGET_VISIBLE (expander)) - gtk_expander_start_animation (expander); - - else if (GTK_BIN (expander)->child) + if (GTK_WIDGET_REALIZED (expander)) + { + gtk_expander_start_animation (expander); + } + else { priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED; - gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded); - gtk_widget_queue_resize (GTK_WIDGET (expander)); + + if (GTK_BIN (expander)->child) + { + gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded); + gtk_widget_queue_resize (GTK_WIDGET (expander)); + } } g_object_notify (G_OBJECT (expander), "expanded");