[gtk+/gtk-3-14] GtkStackSwitcher: Pick up the visible child from the stack



commit ea205f75d20ac184d8aa05fc4700dde45e9110d6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 6 23:06:09 2014 -0400

    GtkStackSwitcher: Pick up the visible child from the stack
    
    We forgot to synchronize the visible child when setting a
    stack on the switcher. Oops.

 gtk/gtkstackswitcher.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index 9a114bc..42e683f 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -292,9 +292,17 @@ static void
 populate_switcher (GtkStackSwitcher *self)
 {
   GtkStackSwitcherPrivate *priv;
+  GtkWidget *widget, *button;
 
   priv = gtk_stack_switcher_get_instance_private (self);
   gtk_container_foreach (GTK_CONTAINER (priv->stack), (GtkCallback)add_child, self);
+
+  widget = gtk_stack_get_visible_child (priv->stack);
+  if (widget)
+    {
+      button = g_hash_table_lookup (priv->buttons, widget);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+    }
 }
 
 static void


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