summaryrefslogtreecommitdiff
path: root/gtk2_ardour/session_dialog.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-11-20 03:21:57 +0100
committerRobin Gareus <robin@gareus.org>2015-11-20 03:22:41 +0100
commit6851e5a53e9fdaeb37ed45f2b1e6bad0a6563164 (patch)
treea4dcb390426748bac90b3699c7ebd708066f0122 /gtk2_ardour/session_dialog.cc
parent4c04e8028aa73177f4ab02e3c82ea051e20b4edb (diff)
session-load: default to most-recently-used snapshot
Diffstat (limited to 'gtk2_ardour/session_dialog.cc')
-rw-r--r--gtk2_ardour/session_dialog.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc
index 017d5b9482..22023f75bf 100644
--- a/gtk2_ardour/session_dialog.cc
+++ b/gtk2_ardour/session_dialog.cc
@@ -31,6 +31,7 @@
#include <gtkmm/filechooser.h>
+#include "pbd/basename.h"
#include "pbd/failed_constructor.h"
#include "pbd/file_utils.h"
#include "pbd/replace_all.h"
@@ -250,6 +251,10 @@ SessionDialog::session_name (bool& should_be_new)
if (iter) {
should_be_new = false;
+ string s = (*iter)[recent_session_columns.fullpath];
+ if (Glib::file_test (s, Glib::FILE_TEST_IS_REGULAR)) {
+ return PBD::basename_nosuffix (s);
+ }
return (*iter)[recent_session_columns.visible_name];
}
@@ -707,14 +712,27 @@ SessionDialog::redisplay_recent_sessions ()
float sr;
SampleFormat sf;
- std::string state_file_basename = state_file_names.front();
+
+ std::string state_file_basename;
+
+ if (state_file_names.size() > 1) {
+ state_file_basename = Session::get_snapshot_from_instant (dirname);
+ std::string s = Glib::build_filename (dirname, state_file_basename + statefile_suffix);
+ if (!Glib::file_test (s, Glib::FILE_TEST_IS_REGULAR)) {
+ state_file_basename = "";
+ }
+ }
+
+ if (state_file_basename.empty()) {
+ state_file_basename = state_file_names.front();
+ }
std::string s = Glib::build_filename (dirname, state_file_basename + statefile_suffix);
GStatBuf gsb;
g_stat (s.c_str(), &gsb);
- row[recent_session_columns.fullpath] = dirname; /* just the dir, but this works too */
+ row[recent_session_columns.fullpath] = s;
row[recent_session_columns.tip] = Gtkmm2ext::markup_escape_text (dirname);
row[recent_session_columns.time_modified] = gsb.st_mtime;