Add option to set default-session-parent-dir (#4438).
git-svn-id: svn://localhost/ardour2/branches/3.0@10435 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -320,4 +320,30 @@ OptionEditor::set_current_page (string const & p)
|
||||
}
|
||||
|
||||
|
||||
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_file_set().connect (sigc::mem_fun (*this, &DirectoryOption::file_set));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DirectoryOption::set_state_from_config ()
|
||||
{
|
||||
_file_chooser.set_filename (_get ());
|
||||
}
|
||||
|
||||
void
|
||||
DirectoryOption::add_to_page (OptionEditorPage* p)
|
||||
{
|
||||
add_widgets_to_page (p, manage (new Label (_name)), &_file_chooser);
|
||||
}
|
||||
|
||||
void
|
||||
DirectoryOption::file_set ()
|
||||
{
|
||||
_set (_file_chooser.get_filename ());
|
||||
}
|
||||
|
||||
@@ -377,6 +377,22 @@ private:
|
||||
sigc::slot<bool, ARDOUR::framecnt_t> _set;
|
||||
};
|
||||
|
||||
class DirectoryOption : public Option
|
||||
{
|
||||
public:
|
||||
DirectoryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>);
|
||||
|
||||
void set_state_from_config ();
|
||||
void add_to_page (OptionEditorPage *);
|
||||
|
||||
private:
|
||||
void file_set ();
|
||||
|
||||
sigc::slot<std::string> _get; ///< slot to get the configuration variable's value
|
||||
sigc::slot<bool, std::string> _set; ///< slot to set the configuration variable's value
|
||||
Gtk::FileChooserButton _file_chooser;
|
||||
};
|
||||
|
||||
/** Class to represent a single page in an OptionEditor's notebook.
|
||||
* Pages are laid out using a 3-column table; the 1st column is used
|
||||
* to indent non-headings, and the 2nd and 3rd for actual content.
|
||||
|
||||
@@ -908,6 +908,13 @@ RCOptionEditor::RCOptionEditor ()
|
||||
sigc::mem_fun (*_rc_config, &RCConfiguration::set_only_copy_imported_files)
|
||||
));
|
||||
|
||||
add_option (_("Misc"), new DirectoryOption (
|
||||
X_("default-session-parent-dir"),
|
||||
_("Default folder for new sessions:"),
|
||||
sigc::mem_fun (*_rc_config, &RCConfiguration::get_default_session_parent_dir),
|
||||
sigc::mem_fun (*_rc_config, &RCConfiguration::set_default_session_parent_dir)
|
||||
));
|
||||
|
||||
add_option (_("Misc"), new OptionEditorHeading (_("Click")));
|
||||
|
||||
add_option (_("Misc"), new ClickOptions (_rc_config, this));
|
||||
|
||||
Reference in New Issue
Block a user