diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-18 17:08:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-18 17:08:50 +0000 |
commit | 34c05a7903e87a2b5d83d36b8af783499d3ce682 (patch) | |
tree | e71d2187e1471fdcf7cfd4df8587da9250297e07 /libs/ardour/recent_sessions.cc | |
parent | 5d8cf171212cb2de6e82ca329f8d19313fa7db07 (diff) |
when renaming, remove old session and add new session name from/to recent sessions list
git-svn-id: svn://localhost/ardour2/branches/3.0@9894 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/recent_sessions.cc')
-rw-r--r-- | libs/ardour/recent_sessions.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libs/ardour/recent_sessions.cc b/libs/ardour/recent_sessions.cc index dfe85190b3..adc25294fb 100644 --- a/libs/ardour/recent_sessions.cc +++ b/libs/ardour/recent_sessions.cc @@ -137,3 +137,28 @@ ARDOUR::store_recent_sessions (string name, string path) return ARDOUR::write_recent_sessions (rs); } +int +ARDOUR::remove_recent_sessions (const string& path) +{ + RecentSessions rs; + bool write = false; + + if (ARDOUR::read_recent_sessions (rs) < 0) { + return -1; + } + + for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) { + if (i->second == path) { + rs.erase (i); + write = true; + break; + } + } + + if (write) { + return ARDOUR::write_recent_sessions (rs); + } else { + return 1; + } +} + |