Split up Config::read().
authorCarl Hetherington <cth@carlh.net>
Sun, 4 Sep 2022 18:50:06 +0000 (20:50 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Sep 2022 18:50:06 +0000 (20:50 +0200)
src/lib/config.cc
src/lib/config.h

index c9b42857149a665da7fdc901c8fdfeb41751bf21..d9a39077e560048012f8b62ff3c761e29605be5b 100644 (file)
@@ -270,6 +270,15 @@ Config::backup ()
 
 void
 Config::read ()
+{
+       read_config();
+       read_cinemas();
+       read_dkdm_recipients();
+}
+
+
+void
+Config::read_config()
 try
 {
        cxml::Document f ("Config");
@@ -597,18 +606,6 @@ try
        _last_release_notes_version = f.optional_string_child("LastReleaseNotesVersion");
 
        _export.read(f.optional_node_child("Export"));
-
-       if (boost::filesystem::exists (_cinemas_file)) {
-               cxml::Document f ("Cinemas");
-               f.read_file (_cinemas_file);
-               read_cinemas (f);
-       }
-
-       if (boost::filesystem::exists (_dkdm_recipients_file)) {
-               cxml::Document f ("DKDMRecipients");
-               f.read_file (_dkdm_recipients_file);
-               read_dkdm_recipients (f);
-       }
 }
 catch (...) {
        if (have_existing("config.xml") || have_existing("cinemas.xml") || have_existing("dkdm_recipients.xml")) {
@@ -624,6 +621,29 @@ catch (...) {
        write ();
 }
 
+
+void
+Config::read_cinemas()
+{
+       if (boost::filesystem::exists (_cinemas_file)) {
+               cxml::Document f ("Cinemas");
+               f.read_file (_cinemas_file);
+               read_cinemas (f);
+       }
+}
+
+
+void
+Config::read_dkdm_recipients()
+{
+       if (boost::filesystem::exists (_dkdm_recipients_file)) {
+               cxml::Document f ("DKDMRecipients");
+               f.read_file (_dkdm_recipients_file);
+               read_dkdm_recipients (f);
+       }
+}
+
+
 /** @return Singleton instance */
 Config *
 Config::instance ()
index 8f1029910ec51822441e5331a07ce1b0d9d99320..96016d75b8870ead42d58e9ad96a35a532f21b9e 100644 (file)
@@ -1204,6 +1204,9 @@ public:
 private:
        Config ();
        void read () override;
+       void read_config();
+       void read_cinemas();
+       void read_dkdm_recipients();
        void set_defaults ();
        void set_kdm_email_to_default ();
        void set_notification_email_to_default ();