From b58c1df07ddd6e2c8758598c62be39b4b8d8ec5c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Mar 2015 17:45:31 -0500 Subject: [PATCH] check for old configuration files and copy if user requests it. A restart is required. There is a circular dependency between the config files and the GUI, and this restart breaks it --- gtk2_ardour/ardour_ui.cc | 23 +++++++++++++++++++++++ gtk2_ardour/main.cc | 17 ----------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b1bfe31afa..9a83ec0c9b 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -157,6 +157,21 @@ ARDOUR_UI *ARDOUR_UI::theArdourUI = 0; sigc::signal ARDOUR_UI::Clock; sigc::signal ARDOUR_UI::CloseAllDialogs; + +static bool +ask_about_configuration_copy (string const & old_dir, string const & new_dir, int version) +{ + MessageDialog msg (string_compose (_("%1 %2.x has discovered configuration files from %1 %3.x.\n\n" + "Would you like to copy the relevant files before starting to use the program?\n\n" + "(This will require you to restart %1.)"), + PROGRAM_NAME, PROGRAM_VERSION, version), true); + + msg.add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO); + msg.show_all (); + + return (msg.run() == Gtk::RESPONSE_OK); +} + ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp) @@ -223,6 +238,14 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) { Gtkmm2ext::init(localedir); + if (ARDOUR::check_for_old_configuration_files (boost::bind (ask_about_configuration_copy, _1, _2, _3))) { + MessageDialog msg (string_compose (_("Your configuration files were copied. You can now restart %1."), PROGRAM_NAME), true); + msg.run (); + /* configuration was modified, exit immediately */ + _exit (0); + } + + splash = 0; _numpad_locate_happening = false; diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index e981df7d81..062174a442 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -228,23 +228,6 @@ static void console_madness_end () {} static void command_line_parse_error (int *argc, char** argv[]) {} #endif -static bool -ask_about_configuration_copy (string const & old_dir, string const & new_dir, int version) -{ - MessageDialog msg (string_compose (_("%1 %2.x has discovered configuration files from %1 %3.x.\n\n" - "Would you like to copy them before starting to use the program?\n\n" - "\n" - "(Note that not all files will be copied, since some are no longer relevant)"), - PROGRAM_NAME, PROGRAM_VERSION, version), true); - - msg.add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO); - msg.add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES); - msg.show_all (); - - return (msg.run() == Gtk::RESPONSE_YES); -} - - #if (defined(COMPILER_MSVC) && defined(NDEBUG) && !defined(RDC_BUILD)) /* * Release build with MSVC uses ardour_main()