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