summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-14 17:41:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-14 17:41:06 +0000
commita5efa9a500d2c1b592656e91e9ea7ef7d535dcb3 (patch)
tree02203a2821f22bd5d1b346484c97d400276076c7 /gtk2_ardour/ardour_ui.cc
parent2d83ffc45a2a144181d0f3449345868da11efff5 (diff)
initial pass at session-renaming functionality
git-svn-id: svn://localhost/ardour2/branches/3.0@9876 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r--gtk2_ardour/ardour_ui.cc68
1 files changed, 67 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 01321c21f2..9e34ac0641 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2120,7 +2120,6 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
prompter.set_name ("Prompter");
prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
prompter.set_title (_("Take Snapshot"));
- prompter.set_title (_("Take Snapshot"));
prompter.set_prompt (_("Name of new snapshot"));
if (!switch_to_it) {
@@ -2185,6 +2184,73 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
}
}
+/** Ask the user for the name of a new shapshot and then take it.
+ */
+
+void
+ARDOUR_UI::rename_session ()
+{
+ if (!_session) {
+ return;
+ }
+
+ ArdourPrompter prompter (true);
+ string name;
+
+ prompter.set_name ("Prompter");
+ prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+ prompter.set_title (_("Rename Session"));
+ prompter.set_prompt (_("New session name"));
+
+ again:
+ switch (prompter.run()) {
+ case RESPONSE_ACCEPT:
+ {
+ prompter.get_result (name);
+
+ bool do_rename = (name.length() != 0);
+
+ if (do_rename) {
+ if (name.find ('/') != string::npos) {
+ MessageDialog msg (_("To ensure compatibility with various systems\n"
+ "session names may not contain a '/' character"));
+ msg.run ();
+ goto again;
+ }
+ if (name.find ('\\') != string::npos) {
+ MessageDialog msg (_("To ensure compatibility with various systems\n"
+ "session names may not contain a '\\' character"));
+ msg.run ();
+ goto again;
+ }
+
+ switch (_session->rename (name)) {
+ case -1: {
+ MessageDialog msg (_("That name is already in use by another directory/folder. Please try again."));
+ msg.set_position (WIN_POS_MOUSE);
+ msg.run ();
+ goto again;
+ break;
+ }
+ case 0:
+ break;
+ default: {
+ MessageDialog msg (_("Renaming this session failed.\nThings could be seriously messed up at this point"));
+ msg.set_position (WIN_POS_MOUSE);
+ msg.run ();
+ break;
+ }
+ }
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
void
ARDOUR_UI::save_state (const string & name, bool switch_to_it)
{