Add external drive references for most file-browsers

This fixes an issue on MacOS/X to only show non-root volumes in
the file-open dialog. They're just as valid for save-as, export, video
files etc.

In case of a 2nd internal disk, it is also a valid choice as default
folder for new sessions.
This commit is contained in:
Robin Gareus 2019-01-02 17:37:03 +01:00
parent ac9329f907
commit 6f01598297
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
16 changed files with 36 additions and 0 deletions

View File

@ -114,6 +114,7 @@ AddVideoDialog::AddVideoDialog (Session* s)
/* file chooser */
chooser.set_border_width (4);
Gtkmm2ext::add_volume_shortcuts (chooser);
#ifdef __APPLE__
/* some broken redraw behaviour - this is a bandaid */
chooser.signal_selection_changed().connect (mem_fun (chooser, &Widget::queue_draw));

View File

@ -23,6 +23,9 @@
#include <gtkmm/stock.h>
#include "pbd/openuri.h"
#include "gtkmm2ext/utils.h"
#include "export_filename_selector.h"
#include "pbd/i18n.h"
@ -413,6 +416,7 @@ void
ExportFilenameSelector::open_browse_dialog ()
{
Gtk::FileChooserDialog dialog(_("Choose export folder"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
Gtkmm2ext::add_volume_shortcuts (dialog);
//dialog.set_transient_for(*this);
dialog.set_filename (path_entry.get_text());

View File

@ -1257,6 +1257,7 @@ void
ExportVideoDialog::open_outfn_dialog ()
{
Gtk::FileChooserDialog dialog(_("Save Exported Video File"), Gtk::FILE_CHOOSER_ACTION_SAVE);
Gtkmm2ext::add_volume_shortcuts (dialog);
dialog.set_filename (outfn_path_entry.get_text());
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
@ -1277,6 +1278,7 @@ void
ExportVideoDialog::open_invid_dialog ()
{
Gtk::FileChooserDialog dialog(_("Save Exported Video File"), Gtk::FILE_CHOOSER_ACTION_SAVE);
Gtkmm2ext::add_volume_shortcuts (dialog);
dialog.set_filename (invid_path_entry.get_text());
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);

View File

@ -961,6 +961,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
// Create/add controller
control_ui->file_button = manage(new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_OPEN));
control_ui->file_button->set_title(desc.label);
Gtkmm2ext::add_volume_shortcuts (*control_ui->file_button);
if (use_knob) {
control_ui->knobtable = manage (new Table());

View File

@ -520,6 +520,7 @@ public:
: LuaDialogWidget (key, title)
, _fc (a)
{
Gtkmm2ext::add_volume_shortcuts (_fc);
if (!path.empty ()) {
switch (a) {
case Gtk::FILE_CHOOSER_ACTION_OPEN:

View File

@ -25,6 +25,8 @@
#include "ardour/midi_region.h"
#include "ardour/session.h"
#include "gtkmm2ext/utils.h"
#include "midi_export_dialog.h"
#include "pbd/i18n.h"
@ -45,6 +47,7 @@ MidiExportDialog::MidiExportDialog (PublicEditor&, boost::shared_ptr<MidiRegion>
set_default_response (Gtk::RESPONSE_ACCEPT);
Gtkmm2ext::add_volume_shortcuts (file_chooser);
file_chooser.set_current_name (region->name() + ".mid");
file_chooser.show ();

View File

@ -118,6 +118,7 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
msg.show ();
Gtkmm2ext::add_volume_shortcuts (chooser);
chooser.set_current_folder (Glib::get_home_dir());
chooser.set_create_folders (false);
}

View File

@ -895,6 +895,7 @@ DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot
, _get (g)
, _set (s)
{
Gtkmm2ext::add_volume_shortcuts (_file_chooser);
_file_chooser.set_action (Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
_file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed));
}

View File

@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
#include "pbd/gstdio_compat.h"
#include "pbd/i18n.h"
#include "pbd/file_utils.h"
@ -29,6 +30,9 @@
#include "ptformat/ptfformat.h"
#include "ardour/session_handle.h"
#include "gtkmm2ext/utils.h"
#include "pt_import_selector.h"
using namespace Gtk;
@ -66,6 +70,7 @@ PTImportSelector::PTImportSelector (PTFFormat& ptf) :
match_pt_filter.add_pattern ("*.ptx");
match_pt_filter.set_name (_("All PT sessions"));
Gtkmm2ext::add_volume_shortcuts (ptimport_ptf_chooser);
ptimport_ptf_chooser.add_filter (match_pt_filter);
ptimport_ptf_chooser.set_select_multiple (false);
//XXX ptimport_ptf_chooser.set_current_folder (dstdir);

View File

@ -21,6 +21,8 @@
#include "ardour/session.h"
#include "gtkmm2ext/utils.h"
#include "save_as_dialog.h"
#include "pbd/i18n.h"
@ -84,8 +86,10 @@ SaveAsDialog::SaveAsDialog ()
no_include_media_button.signal_toggled ().connect (sigc::mem_fun (*this, &SaveAsDialog::no_include_toggled));
Gtkmm2ext::add_volume_shortcuts (new_parent_folder_selector);
new_parent_folder_selector.set_action (FILE_CHOOSER_ACTION_SELECT_FOLDER);
new_parent_folder_selector.set_current_folder (Config->get_default_session_parent_dir ());
new_name_entry.signal_changed().connect (sigc::mem_fun (*this, &SaveAsDialog::name_entry_changed));
new_parent_folder_selector.signal_current_folder_changed().connect (sigc::mem_fun (*this, &SaveAsDialog::name_entry_changed));
new_parent_folder_selector.signal_selection_changed().connect (sigc::mem_fun (*this, &SaveAsDialog::name_entry_changed));

View File

@ -22,6 +22,8 @@
#include "pbd/compose.h"
#include "pbd/shortpath.h"
#include "gtkmm2ext/utils.h"
#include "search_path_option.h"
#include "pbd/i18n.h"
@ -36,6 +38,7 @@ SearchPathOption::SearchPathOption (const string& pathname, const string& label,
, _set (set)
, add_chooser (_("Select folder to search for media"), FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
Gtkmm2ext::add_volume_shortcuts (add_chooser);
add_chooser.signal_file_set().connect (sigc::mem_fun (*this, &SearchPathOption::path_chosen));
HBox* hbox = manage (new HBox);

View File

@ -23,6 +23,8 @@
#include "ardour/filename_extensions.h"
#include "gtkmm2ext/utils.h"
#include "session_archive_dialog.h"
#include "pbd/i18n.h"
@ -106,6 +108,7 @@ SessionArchiveDialog::SessionArchiveDialog ()
add_button (Stock::CANCEL, RESPONSE_CANCEL);
add_button (Stock::OK, RESPONSE_OK);
Gtkmm2ext::add_volume_shortcuts (target_folder_selector);
target_folder_selector.set_action (FILE_CHOOSER_ACTION_SELECT_FOLDER);
target_folder_selector.set_current_folder (Config->get_default_session_parent_dir ()); // TODO get/set default_archive_dir
name_entry.signal_changed().connect (sigc::mem_fun (*this, &SessionArchiveDialog::name_entry_changed));

View File

@ -908,6 +908,7 @@ SessionMetadataImporter::run ()
/* Open session file selector */
Gtk::FileChooserDialog session_selector(_("Choose session to import metadata from"), Gtk::FILE_CHOOSER_ACTION_OPEN);
Gtkmm2ext::add_volume_shortcuts (session_selector);
session_selector.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
session_selector.add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
session_selector.set_default_response(Gtk::RESPONSE_ACCEPT);

View File

@ -48,6 +48,8 @@
#include "ardour/template_utils.h"
#include "ardour/profile.h"
#include "gtkmm2ext/utils.h"
#include "startup.h"
#include "opts.h"
#include "engine_dialog.h"
@ -202,6 +204,7 @@ Where would you like new %1 sessions to be stored by default?\n\n\
vbox->pack_start (*hbox, false, true);
cerr << "set default folder to " << poor_mans_glob (Config->get_default_session_parent_dir()) << endl;
Gtkmm2ext::add_volume_shortcuts (*default_dir_chooser);
default_dir_chooser->set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
default_dir_chooser->signal_current_folder_changed().connect (sigc::mem_fun (*this, &ArdourStartup::default_dir_changed));
default_dir_chooser->show ();

View File

@ -44,6 +44,7 @@
#include "pbd/xml++.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "ardour/filename_extensions.h"
#include "ardour/filesystem_paths.h"
@ -490,6 +491,7 @@ TemplateManager::export_all_templates ()
g_clear_error (&err);
FileChooserDialog dialog(_("Save Exported Template Archive"), FILE_CHOOSER_ACTION_SAVE);
Gtkmm2ext::add_volume_shortcuts (dialog);
dialog.set_filename (X_("templates"));
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);

View File

@ -544,6 +544,7 @@ TranscodeVideoDialog::open_browse_dialog ()
{
Gtk::FileChooserDialog dialog(_("Save Transcoded Video File"), Gtk::FILE_CHOOSER_ACTION_SAVE);
dialog.set_filename (path_entry.get_text());
Gtkmm2ext::add_volume_shortcuts (dialog);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);