When showing a prefs pane, select the row in the tree
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Tue, 26 Jul 2016 05:54:19 +0000 (07:54 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Tue, 26 Jul 2016 06:02:40 +0000 (08:02 +0200)
When programmatically showing a pane, instead of directly asking the
preferences notebook to show the pane, search for the asked path in the
panes tree, and select it. Since OptionEditor listens to selection
changes in its TreeView, the correct pane will be shown, with the added
benefit that the corresponding section in the tree will be highlighted
so that the user knows which pane is currently shown.

gtk2_ardour/option_editor.cc

index 9a21e600a0f56a4aa891650816f342301741ac2e..9809b0516546ac750a65294d52bb6886056a645f 100644 (file)
@@ -636,15 +636,12 @@ OptionEditor::add_page (std::string const & pn, Gtk::Widget& w)
 void
 OptionEditor::set_current_page (string const & p)
 {
-       int i = 0;
-       while (i < _notebook.get_n_pages ()) {
-               if (_notebook.get_tab_label_text (*_notebook.get_nth_page (i)) == p) {
-                       _notebook.set_current_page (i);
-                       return;
-               }
+       TreeModel::iterator row_iter = find_path_in_treemodel(p);
 
-               ++i;
+       if (row_iter) {
+               option_treeview.get_selection()->select(row_iter);
        }
+
 }