@@ -24,24 +24,32 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
2424 public bool show_title_buttons { get ; set ;}
2525
2626 /**
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.
27+ * The name of the currently visible Granite.SettingsPage
3028 */
3129 public string ? visible_child_name {
3230 get {
33- return stack. visible_child_name;
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+ }
3438 }
3539 set {
36- for (unowned var child = listbox. get_first_child (); child != null ; child = child. get_next_sibling ()) {
37- if (! (child is SettingsSidebarRow )) {
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 ();
3844 continue ;
3945 }
4046
41- if (((SettingsSidebarRow ) child) . page_name == value ) {
42- listbox. select_row ((Gtk . ListBoxRow ) child );
47+ if (((SettingsSidebarRow ) listbox_child) . page . title == value ) {
48+ listbox. select_row ((Gtk . ListBoxRow ) listbox_child );
4349 break ;
4450 }
51+
52+ listbox_child = listbox_child. get_next_sibling ();
4553 }
4654 }
4755 }
@@ -126,7 +134,7 @@ public class Switchboard.SettingsSidebar : Gtk.Widget {
126134 private Gtk .Widget create_widget_func (Object object ) {
127135 unowned var stack_page = (Gtk . StackPage ) object ;
128136 unowned var page = (SettingsPage ) stack_page. child;
129- var row = new SettingsSidebarRow (stack_page . name, page);
137+ var row = new SettingsSidebarRow (page);
130138
131139 return row;
132140 }
0 commit comments