Wrap calls to add_shortcut_folder() in try { ... } block.
Gtk::FileChooserButton::add_shortcut_folder() throws a Glib::Error exception if the folder being added already has a shortcut, causing the 'New session' dialogue to appear empty when choosing 'New...' from the Session menu. This happens if Ardour's default session folder is set to a location that has a standard shortcut in the Gtk file chooser, e.g. the user's home directory, desktop, &c. Catch the exception in ArdourStartup::setup_new_session_page(), so that the 'New session' dialogue appears as expected, and likewise in ARDOUR_UI::open_session() to avoid a similar problem there. Fixes #5591.
This commit is contained in:
parent
649cf189e8
commit
bf408d60c8
@ -1488,7 +1488,14 @@ ARDOUR_UI::open_session ()
|
||||
open_session_selector->set_current_folder(Config->get_default_session_parent_dir());
|
||||
}
|
||||
|
||||
open_session_selector->add_shortcut_folder (Config->get_default_session_parent_dir());
|
||||
string default_session_folder = Config->get_default_session_parent_dir();
|
||||
try {
|
||||
/* add_shortcut_folder throws an exception if the folder being added already has a shortcut */
|
||||
open_session_selector->add_shortcut_folder (default_session_folder);
|
||||
}
|
||||
catch (Glib::Error & e) {
|
||||
std::cerr << "open_session_selector->add_shortcut_folder (" << default_session_folder << ") threw Glib::Error " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
FileFilter session_filter;
|
||||
session_filter.add_pattern ("*.ardour");
|
||||
|
@ -805,7 +805,15 @@ ArdourStartup::setup_new_session_page ()
|
||||
string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
|
||||
session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
|
||||
new_folder_chooser.set_current_folder (session_parent_dir);
|
||||
new_folder_chooser.add_shortcut_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
|
||||
string default_session_folder = poor_mans_glob (Config->get_default_session_parent_dir());
|
||||
|
||||
try {
|
||||
/* add_shortcut_folder throws an exception if the folder being added already has a shortcut */
|
||||
new_folder_chooser.add_shortcut_folder (default_session_folder);
|
||||
}
|
||||
catch (Glib::Error & e) {
|
||||
std::cerr << "new_folder_chooser.add_shortcut_folder (" << default_session_folder << ") threw Glib::Error " << e.what() << std::endl;
|
||||
}
|
||||
} else {
|
||||
new_folder_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user