+std::string
+UIConfiguration::color_file_name (bool use_my, bool with_version) const
+{
+ string basename;
+
+ if (use_my) {
+ basename += "my-";
+ }
+
+ //this is the overall theme file, e.g. "dark" plus "-downcase(PROGRAM_NAME)"
+ basename += color_file.get();
+
+ std::string rev (revision);
+ std::size_t pos = rev.find_first_of("-");
+
+ if (with_version && pos != string::npos && pos > 0) {
+ basename += "-";
+ basename += rev.substr (0, pos); // COLORFILE_VERSION - program major.minor
+ }
+
+ basename += color_file_suffix;
+ return basename;
+}
+
+int
+UIConfiguration::load_color_file (string const & path)
+{
+ XMLTree tree;
+
+ info << string_compose (_("Loading color file %1"), path) << endmsg;
+
+ if (!tree.read (path.c_str())) {
+ error << string_compose(_("cannot read color file \"%1\""), path) << endmsg;
+ return -1;
+ }
+
+ if (set_state (*tree.root(), Stateful::loading_state_version)) {
+ error << string_compose(_("color file \"%1\" not loaded successfully."), path) << endmsg;
+ return -1;
+ }
+
+ return 0;
+}
+