GtkStackSwitcher: Pick up the visible child from the stack

We forgot to synchronize the visible child when setting a
stack on the switcher. Oops.
This commit is contained in:
Matthias Clasen 2014-10-06 23:06:09 -04:00
parent ba63f95a4a
commit c53f4bb342

View File

@ -292,9 +292,17 @@ static void
populate_switcher (GtkStackSwitcher *self) populate_switcher (GtkStackSwitcher *self)
{ {
GtkStackSwitcherPrivate *priv; GtkStackSwitcherPrivate *priv;
GtkWidget *widget, *button;
priv = gtk_stack_switcher_get_instance_private (self); priv = gtk_stack_switcher_get_instance_private (self);
gtk_container_foreach (GTK_CONTAINER (priv->stack), (GtkCallback)add_child, 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 static void