minor safety fix for the Pane
[ardour.git] / gtk2_ardour / startup.cc
index c0064524539407edde87fac450fff7ef387447fe..58c1cfc7ad403bdf713771b12a09538ffb588ea1 100644 (file)
@@ -1,19 +1,58 @@
+/*
+    Copyright (C) 2010 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#include "gtk2ardour-version.h"
+#endif
+
 #include <algorithm>
+#include <fcntl.h>
+
+#include "pbd/gstdio_compat.h"
 
 #include <gtkmm/main.h>
+#include <gtkmm/filechooser.h>
 
 #include "pbd/failed_constructor.h"
+#include "pbd/scoped_file_descriptor.h"
 #include "pbd/file_utils.h"
-#include "pbd/filesystem.h"
+#include "pbd/replace_all.h"
+#include "pbd/whitespace.h"
+#include "pbd/stacktrace.h"
+#include "pbd/openuri.h"
 
+#include "ardour/audioengine.h"
 #include "ardour/filesystem_paths.h"
+#include "ardour/filename_extensions.h"
+#include "ardour/plugin_manager.h"
 #include "ardour/recent_sessions.h"
 #include "ardour/session.h"
 #include "ardour/session_state_utils.h"
 #include "ardour/template_utils.h"
+#include "ardour/profile.h"
 
 #include "startup.h"
-#include "i18n.h"
+#include "opts.h"
+#include "engine_dialog.h"
+#include "pbd/i18n.h"
+#include "utils.h"
 
 using namespace std;
 using namespace Gtk;
@@ -21,45 +60,53 @@ using namespace Gdk;
 using namespace Glib;
 using namespace PBD;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 
 ArdourStartup* ArdourStartup::the_startup = 0;
 
 ArdourStartup::ArdourStartup ()
-       : applying (false)
-       , ic_new_session_button (_("Open a new session"))
-       , ic_existing_session_button (_("Open an existing session"))
-       , more_new_session_options_button (_("I'd like more options for this session"))
+       : _response (RESPONSE_OK)
+       , config_modified (false)
+       , default_dir_chooser (0)
+       , monitor_via_hardware_button (string_compose (_("Use an external mixer or the hardware mixer of your audio interface.\n"
+                                                        "%1 will play NO role in monitoring"), PROGRAM_NAME))
+       , monitor_via_ardour_button (string_compose (_("Ask %1 to play back material as it is being recorded"), PROGRAM_NAME))
+       , audio_page_index (-1)
+       , new_user_page_index (-1)
+       , default_folder_page_index (-1)
+       , monitoring_page_index (-1)
+       , final_page_index (-1)
 {
-       set_keep_above (true);
        set_position (WIN_POS_CENTER);
+       set_border_width (12);
 
-       sys::path icon_file;
-
-       if (!find_file_in_search_path (ardour_search_path() + system_data_search_path(), "ardour_icon_48px.png", icon_file)) {
+       if ((icon_pixbuf = ::get_icon (PROGRAM_NAME "-icon_48px")) == 0) {
                throw failed_constructor();
        }
 
-       try {
-               icon_pixbuf = Gdk::Pixbuf::create_from_file (icon_file.to_string());
-       }
+       list<Glib::RefPtr<Gdk::Pixbuf> > window_icons;
+       Glib::RefPtr<Gdk::Pixbuf> icon;
 
-       catch (...) {
-               throw failed_constructor();
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_16px")) != 0) {
+               window_icons.push_back (icon);
        }
-
-       sys::path been_here_before = user_config_directory();
-       been_here_before /= ".a3"; // XXXX use more specific version so we can catch upgrades
-       
-       if (!exists (been_here_before)) {
-               // XXX touch been_here_before;
-               setup_new_user_page ();
-               setup_first_time_config_page ();
-       } else {
-               setup_initial_choice_page ();
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_22px")) != 0) {
+               window_icons.push_back (icon);
+       }
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_32px")) != 0) {
+               window_icons.push_back (icon);
+       }
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_48px")) != 0) {
+               window_icons.push_back (icon);
+       }
+       if (!window_icons.empty ()) {
+               set_default_icon_list (window_icons);
        }
 
-       setup_session_page ();
-       setup_more_options_page ();
+       setup_new_user_page ();
+       setup_first_time_config_page ();
+       setup_monitoring_choice_page ();
+       setup_monitor_section_choice_page ();
        setup_final_page ();
 
        the_startup = this;
@@ -69,67 +116,111 @@ ArdourStartup::~ArdourStartup ()
 {
 }
 
+bool
+ArdourStartup::required ()
+{
+       /* look for a "been here before" file for this version or earlier
+        * versions
+        */
+
+       const int current_version = atoi (PROGRAM_VERSION);
+
+       for (int v = current_version; v != 0; --v) {
+               if (Glib::file_test (ARDOUR::been_here_before_path (v), Glib::FILE_TEST_EXISTS)) {
+                       if (v != current_version) {
+                               /* older version exists, create the current one */
+                               PBD::ScopedFileDescriptor fout (g_open (been_here_before_path (current_version).c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666));
+                       }
+                       return false;
+               }
+       }
+
+       return true;
+}
+
 void
 ArdourStartup::setup_new_user_page ()
 {
-       Label* foomatic = manage (new Label (_("\
-Ardour is a digital audio workstation. You can use it to\n\
-record, edit and mix multi-track audio. You can produce your\n\
-own CDs, mix video soundtracks, or just experiment with new\n\
-ideas about music and sound.\n\
-\n\
-There are a few things that need to configured before you start\n\
-using the program.\
-")));
-       
+       Label* foomatic = manage (new Label);
+
+       foomatic->set_markup (string_compose (_("\
+<span size=\"larger\">%1 is a digital audio workstation. You can use it to \
+record, edit and mix multi-track audio. You can produce your \
+own CDs, mix video soundtracks, or experiment with new \
+ideas about music and sound. \
+\n\n\
+There are a few things that need to be configured before you start \
+using the program.</span> \
+"), PROGRAM_NAME));
+       foomatic->set_justify (JUSTIFY_FILL);
+       foomatic->set_line_wrap ();
+
        HBox* hbox = manage (new HBox);
        HBox* vbox = manage (new HBox);
 
-       hbox->set_border_width (12);
-       vbox->set_border_width (12);
+       vbox->set_border_width (24);
 
-       hbox->pack_start (*foomatic, false, true);
-       vbox->pack_start (*hbox, false, true);
+       hbox->pack_start (*foomatic, true, true);
+       vbox->pack_start (*hbox, true, true);
 
        foomatic->show ();
        hbox->show ();
        vbox->show ();
 
-       append_page (*vbox);
+       new_user_page_index = append_page (*vbox);
        set_page_type (*vbox, ASSISTANT_PAGE_INTRO);
-       set_page_title (*vbox, _("Welcome to Ardour"));
+       set_page_title (*vbox, string_compose (_("Welcome to %1"), PROGRAM_NAME));
        set_page_header_image (*vbox, icon_pixbuf);
        set_page_complete (*vbox, true);
 }
 
+void
+ArdourStartup::default_dir_changed ()
+{
+       Config->set_default_session_parent_dir (default_dir_chooser->get_filename());
+       // make new session folder chooser point to the new default
+       new_folder_chooser.set_current_folder (Config->get_default_session_parent_dir());
+       config_changed ();
+}
+
+void
+ArdourStartup::config_changed ()
+{
+       config_modified = true;
+}
+
 void
 ArdourStartup::setup_first_time_config_page ()
 {
-       Gtk::FileChooserButton* fcb = manage (new FileChooserButton (_("Default session folder"), FILE_CHOOSER_ACTION_SELECT_FOLDER));
+       default_dir_chooser = manage (new FileChooserButton (string_compose (_("Default folder for %1 sessions"), PROGRAM_NAME),
+                                                            FILE_CHOOSER_ACTION_SELECT_FOLDER));
        Gtk::Label* txt = manage (new Label);
-       HBox* hbox1 = manage (new HBox);
+       HBox* hbox = manage (new HBox);
        VBox* vbox = manage (new VBox);
-       
-       txt->set_markup (_("\
-Each project that you work on with Ardour has its own folder.\n\
+
+       txt->set_markup (string_compose (_("\
+Each project that you work on with %1 has its own folder.\n\
 These can require a lot of disk space if you are recording audio.\n\
 \n\
-Where would you like new Ardour sessions to be stored by default?\n\
-<i>(You can put new sessions anywhere - this is just a default)</i>"));
+Where would you like new %1 sessions to be stored by default?\n\n\
+<i>(You can put new sessions anywhere, this is just a default)</i>"), PROGRAM_NAME));
+       txt->set_alignment (0.0, 0.0);
+
+       vbox->set_spacing (18);
+       vbox->set_border_width (24);
 
-       hbox1->set_border_width (6);
-       vbox->set_border_width (6);
+       hbox->pack_start (*default_dir_chooser, false, true, 8);
+       vbox->pack_start (*txt, false, false);
+       vbox->pack_start (*hbox, false, true);
 
-       hbox1->pack_start (*fcb, false, true);
-       vbox->pack_start (*txt, false, true);
-       vbox->pack_start (*hbox1, false, true);
+       cerr << "set default folder to " << poor_mans_glob (Config->get_default_session_parent_dir()) << endl;
+       default_dir_chooser->set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
+       default_dir_chooser->signal_current_folder_changed().connect (sigc::mem_fun (*this, &ArdourStartup::default_dir_changed));
+       default_dir_chooser->show ();
 
-       fcb->show ();
-       txt->show ();
-       hbox1->show ();
-       vbox->show ();
+       vbox->show_all ();
 
-       append_page (*vbox);
+       default_folder_page_index = append_page (*vbox);
        set_page_title (*vbox, _("Default folder for new sessions"));
        set_page_header_image (*vbox, icon_pixbuf);
        set_page_type (*vbox, ASSISTANT_PAGE_CONTENT);
@@ -140,350 +231,209 @@ Where would you like new Ardour sessions to be stored by default?\n\
 }
 
 void
-ArdourStartup::setup_initial_choice_page ()
+ArdourStartup::setup_monitoring_choice_page ()
 {
-       ic_vbox.set_spacing (6);
-       ic_vbox.set_border_width (6);
+       mon_vbox.set_spacing (18);
+       mon_vbox.set_border_width (24);
 
-       RadioButton::Group g (ic_new_session_button.get_group());
-       ic_existing_session_button.set_group (g);
-
-       ic_vbox.pack_start (ic_new_session_button);
-       ic_vbox.pack_start (ic_existing_session_button);
-
-       ic_new_session_button.show ();
-       ic_existing_session_button.show ();
-       ic_vbox.show ();
-
-       append_page (ic_vbox);
-       set_page_title (ic_vbox, _("What would you like to do?"));
-       set_page_header_image (ic_vbox, icon_pixbuf);
+       HBox* hbox = manage (new HBox);
+       VBox* vbox = manage (new VBox);
+       /* first button will be on by default */
+       RadioButton::Group g (monitor_via_ardour_button.get_group());
+       monitor_via_hardware_button.set_group (g);
+
+       monitor_label.set_markup(_("\
+While recording instruments or vocals, you probably want to listen to the\n\
+signal as well as record it. This is called \"monitoring\". There are\n\
+different ways to do this depending on the equipment you have and the\n\
+configuration of that equipment. The two most common are presented here.\n\
+Please choose whichever one is right for your setup.\n\n\
+<i>(You can change this preference at any time, via the Preferences dialog)</i>\n\n\
+<i>If you do not understand what this is about, just accept the default.</i>"));
+       monitor_label.set_alignment (0.0, 0.0);
+
+       vbox->set_spacing (6);
+
+       vbox->pack_start (monitor_via_hardware_button, false, true);
+       vbox->pack_start (monitor_via_ardour_button, false, true);
+       hbox->pack_start (*vbox, true, true, 8);
+       mon_vbox.pack_start (monitor_label, false, false);
+       mon_vbox.pack_start (*hbox, false, false);
+
+       mon_vbox.show_all ();
+
+       monitoring_page_index = append_page (mon_vbox);
+       set_page_title (mon_vbox, _("Monitoring Choices"));
+       set_page_header_image (mon_vbox, icon_pixbuf);
 
        /* user could just click on "Forward" if default
         * choice is correct.
         */
 
-       set_page_complete (ic_vbox, true);
+       set_page_complete (mon_vbox, true);
 }
 
 void
-ArdourStartup::setup_session_page ()
+ArdourStartup::setup_monitor_section_choice_page ()
 {
-       session_hbox.set_border_width (12);
-       session_vbox.set_border_width (12);
+       mon_sec_vbox.set_spacing (18);
+       mon_sec_vbox.set_border_width (24);
 
-       session_vbox.pack_start (session_hbox, true, true);
-       session_vbox.show ();
-       session_hbox.show ();
+       HBox* hbox = manage (new HBox);
+       VBox* main_vbox = manage (new VBox);
+       VBox* vbox;
+       Label* l = manage (new Label);
 
-       append_page (session_vbox);
-}
+       main_vbox->set_spacing (32);
 
-void
-ArdourStartup::setup_final_page ()
-{
-       final_page.set_text ("Ardour is ready for use");
-       final_page.show ();
-       append_page (final_page);
-       set_page_complete (final_page, true);
-       set_page_header_image (final_page, icon_pixbuf);
-       set_page_type (final_page, ASSISTANT_PAGE_CONFIRM);
-}
+       no_monitor_section_button.set_label (_("Use a Master bus directly"));
+       l->set_alignment (0.0, 1.0);
+       l->set_markup(_("Connect the Master bus directly to your hardware outputs. This is preferable for simple usage."));
 
-void
-ArdourStartup::on_cancel ()
-{
-       exit (1);
-}
+       vbox = manage (new VBox);
+       vbox->set_spacing (6);
+       vbox->pack_start (no_monitor_section_button, false, true);
+       vbox->pack_start (*l, false, true);
 
-void
-ArdourStartup::on_close ()
-{
-       if (!applying) {
-               exit (1);
+       main_vbox->pack_start (*vbox, false, false);
+
+       use_monitor_section_button.set_label (_("Use an additional Monitor bus"));
+       l = manage (new Label);
+       l->set_alignment (0.0, 1.0);
+       l->set_text (_("Use a Monitor bus between Master bus and hardware outputs for \n\
+greater control in monitoring without affecting the mix."));
+
+       vbox = manage (new VBox);
+       vbox->set_spacing (6);
+       vbox->pack_start (use_monitor_section_button, false, true);
+       vbox->pack_start (*l, false, true);
+
+       main_vbox->pack_start (*vbox, false, false);
+
+       RadioButton::Group g (use_monitor_section_button.get_group());
+       no_monitor_section_button.set_group (g);
+
+       if (Config->get_use_monitor_bus()) {
+               use_monitor_section_button.set_active (true);
+       } else {
+               no_monitor_section_button.set_active (true);
        }
+
+       use_monitor_section_button.signal_toggled().connect (sigc::mem_fun (*this, &ArdourStartup::config_changed));
+       no_monitor_section_button.signal_toggled().connect (sigc::mem_fun (*this, &ArdourStartup::config_changed));
+
+       monitor_section_label.set_markup(_("<i>You can change this preference at any time via the Preferences dialog.\nYou can also add or remove the monitor section to/from any session.</i>\n\n\
+<i>If you do not understand what this is about, just accept the default.</i>"));
+       monitor_section_label.set_alignment (0.0, 0.0);
+
+       hbox->pack_start (*main_vbox, true, true, 8);
+       mon_sec_vbox.pack_start (*hbox, false, false);
+       mon_sec_vbox.pack_start (monitor_section_label, false, false);
+
+       mon_sec_vbox.show_all ();
+
+       monitor_section_page_index = append_page (mon_sec_vbox);
+       set_page_title (mon_sec_vbox, _("Monitor Section"));
+       set_page_header_image (mon_sec_vbox, icon_pixbuf);
+
+       /* user could just click on "Forward" if default
+        * choice is correct.
+        */
+
+       set_page_complete (mon_sec_vbox, true);
 }
 
 void
-ArdourStartup::on_apply ()
+ArdourStartup::setup_final_page ()
 {
-       applying = true;
+       string msg = string_compose (_("%1 is ready for use"), PROGRAM_NAME);
 
-       // XXX do stuff and then ....
+       plugin_disco_button.signal_clicked().connect (sigc::mem_fun(*this, &ArdourStartup::discover_plugins));
+       plugin_disco_button.set_label (_("Scan for Plugins"));
+       plugin_disco_button.show ();
 
-       gtk_main_quit ();
+       Gtk::Label* final_label = manage (new Label);
+       final_label->set_markup (string_compose ("<span weight=\"bold\" size=\"large\">%1</span>", msg));
+       final_label->show ();
+
+       VBox* vbox = manage (new VBox);
+       vbox->pack_start (*final_label, true, true);
+       if (!Profile->get_mixbus()) {
+               vbox->pack_start (plugin_disco_button, true, false);
+       }
+       vbox->show ();
+
+       final_page_index = append_page (*vbox);
+       set_page_complete (*vbox, true);
+       set_page_header_image (*vbox, icon_pixbuf);
+       set_page_type (*vbox, ASSISTANT_PAGE_CONFIRM);
 }
 
 void
-ArdourStartup::on_prepare (Gtk::Widget* page)
-{
-       if (page == &session_vbox) {
-               if (ic_new_session_button.get_active()) {
-                       /* new session requested */
-                       setup_new_session_page ();
-               } else {
-                       /* existing session requested */
-                       setup_existing_session_page ();
-               }
-       }
+ArdourStartup::discover_plugins () {
+       plugin_disco_button.set_sensitive (false);
+       PluginManager::instance().refresh();
 }
 
 void
-ArdourStartup::setup_new_session_page ()
+ArdourStartup::on_cancel ()
 {
-       if (!session_hbox.get_children().empty()) {
-               session_hbox.remove (**session_hbox.get_children().begin());
-       }
-
-       if (session_new_vbox.get_children().empty()) {
-               
-               HBox* hbox1 = manage (new HBox);
-               Label* label1 = manage (new Label);
-               
-               hbox1->set_spacing (6);
-               hbox1->pack_start (*label1, false, false);
-               hbox1->pack_start (new_name_entry, true, true);
-               
-               label1->set_text (_("Session name:"));
-               
-               hbox1->show();
-               label1->show();
-               new_name_entry.show ();
-               
-               new_name_entry.signal_changed().connect (mem_fun (*this, &ArdourStartup::new_name_changed));
-               
-               HBox* hbox2 = manage (new HBox);
-               Label* label2 = manage (new Label);
-               
-               hbox2->set_spacing (6);
-               hbox2->pack_start (*label2, false, false);
-               hbox2->pack_start (new_folder_chooser, true, true);
-               
-               label2->set_text (_("Create session folder in:"));
-               new_folder_chooser.set_current_folder(getenv ("HOME")); 
-               new_folder_chooser.set_title (_("Select folder for session"));
-               
-               hbox2->show();
-               label2->show();
-               new_folder_chooser.show ();
-               
-               if (is_directory (user_template_directory ())) {
-                       session_template_chooser.set_current_folder (user_template_directory().to_string());
-               } else if (is_directory (system_template_directory ())) {
-                       session_template_chooser.set_current_folder (system_template_directory().to_string());
-               } else {
-                       /* hmm, no templates ... what to do? */
-               }
-               
-               if (is_directory (system_template_directory ())) {
-                       session_template_chooser.add_shortcut_folder (system_template_directory().to_string());
-               }
-               
-               HBox* hbox3 = manage (new HBox);
-               Label* label3 = manage (new Label);
-               
-               hbox3->set_spacing (6);
-               hbox3->pack_start (*label3, false, false);
-               hbox3->pack_start (session_template_chooser, true, true);
-               
-               label3->set_text (_("Use this template:"));
-               
-               hbox3->show ();
-               label3->show ();
-               session_template_chooser.show ();
-               
-               Gtk::FileFilter* template_filter = manage (new (Gtk::FileFilter));
-               template_filter->add_pattern(X_("*.template"));
-               session_template_chooser.set_filter (*template_filter);
-               session_template_chooser.set_title (_("Select template"));
-               
-               
-               HBox* hbox4 = manage (new HBox);
-       
-               hbox4->set_spacing (6);
-               hbox4->pack_start (more_new_session_options_button, false, false);
-               
-               hbox4->show ();
-               more_new_session_options_button.show ();
-               more_new_session_options_button.signal_clicked().connect (mem_fun (*this, &ArdourStartup::more_new_session_options_button_clicked));
-               session_new_vbox.set_spacing (12);
-       
-               session_new_vbox.pack_start (*hbox1, false, false);
-               session_new_vbox.pack_start (*hbox2, false, false);
-               session_new_vbox.pack_start (*hbox3, false, false);
-               session_new_vbox.pack_start (*hbox4, false, false);
-       }
-
-       session_new_vbox.show ();
-       session_hbox.pack_start (session_new_vbox, false, false);
-       set_page_title (session_vbox, _("New Session"));
+       _response = RESPONSE_CANCEL;
+       gtk_main_quit ();
 }
 
-void
-ArdourStartup::new_name_changed ()
+bool
+ArdourStartup::on_delete_event (GdkEventAny*)
 {
-       if (!new_name_entry.get_text().empty()) {
-               set_page_complete (session_vbox, true);
-       } else {
-               set_page_complete (session_vbox, false);
-       }
+       _response = RESPONSE_CLOSE;
+       gtk_main_quit ();
+       return true;
 }
 
 void
-ArdourStartup::redisplay_recent_sessions ()
+ArdourStartup::on_apply ()
 {
-       std::vector<sys::path> session_directories;
-       RecentSessionsSorter cmp;
-       
-       recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
-       recent_session_model->clear ();
-
-       ARDOUR::RecentSessions rs;
-       ARDOUR::read_recent_sessions (rs);
-
-       if (rs.empty()) {
-               recent_session_display.set_model (recent_session_model);
-               return;
-       }
-       //
-       // sort them alphabetically
-       sort (rs.begin(), rs.end(), cmp);
-       
-       for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
-               session_directories.push_back ((*i).second);
+       /* file-chooser button does not emit 'current_folder_changed' signal
+        * when a folder from the dropdown or the sidebar is chosen.
+        * -> explicitly poll for the dir as suggested by the gtk documentation.
+        */
+       if (default_dir_chooser && default_dir_chooser->get_filename() != Config->get_default_session_parent_dir ()) {
+               config_modified = true;
        }
-       
-       for (vector<sys::path>::const_iterator i = session_directories.begin();
-                       i != session_directories.end(); ++i)
-       {
-               std::vector<sys::path> state_file_paths;
-           
-               // now get available states for this session
 
-               get_state_files_in_directory (*i, state_file_paths);
+       if (config_modified) {
 
-               vector<string*>* states;
-               vector<const gchar*> item;
-               string fullpath = (*i).to_string();
-               
-               /* remove any trailing / */
-
-               if (fullpath[fullpath.length()-1] == '/') {
-                       fullpath = fullpath.substr (0, fullpath.length()-1);
+               if (default_dir_chooser) {
+                       Config->set_default_session_parent_dir (default_dir_chooser->get_filename());
                }
 
-               /* check whether session still exists */
-               if (!Glib::file_test(fullpath.c_str(), Glib::FILE_TEST_EXISTS)) {
-                       /* session doesn't exist */
-                       cerr << "skipping non-existent session " << fullpath << endl;
-                       continue;
-               }               
-               
-               /* now get available states for this session */
-
-               if ((states = Session::possible_states (fullpath)) == 0) {
-                       /* no state file? */
-                       continue;
+               if (monitor_via_hardware_button.get_active()) {
+                       Config->set_monitoring_model (ExternalMonitoring);
+               } else if (monitor_via_ardour_button.get_active()) {
+                       Config->set_monitoring_model (SoftwareMonitoring);
                }
-         
-               std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths));
-
-               Gtk::TreeModel::Row row = *(recent_session_model->append());
 
-               row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
-               row[recent_session_columns.fullpath] = fullpath;
-               
-               if (state_file_names.size() > 1) {
+               Config->set_use_monitor_bus (use_monitor_section_button.get_active());
 
-                       // add the children
+               Config->save_state ();
 
-                       for (std::vector<std::string>::iterator i2 = state_file_names.begin();
-                                       i2 != state_file_names.end(); ++i2)
-                       {
-
-                               Gtk::TreeModel::Row child_row = *(recent_session_model->append (row.children()));
-
-                               child_row[recent_session_columns.visible_name] = *i2;
-                               child_row[recent_session_columns.fullpath] = fullpath;
-                       }
-               }
        }
 
-       recent_session_display.set_model (recent_session_model);
-}
-
-void
-ArdourStartup::recent_session_row_selected ()
-{
-       if (recent_session_display.get_selection()->count_selected_rows() > 0) {
-               set_page_complete (session_vbox, true);
-       } else {
-               set_page_complete (session_vbox, false);
-       }
-}
-
-void
-ArdourStartup::setup_existing_session_page ()
-{
-       if (!session_hbox.get_children().empty()) {
-               session_hbox.remove (**session_hbox.get_children().begin());
-       }
+       {
+               /* "touch" the been-here-before path now we've successfully
+                  made it through the first time setup (at least)
+               */
+               PBD::ScopedFileDescriptor fout (g_open (been_here_before_path ().c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666));
 
-       if (recent_scroller.get_children().empty()) {
-
-               recent_session_model = TreeStore::create (recent_session_columns);
-               recent_session_display.set_model (recent_session_model);
-               recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
-               recent_session_display.set_headers_visible (false);
-               recent_session_display.get_selection()->set_mode (SELECTION_BROWSE);
-               
-               recent_session_display.get_selection()->signal_changed().connect (mem_fun (*this, &ArdourStartup::recent_session_row_selected));
-               
-               recent_scroller.add (recent_session_display);
-               recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
-               
-               recent_session_display.show();
        }
 
-       recent_scroller.show();
-       redisplay_recent_sessions ();
-
-       session_hbox.pack_start (recent_scroller, true, true);
-       set_page_title (session_vbox, _("Select a session"));
-       set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
+       _response = RESPONSE_OK;
+       gtk_main_quit ();
 }
 
-void
-ArdourStartup::more_new_session_options_button_clicked ()
-{
-       if (more_new_session_options_button.get_active()) {
-               more_options_vbox.show ();
-       } else {
-               more_options_vbox.hide ();
-       }
-}
 
 void
-ArdourStartup::setup_more_options_page ()
+ArdourStartup::move_along_now ()
 {
-       Label* foomatic = manage (new Label);
-       foomatic->set_text (_("Here be more options...."));
-       foomatic->show ();
-
-       more_options_vbox.set_border_width (12);
-       more_options_hbox.set_border_width (12);
-       
-       more_options_hbox.pack_start (*foomatic, true, true);
-       more_options_vbox.pack_start (more_options_hbox, true, true);
-
-       more_options_hbox.show ();
-
-       /* note that more_options_vbox is NOT visible by
-        * default. this is entirely by design - this page
-        * should be skipped unless explicitly requested.
-        */
-       
-       append_page (more_options_vbox);
-       set_page_title (more_options_vbox, _("Advanced Session Options"));
-       set_page_complete (more_options_vbox, true);
+       on_apply ();
 }