-Configuration::set_current_owner (ConfigVariableBase::Owner owner)
-{
- current_owner = owner;
-}
-
-int
-Configuration::load_state ()
-{
- bool found = false;
-
- sys::path system_rc_file;
-
- /* load system configuration first */
-
- if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(),
- "ardour_system.rc", system_rc_file) )
- {
- XMLTree tree;
- found = true;
-
- string rcfile = system_rc_file.to_string();
-
- cerr << string_compose (_("loading system configuration file %1"), rcfile) << endl;
-
- if (!tree.read (rcfile.c_str())) {
- error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
- return -1;
- }
-
- current_owner = ConfigVariableBase::System;
-
- if (set_state (*tree.root())) {
- error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
- return -1;
- }
- }
-
- /* now load configuration file for user */
-
- sys::path user_rc_file;
-
- if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
- "ardour.rc", user_rc_file))
- {
- XMLTree tree;
- found = true;
-
- string rcfile = user_rc_file.to_string();
-
- cerr << string_compose (_("loading user configuration file %1"), rcfile) << endl;
-
- if (!tree.read (rcfile)) {
- error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
- return -1;
- }
-
- current_owner = ConfigVariableBase::Config;
-
- if (set_state (*tree.root())) {
- error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
- return -1;
- }
- }
-
- if (!found)
- error << "Ardour: could not find configuration file (ardour.rc), canvas will look broken." << endmsg;
-
- pack_canvasvars();
- return 0;
-}
-
-int
-Configuration::save_state()
-{
- XMLTree tree;
-
- try
- {
- sys::create_directories (user_config_directory ());
- }
- catch (const sys::filesystem_error& ex)
- {
- error << "Could not create user configuration directory" << endmsg;
- return -1;
- }
-
- sys::path rcfile_path(user_config_directory());
-
- rcfile_path /= "ardour.rc";
- const string rcfile = rcfile_path.to_string();
-
- // this test seems bogus?
- if (rcfile.length()) {
- tree.set_root (&get_state());
- if (!tree.write (rcfile.c_str())){
- error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
- return -1;
- }
- }
-
- return 0;
-}
-
-void
-Configuration::add_instant_xml(XMLNode& node)
-{
- Stateful::add_instant_xml (node, user_config_directory ());
-}
-
-XMLNode*
-Configuration::instant_xml(const string& node_name)