Skip to content

Commit 150ef81

Browse files
authored
SettingsSideBar: Fix selection of the correct row (#344)
1 parent 57bb1b0 commit 150ef81

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/SettingsSidebar.vala

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
120120
}
121121
});
122122

123-
stack.notify["visible-child-name"].connect (() => {
124-
visible_child_name = stack.visible_child_name;
125-
});
123+
stack.notify["visible-child"].connect (update_selection);
126124

127125
bind_property ("show-title-buttons", toolbarview, "reveal-top-bars", SYNC_CREATE);
128126
}
@@ -131,6 +129,18 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
131129
get_first_child ().unparent ();
132130
}
133131

132+
private void update_selection () {
133+
for (var child = listbox.get_first_child (); child != null; child = child.get_next_sibling ()) {
134+
if (child is SettingsSidebarRow) {
135+
var row = (SettingsSidebarRow) child;
136+
if (row.page == stack.visible_child) {
137+
listbox.select_row ((Gtk.ListBoxRow) row);
138+
break;
139+
}
140+
}
141+
}
142+
}
143+
134144
private Gtk.Widget create_widget_func (Object object) {
135145
unowned var stack_page = (Gtk.StackPage) object;
136146
unowned var page = (SettingsPage) stack_page.child;

0 commit comments

Comments
 (0)