From c53f4bb3421f7b3ec06bf12c1fcdd95f75321aab Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 6 Oct 2014 23:06:09 -0400 Subject: [PATCH] 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 file changed, 8 insertions(+) diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c index 9a114bcb43..42e683f5e2 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