[StWidget] Cancel transitions if duration is zero

The current code only sets up / updates transitions when the new
node's transition-duration is non-zero. It should cancel an
existing transition if the duration is 0.
This commit is contained in:
Florian Müllner 2010-06-08 20:14:53 +02:00
parent 7cc1cf3b4a
commit 0e40782723

View File

@ -220,6 +220,17 @@ st_widget_get_property (GObject *gobject,
} }
} }
static void
st_widget_remove_transition (StWidget *widget)
{
if (widget->priv->transition_animation)
{
g_object_run_dispose (G_OBJECT (widget->priv->transition_animation));
g_object_unref (widget->priv->transition_animation);
widget->priv->transition_animation = NULL;
}
}
static void static void
st_widget_dispose (GObject *gobject) st_widget_dispose (GObject *gobject)
{ {
@ -239,12 +250,7 @@ st_widget_dispose (GObject *gobject)
priv->theme_node = NULL; priv->theme_node = NULL;
} }
if (priv->transition_animation) st_widget_remove_transition (actor);
{
g_object_run_dispose (G_OBJECT (priv->transition_animation));
g_object_unref (priv->transition_animation);
priv->transition_animation = NULL;
}
if (priv->tooltip) if (priv->tooltip)
{ {
@ -1213,9 +1219,7 @@ static void
on_transition_completed (StThemeNodeTransition *transition, on_transition_completed (StThemeNodeTransition *transition,
StWidget *widget) StWidget *widget)
{ {
g_object_run_dispose (G_OBJECT (widget->priv->transition_animation)); st_widget_remove_transition (widget);
g_object_unref (widget->priv->transition_animation);
widget->priv->transition_animation = NULL;
} }
static void static void
@ -1253,6 +1257,10 @@ st_widget_recompute_style (StWidget *widget,
widget); widget);
} }
} }
else if (widget->priv->transition_animation)
{
st_widget_remove_transition (widget);
}
g_signal_emit (widget, signals[STYLE_CHANGED], 0); g_signal_emit (widget, signals[STYLE_CHANGED], 0);
widget->priv->is_style_dirty = FALSE; widget->priv->is_style_dirty = FALSE;