fix incorrect accumulation of export video options each time the dialog is used
[ardour.git] / gtk2_ardour / startup.cc
index f3e1808a9c4487057ea4cae224d7c3b86d41ba54..b481e434d14de5438438fed8c3b7f94bdd299aa2 100644 (file)
 #include "gtk2ardour-version.h"
 #endif
 
-#include <fstream>
 #include <algorithm>
 #include <fcntl.h>
 
-#include <glib/gstdio.h>
+#include "pbd/gstdio_compat.h"
 
 #include <gtkmm/main.h>
 #include <gtkmm/filechooser.h>
 #include "ardour/session.h"
 #include "ardour/session_state_utils.h"
 #include "ardour/template_utils.h"
+#include "ardour/profile.h"
 
-#include "ardour_ui.h"
 #include "startup.h"
 #include "opts.h"
 #include "engine_dialog.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 #include "utils.h"
 
 using namespace std;
@@ -80,30 +79,30 @@ ArdourStartup::ArdourStartup ()
 {
        set_position (WIN_POS_CENTER);
        set_border_width (12);
-       
-       if ((icon_pixbuf = ::get_icon ("ardour_icon_48px")) == 0) {
+
+       if (! (icon_pixbuf = ::get_icon (PROGRAM_NAME "-icon_48px"))) {
                throw failed_constructor();
        }
-       
+
        list<Glib::RefPtr<Gdk::Pixbuf> > window_icons;
        Glib::RefPtr<Gdk::Pixbuf> icon;
-       
-       if ((icon = ::get_icon ("ardour_icon_16px")) != 0) {
+
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_16px"))) {
                window_icons.push_back (icon);
        }
-       if ((icon = ::get_icon ("ardour_icon_22px")) != 0) {
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_22px"))) {
                window_icons.push_back (icon);
        }
-       if ((icon = ::get_icon ("ardour_icon_32px")) != 0) {
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_32px"))) {
                window_icons.push_back (icon);
        }
-       if ((icon = ::get_icon ("ardour_icon_48px")) != 0) {
+       if ((icon = ::get_icon (PROGRAM_NAME "-icon_48px"))) {
                window_icons.push_back (icon);
        }
        if (!window_icons.empty ()) {
                set_default_icon_list (window_icons);
        }
-       
+
        setup_new_user_page ();
        setup_first_time_config_page ();
        setup_monitoring_choice_page ();
@@ -120,20 +119,8 @@ 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;
-               }
+       if (Glib::file_test (ARDOUR::been_here_before_path (), Glib::FILE_TEST_EXISTS)) {
+               return false;
        }
 
        return true;
@@ -180,7 +167,7 @@ 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());       
+       new_folder_chooser.set_current_folder (Config->get_default_session_parent_dir());
        config_changed ();
 }
 
@@ -267,6 +254,9 @@ Please choose whichever one is right for your setup.\n\n\
        set_page_title (mon_vbox, _("Monitoring Choices"));
        set_page_header_image (mon_vbox, icon_pixbuf);
 
+       monitor_via_hardware_button.signal_toggled().connect (sigc::mem_fun (*this, &ArdourStartup::config_changed));
+       monitor_via_ardour_button.signal_toggled().connect (sigc::mem_fun (*this, &ArdourStartup::config_changed));
+
        /* user could just click on "Forward" if default
         * choice is correct.
         */
@@ -359,7 +349,9 @@ ArdourStartup::setup_final_page ()
 
        VBox* vbox = manage (new VBox);
        vbox->pack_start (*final_label, true, true);
-       vbox->pack_start (plugin_disco_button, true, false);
+       if (!Profile->get_mixbus()) {
+               vbox->pack_start (plugin_disco_button, true, false);
+       }
        vbox->show ();
 
        final_page_index = append_page (*vbox);
@@ -425,7 +417,7 @@ ArdourStartup::on_apply ()
                PBD::ScopedFileDescriptor fout (g_open (been_here_before_path ().c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666));
 
        }
-               
+
        _response = RESPONSE_OK;
        gtk_main_quit ();
 }