From dab6e8a2d33b7ab6127d3916d253f2c41b51b6a0 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sun, 11 Sep 2016 08:39:08 +1000 Subject: Fix #7003, Store/Restore state of checkboxes in Export dialog --- gtk2_ardour/export_file_notebook.cc | 43 +++++++++++++++++++++++++++++++++++++ gtk2_ardour/export_file_notebook.h | 5 +++++ 2 files changed, 48 insertions(+) diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index 8e37356d0d..ad590ad18c 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -112,12 +112,55 @@ ExportFileNotebook::update_soundcloud_upload () soundcloud_export_selector->set_visible (show_credentials_entry); } +void +ExportFileNotebook::FilePage::on_show () +{ + VBox::on_show (); + restore_state (); +} + +void +ExportFileNotebook::FilePage::on_hide () +{ + VBox::on_hide (); + store_state (); +} + void ExportFileNotebook::FilePage::analysis_changed () { format_state->format->set_analyse (analysis_button.get_active ()); } +void +ExportFileNotebook::FilePage::store_state () +{ + XMLNode node (X_("ExportFile")); + node.add_property ("analyze-audio", analysis_button.get_active () ? "yes" : "no"); + node.add_property ("soundcloud-upload", soundcloud_upload_button.get_active () ? "yes" : "no"); + Config->add_instant_xml (node); +} + +void +ExportFileNotebook::FilePage::restore_state () +{ + XMLNode* node = Config->instant_xml (X_("ExportFile")); + + if (!node) { + return; + } + + XMLProperty const* prop; + + if ((prop = node->property ("analyze-audio")) != 0) { + analysis_button.set_active (string_is_affirmative (prop->value())); + } + + if ((prop = node->property ("soundcloud-upload")) != 0) { + soundcloud_upload_button.set_active (string_is_affirmative (prop->value())); + } +} + void ExportFileNotebook::update_example_filenames () { diff --git a/gtk2_ardour/export_file_notebook.h b/gtk2_ardour/export_file_notebook.h index 43f64bf87e..b39620b72f 100644 --- a/gtk2_ardour/export_file_notebook.h +++ b/gtk2_ardour/export_file_notebook.h @@ -96,6 +96,11 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr void critical_selection_changed (); void analysis_changed (); + void on_show (); + void on_hide (); + void store_state (); + void restore_state (); + ARDOUR::ExportProfileManager::FormatStatePtr format_state; ARDOUR::ExportProfileManager::FilenameStatePtr filename_state; ManagerPtr profile_manager; -- cgit v1.2.3