diff --git a/lib/SettingsSidebar.vala b/lib/SettingsSidebar.vala index f12b19b9..2673f641 100644 --- a/lib/SettingsSidebar.vala +++ b/lib/SettingsSidebar.vala @@ -120,9 +120,7 @@ public class Switchboard.SettingsSidebar : Gtk.Widget { } }); - stack.notify["visible-child-name"].connect (() => { - visible_child_name = stack.visible_child_name; - }); + stack.notify["visible-child"].connect (update_selection); bind_property ("show-title-buttons", toolbarview, "reveal-top-bars", SYNC_CREATE); } @@ -131,6 +129,18 @@ public class Switchboard.SettingsSidebar : Gtk.Widget { get_first_child ().unparent (); } + private void update_selection () { + for (var child = listbox.get_first_child (); child != null; child = child.get_next_sibling ()) { + if (child is SettingsSidebarRow) { + var row = (SettingsSidebarRow) child; + if (row.page == stack.visible_child) { + listbox.select_row ((Gtk.ListBoxRow) row); + break; + } + } + } + } + private Gtk.Widget create_widget_func (Object object) { unowned var stack_page = (Gtk.StackPage) object; unowned var page = (SettingsPage) stack_page.child;