summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMark McLoughlin <mark@skynet.ie>2003-10-28 15:32:21 +0000
committerMark McLoughlin <markmc@src.gnome.org>2003-10-28 15:32:21 +0000
commit6ccf2d2d09ad77f736ed827f34b6695804e882fe (patch)
tree9f11dab0bcf740a6cae3c3ac0836f18aae27847c /gtk
parent5f9345d82996ddf40523fb2ee303dd79f8325457 (diff)
downloadgdk-pixbuf-6ccf2d2d09ad77f736ed827f34b6695804e882fe.tar.gz
hook up the destroy handler. (gtk_expander_destroy),
2003-10-28 Mark McLoughlin <mark@skynet.ie> * 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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkexpander.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 4f44baa68..8f739f027 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;
@@ -339,6 +345,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)
{
GtkExpanderPrivate *priv;
@@ -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");