1 /* 2 * Copyright (C) 2010-2012 Paul Davis <paul@linuxaudiosystems.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 #ifndef __gtk_ardour_search_path_option_h__ 20 #define __gtk_ardour_search_path_option_h__ 21 22 #include <string> 23 24 #include <gtkmm/filechooserbutton.h> 25 #include <gtkmm/entry.h> 26 #include <gtkmm/button.h> 27 #include <gtkmm/box.h> 28 29 #include "option_editor.h" 30 31 class SearchPathOption : public Option 32 { 33 public: 34 SearchPathOption (const std::string& pathname, const std::string& label, 35 const std::string& default_path, 36 sigc::slot<std::string>, sigc::slot<bool, std::string>); 37 ~SearchPathOption (); 38 39 void set_state_from_config (); 40 void add_to_page (OptionEditorPage*); 41 void clear (); 42 tip_widget()43 Gtk::Widget& tip_widget() { return add_chooser; } 44 45 protected: 46 sigc::slot<std::string> _get; ///< slot to get the configuration variable's value 47 sigc::slot<bool, std::string> _set; ///< slot to set the configuration variable's value 48 49 struct PathEntry 50 { 51 PathEntry (const std::string& path, bool removable=true); 52 53 Gtk::Entry entry; 54 Gtk::Button remove_button; 55 Gtk::HBox box; 56 57 std::string path; 58 }; 59 60 std::list<PathEntry*> paths; 61 Gtk::FileChooserButton add_chooser; 62 Gtk::VBox vbox; 63 Gtk::VBox path_box; 64 Gtk::Label session_label; 65 66 void add_path (const std::string& path, bool removable=true); 67 void remove_path (PathEntry*); 68 void changed (); 69 void path_chosen (); 70 }; 71 72 #endif /* __gtk_ardour_search_path_option_h__ */ 73