From c71cc6fe5b2ded2ff7dce36999e917f707b8e939 Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Tue, 26 Jul 2016 07:54:19 +0200 Subject: [PATCH] When showing a prefs pane, select the row in the tree 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 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 9a21e600a0..9809b05165 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -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); } + } -- 2.30.2