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
This commit is contained in:
parent
5d8cf17121
commit
34c05a7903
@ -30,6 +30,7 @@ namespace ARDOUR {
|
||||
int read_recent_sessions (RecentSessions& rs);
|
||||
int store_recent_sessions (std::string name, std::string path);
|
||||
int write_recent_sessions (RecentSessions& rs);
|
||||
int remove_recent_sessions (const std::string& path);
|
||||
}; // namespace ARDOUR
|
||||
|
||||
#endif // __ardour_recent_sessions_h__
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@
|
||||
#include "ardour/processor.h"
|
||||
#include "ardour/port.h"
|
||||
#include "ardour/proxy_controllable.h"
|
||||
#include "ardour/recent_sessions.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/route_group.h"
|
||||
#include "ardour/send.h"
|
||||
@ -3787,6 +3788,10 @@ Session::rename (const std::string& new_name)
|
||||
}
|
||||
}
|
||||
|
||||
/* remove old name from recent sessions */
|
||||
|
||||
remove_recent_sessions (_path);
|
||||
|
||||
_path = newpath;
|
||||
_current_snapshot_name = new_name;
|
||||
_name = new_name;
|
||||
@ -3797,6 +3802,11 @@ Session::rename (const std::string& new_name)
|
||||
|
||||
save_state (_current_snapshot_name);
|
||||
|
||||
|
||||
/* add to recent sessions */
|
||||
|
||||
store_recent_sessions (new_name, _path);
|
||||
|
||||
return 0;
|
||||
|
||||
#undef RENAME
|
||||
|
Loading…
Reference in New Issue
Block a user