@@ -24,32 +24,24 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
2424 public bool show_title_buttons { get ; set ;}
2525
2626 /**
27- * The name of the currently visible Granite.SettingsPage
27+ * The name of the currently visible {@link SettingsPage}.
28+ * Beware this is the name of the page as set via {@link Gtk.Stack.add_named}
29+ * and not the title of the page.
2830 */
2931 public string ? visible_child_name {
3032 get {
31- var selected_row = listbox. get_selected_row ();
32-
33- if (selected_row == null ) {
34- return null ;
35- } else {
36- return ((SettingsSidebarRow ) selected_row). page. title;
37- }
33+ return stack. visible_child_name;
3834 }
3935 set {
40- weak Gtk . Widget listbox_child = listbox. get_first_child ();
41- while (listbox_child != null ) {
42- if (! (listbox_child is SettingsSidebarRow )) {
43- listbox_child = listbox_child. get_next_sibling ();
36+ for (unowned var child = listbox. get_first_child (); child != null ; child = child. get_next_sibling ()) {
37+ if (! (child is SettingsSidebarRow )) {
4438 continue ;
4539 }
4640
47- if (((SettingsSidebarRow ) listbox_child) . page . title == value ) {
48- listbox. select_row ((Gtk . ListBoxRow ) listbox_child );
41+ if (((SettingsSidebarRow ) child) . page_name == value ) {
42+ listbox. select_row ((Gtk . ListBoxRow ) child );
4943 break ;
5044 }
51-
52- listbox_child = listbox_child. get_next_sibling ();
5345 }
5446 }
5547 }
@@ -134,7 +126,7 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
134126 private Gtk .Widget create_widget_func (Object object ) {
135127 unowned var stack_page = (Gtk . StackPage ) object ;
136128 unowned var page = (SettingsPage ) stack_page. child;
137- var row = new SettingsSidebarRow (page);
129+ var row = new SettingsSidebarRow (stack_page . name, page);
138130
139131 return row;
140132 }
0 commit comments