+
+/** Add a new page
+ * @param pn Page name (will be created if it doesn't already exist)
+ * @param w widget that fills the page
+ */
+void
+OptionEditor::add_page (std::string const & pn, Gtk::Widget& w)
+{
+ if (_pages.find (pn) == _pages.end()) {
+ OptionEditorPage* oep = new OptionEditorPage (_notebook, pn);
+ _pages[pn] = oep;
+ add_path_to_treeview (pn, oep->box);
+ }
+
+ OptionEditorPage* p = _pages[pn];
+ p->box.pack_start (w, true, true);
+}
+
+void
+OptionEditor::set_current_page (string const & p)
+{
+ TreeModel::iterator row_iter = find_path_in_treemodel(p);
+
+ if (row_iter) {
+ option_treeview.get_selection()->select(row_iter);
+ }
+
+}
+
+
+DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot<string> g, sigc::slot<bool, string> s)
+ : Option (i, n)
+ , _get (g)
+ , _set (s)
+{
+ _file_chooser.set_action (Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ _file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed));
+}
+
+
+void
+DirectoryOption::set_state_from_config ()
+{
+ _file_chooser.set_current_folder (poor_mans_glob(_get ()));
+}
+
+void
+DirectoryOption::add_to_page (OptionEditorPage* p)
+{
+ Gtk::Label *label = manage (new Label (_name));
+ label->set_alignment (0, 0.5);
+ label->set_name (X_("OptionsLabel"));
+ add_widgets_to_page (p, label, &_file_chooser);
+}
+
+void
+DirectoryOption::selection_changed ()
+{
+ _set (poor_mans_glob(_file_chooser.get_filename ()));
+}
+
+/*--------------------------*/
+
+OptionEditorContainer::OptionEditorContainer (PBD::Configuration* c, string const& str)
+ : OptionEditor (c)
+{
+ set_border_width (4);
+ hpacker.pack_start (treeview(), false, false);
+ hpacker.pack_start (notebook(), true, true);
+ pack_start (hpacker, true, true);
+
+ hpacker.show_all ();
+ show ();
+}
+
+OptionEditorWindow::OptionEditorWindow (PBD::Configuration* c, string const& str)
+ : OptionEditor (c)
+ , ArdourWindow (str)
+{
+ container.set_border_width (4);
+ hpacker.pack_start (treeview(), false, false);
+ hpacker.pack_start (notebook(), true, true);
+
+ container.pack_start (hpacker, true, true);
+
+ hpacker.show_all ();
+ container.show ();
+
+ add (container);
+}