gtk-demo: Fix revealer demo

This only used by luck before. We are changing a property from the
::notify handler for that property. Now that GtkRevealer is notifying
the property when it stops animations on unmap, we end up in a life
lock situation where we never make it out of the notify queue.

Fix this by not restarting the animation if the widget is unmapped.
This commit is contained in:
Matthias Clasen
2016-05-07 16:22:13 -04:00
parent 3cba63b2f8
commit ac5b48e40c

View File

@ -11,12 +11,15 @@ static guint timeout = 0;
static void static void
change_direction (GtkRevealer *revealer) change_direction (GtkRevealer *revealer)
{
if (gtk_widget_get_mapped (GTK_WIDGET (revealer)))
{ {
gboolean revealed; gboolean revealed;
revealed = gtk_revealer_get_child_revealed (revealer); revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed); gtk_revealer_set_reveal_child (revealer, !revealed);
} }
}
static gboolean static gboolean
reveal_one (gpointer data) reveal_one (gpointer data)