[gtk+/gtk-3-16] GtkStackSwitcher: Don't emit notify::visible-child when setting a stack



commit 9270638f38ec06654c7d4b008ddbcdfdf9cb8753
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed May 6 16:53:43 2015 +0200

    GtkStackSwitcher: Don't emit notify::visible-child when setting a stack
    
    Synchronizing the visible child with the switcher's toggle buttons can
    lead to GtkButton::clicked being emitted twice. Once for the button
    that was active before, and once for the button that we just activated.
    This leads to notify::visible-child being called twice and one of
    them is with the wrong child.
    
    Let's deal with this in the same way we handle the visible child
    changing underneath us.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749021

 gtk/gtkstackswitcher.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index 42e41bb..f2932a9 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -300,7 +300,9 @@ populate_switcher (GtkStackSwitcher *self)
   if (widget)
     {
       button = g_hash_table_lookup (priv->buttons, widget);
+      priv->in_child_changed = TRUE;
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+      priv->in_child_changed = FALSE;
     }
 }
 


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