revealer: Fully set the target state if unmapped during animation

If the revealer is told do animate and then unrealize itself, we do
(correctly) stop the animation, but used to do a shortcut where we
just set the target state as current.

Other things are dependent on the animation properly finishing though,
like the contained widget child visibility. This may lead to inconsistent
state where gtk_revealer_get_child_revealed() returns TRUE but the child
widget is unmapped, or vice-versa.

Fully finish the animation here, so the child state is coherent the next
time the revealer is mapped. We can also skip notifying on the property
since it will be handled by gtk_revealer_set_position().

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/316
This commit is contained in:
Carlos Garnacho 2018-12-19 19:26:04 +01:00
parent e105fefc49
commit 32ad0ffa0f

View File

@ -633,10 +633,7 @@ gtk_revealer_stop_animation (GtkRevealer *revealer)
{
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
if (priv->current_pos != priv->target_pos)
{
priv->current_pos = priv->target_pos;
g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_CHILD_REVEALED]);
}
gtk_revealer_set_position (revealer, priv->target_pos);
if (priv->tick_id != 0)
{
gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id);