Fix inconsistent session-check
[ardour.git] / gtk2_ardour / export_file_notebook.cc
index 94f6f7f08a314a9ef1c17d32049ca29ef3ed59a5..a91a253b3cf2f2e430a83cb350ff2011cadf7208 100644 (file)
@@ -112,21 +112,11 @@ ExportFileNotebook::update_soundcloud_upload ()
        soundcloud_export_selector->set_visible (show_credentials_entry);
 }
 
-void
-ExportFileNotebook::FilePage::on_hide ()
-{
-       VBox::on_hide ();
-       if (save_format_on_hide) {
-               profile_manager->save_format_to_disk (format_state->format);
-               save_format_on_hide = false;
-       }
-}
-
 void
 ExportFileNotebook::FilePage::analysis_changed ()
 {
        format_state->format->set_analyse (analysis_button.get_active ());
-       save_format_on_hide = true;
+       profile_manager->save_format_to_disk (format_state->format);
 }
 
 void
@@ -208,16 +198,15 @@ ExportFileNotebook::handle_page_change (GtkNotebookPage*, uint32_t page)
 ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number,
                                         ExportProfileManager::FormatStatePtr format_state,
                                         ExportProfileManager::FilenameStatePtr filename_state) :
-  format_state (format_state),
-  filename_state (filename_state),
-  profile_manager (profile_manager),
-
-  format_label (_("Format"), Gtk::ALIGN_LEFT),
-  filename_label (_("Location"), Gtk::ALIGN_LEFT),
-  soundcloud_upload_button (_("Upload to Soundcloud")),
-  analysis_button (_("Analyze Exported Audio")),
-  tab_number (number),
-  save_format_on_hide(false)
+       format_state (format_state),
+       filename_state (filename_state),
+       profile_manager (profile_manager),
+
+       format_label (_("Format"), Gtk::ALIGN_LEFT),
+       filename_label (_("Location"), Gtk::ALIGN_LEFT),
+       soundcloud_upload_button (_("Upload to Soundcloud")),
+       analysis_button (_("Analyze Exported Audio")),
+       tab_number (number)
 {
        set_border_width (12);
 
@@ -228,7 +217,9 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
 
        Gtk::HBox *hbox = Gtk::manage (new Gtk::HBox());
        hbox->set_spacing (6);
+#ifndef NDEBUG // SoundCloud upload is currently b0rked, needs debugging
        hbox->pack_start (soundcloud_upload_button, false, false, 0);
+#endif
        hbox->pack_start (analysis_button, false, false, 0);
        pack_start (*hbox, false, false, 0);
 
@@ -261,6 +252,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
        format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_manager));
        format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
        format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format));
+       format_selector.FormatReverted.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::revert_format_profile));
 
        format_selector.CriticalSelectionChanged.connect (
                sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed));
@@ -309,13 +301,16 @@ ExportFileNotebook::FilePage::get_format_name () const
 bool
 ExportFileNotebook::FilePage::get_soundcloud_upload () const
 {
+#ifdef NDEBUG // SoundCloud upload is currently b0rked, needs debugging
+       return false;
+#endif
        return soundcloud_upload_button.get_active ();
 }
 
 void
 ExportFileNotebook::FilePage::soundcloud_upload_changed ()
 {
-       save_format_on_hide = true;
+       profile_manager->save_format_to_disk (format_state->format);
 }
 
 void