summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-03-24 14:10:26 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-03-24 14:10:39 -0600
commit97340a5c89d6100d95de2155c8c4389ac61bc528 (patch)
treed264ed0bb1e94eab22a41c9d37cb87d8f24f10e1 /gtk2_ardour
parent5f1d802307c7e68ebc39ff4d4f4a534333f98f41 (diff)
when saving an unnamed session, rename it (GUI edition)
Note that this is done at the GUI level, might need to double check if there are other paths into a "save" that should be covered. Control surfaces use the action, but Lua comes to mind
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.cc4
-rw-r--r--gtk2_ardour/ardour_ui.h2
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc2
-rw-r--r--gtk2_ardour/ardour_ui_session.cc11
4 files changed, 14 insertions, 5 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 6f9c544db4..52da9f9615 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2024,6 +2024,10 @@ ARDOUR_UI::save_state (const string & name, bool switch_to_it)
return;
}
+ if (_session->unnamed()) {
+ rename_session (true);
+ }
+
XMLNode* node = new XMLNode (X_("UI"));
WM::Manager::instance().add_state (*node);
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 3daa145ff8..e0e212feb0 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -684,7 +684,7 @@ private:
bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar);
void save_session_as ();
void archive_session ();
- void rename_session ();
+ void rename_session (bool for_unnamed);
int create_mixer ();
int create_editor ();
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 60b423bc02..bfdd8e799f 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -225,7 +225,7 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (main_actions, X_("Archive"), _("Archive..."), sigc::mem_fun(*this, &ARDOUR_UI::archive_session));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session));
+ act = ActionManager::register_action (main_actions, X_("Rename"), _("Rename..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::rename_session), false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
diff --git a/gtk2_ardour/ardour_ui_session.cc b/gtk2_ardour/ardour_ui_session.cc
index 2cd8dc5940..c659aa433a 100644
--- a/gtk2_ardour/ardour_ui_session.cc
+++ b/gtk2_ardour/ardour_ui_session.cc
@@ -763,7 +763,7 @@ If you still wish to proceed, please use the\n\n\
*/
void
-ARDOUR_UI::rename_session ()
+ARDOUR_UI::rename_session (bool for_unnamed)
{
if (!_session) {
return;
@@ -774,8 +774,13 @@ ARDOUR_UI::rename_session ()
prompter.set_name ("Prompter");
prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
- prompter.set_title (_("Rename Session"));
- prompter.set_prompt (_("New session name"));
+ if (for_unnamed) {
+ prompter.set_title (_("Name Session"));
+ prompter.set_prompt (_("Session name"));
+ } else {
+ prompter.set_title (_("Rename Session"));
+ prompter.set_prompt (_("New session name"));
+ }
again:
switch (prompter.run()) {