[gtk+] gtk-demo: Fix revealer demo



commit ac5b48e40c7ab54b168627e389817030ef6c1620
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 7 16:22:13 2016 -0400

    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.

 demos/gtk-demo/revealer.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/revealer.c b/demos/gtk-demo/revealer.c
index 23092d0..2cccb7a 100644
--- a/demos/gtk-demo/revealer.c
+++ b/demos/gtk-demo/revealer.c
@@ -12,10 +12,13 @@ static guint timeout = 0;
 static void
 change_direction (GtkRevealer *revealer)
 {
-  gboolean revealed;
+  if (gtk_widget_get_mapped (GTK_WIDGET (revealer)))
+    {
+      gboolean revealed;
 
-  revealed = gtk_revealer_get_child_revealed (revealer);
-  gtk_revealer_set_reveal_child (revealer, !revealed);
+      revealed = gtk_revealer_get_child_revealed (revealer);
+      gtk_revealer_set_reveal_child (revealer, !revealed);
+    }
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]