diff options
author | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2013-07-19 12:04:58 +0100 |
---|---|---|
committer | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2013-07-19 12:10:41 +0100 |
commit | bf408d60c896d1a072a353f79269ac3bc1600464 (patch) | |
tree | 259320d3b6353f8cf5569498669efd49a8ac6a5e /gtk2_ardour/startup.cc | |
parent | 649cf189e87a9472581cd339eda6718cfd067e32 (diff) |
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.
Diffstat (limited to 'gtk2_ardour/startup.cc')
-rw-r--r-- | gtk2_ardour/startup.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc index 0ec79667ab..e24e7d6989 100644 --- a/gtk2_ardour/startup.cc +++ b/gtk2_ardour/startup.cc @@ -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())); } |