diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-10-06 23:06:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-10-06 23:07:35 -0400 |
commit | 2dfc03bdb532c14187aa14bf51adc1aec3b71b62 (patch) | |
tree | c7d22fbbea32b4de311e81b8cf6fa31860a81f1b | |
parent | c53f4bb3421f7b3ec06bf12c1fcdd95f75321aab (diff) | |
download | gtk+-2dfc03bdb532c14187aa14bf51adc1aec3b71b62.tar.gz |
GtkSidebar: Pick up the visible child from the stack
Same here: We need to synchronize the visible child with the
selected row when setting a stack on the sidebar. I've noticed
this problem in the sidebar example in gtk3-widget-factory.
-rw-r--r-- | gtk/gtksidebar.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtksidebar.c b/gtk/gtksidebar.c index 7e9fe6f35c..7ccc5218a8 100644 --- a/gtk/gtksidebar.c +++ b/gtk/gtksidebar.c @@ -327,8 +327,16 @@ static void populate_sidebar (GtkSidebar *sidebar) { GtkSidebarPrivate *priv = gtk_sidebar_get_instance_private (sidebar); + GtkWidget *widget, *row; gtk_container_foreach (GTK_CONTAINER (priv->stack), (GtkCallback)add_child, sidebar); + + widget = gtk_stack_get_visible_child (priv->stack); + if (widget) + { + row = g_hash_table_lookup (priv->rows, widget); + gtk_list_box_select_row (priv->list, GTK_LIST_BOX_ROW (row)); + } } static void |