13
0

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.
This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2016-07-26 07:54:19 +02:00
parent 37dc4bd8a7
commit c71cc6fe5b

View 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);
}
}