partially revert de53fac (pre-sort session list)

<glib> header includes and commends remain for later use
This commit is contained in:
Robin Gareus 2015-09-16 15:47:29 +02:00
parent 119e56e7eb
commit 6c43ca5334
2 changed files with 7 additions and 22 deletions

View File

@ -585,7 +585,7 @@ int
SessionDialog::redisplay_recent_sessions ()
{
std::vector<std::string> session_directories;
RecentSessionsTimeSorter cmp;
RecentSessionsSorter cmp;
recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
recent_session_model->clear ();
@ -598,26 +598,11 @@ SessionDialog::redisplay_recent_sessions ()
recent_session_display.set_model (recent_session_model);
return 0;
}
//
// sort them alphabetically
sort (rs.begin(), rs.end(), cmp);
// sort by session modificaion time.
// TODO it would be nicer to sort using the model (and make the TV sortable)
std::vector< std::pair<int64_t,std::string> > rss;
for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
std::vector<std::string> state_file_paths;
get_state_files_in_directory ((*i).second, state_file_paths);
if (state_file_paths.empty()) {
continue;
}
GStatBuf gsb;
if (g_stat (state_file_paths.front().c_str(), &gsb)) {
continue;
}
rss.push_back (std::make_pair((int64_t)gsb.st_mtime, (*i).second));
}
sort (rss.begin(), rss.end(), cmp);
for (std::vector< std::pair<int64_t,std::string> >::iterator i = rss.begin(); i != rss.end(); ++i) {
session_directories.push_back ((*i).second);
}

View File

@ -102,9 +102,9 @@ class SessionDialog : public ArdourDialog {
void setup_existing_session_page ();
struct RecentSessionsTimeSorter {
bool operator() (std::pair<int64_t,std::string> a, std::pair<int64_t,std::string> b) const {
return a.first > b.first;
struct RecentSessionsSorter {
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
return ARDOUR::cmp_nocase(a.first, b.first) == -1;
}
};