Solving issue #3998

This commit is contained in:
Hombre57
2017-08-20 00:57:30 +02:00
parent 87b84b3c7b
commit 66ba9127ac

View File

@@ -261,8 +261,30 @@ RTWindow *create_rt_window()
#endif
Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
Glib::ustring filename = Glib::build_filename(argv0, "themes", options.theme + ".css");
if (!regex->match(options.theme + ".css") || !Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
Glib::ustring filename;
Glib::MatchInfo mInfo;
bool match = regex->match(options.theme + ".css", mInfo);
if (match) {
// save old theme (name + version)
Glib::ustring initialTheme(options.theme);
// update version
auto pos = options.theme.find("-GTK3-");
Glib::ustring themeRootName(options.theme.substr(0, pos));
if (GTK_MINOR_VERSION < 20) {
options.theme = themeRootName + "-GTK3-_19";
} else {
options.theme = themeRootName + "-GTK3-20_";
}
// check if this version exist
if (!Glib::file_test(Glib::build_filename(argv0, "themes", options.theme + ".css"), Glib::FILE_TEST_EXISTS)) {
// set back old theme version if the actual one doesn't exist yet
options.theme = initialTheme;
}
}
filename = Glib::build_filename(argv0, "themes", options.theme + ".css");
if (!match || !Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
options.theme = "RawTherapee-GTK";
// We're not testing GTK_MAJOR_VERSION == 3 here, since this branch requires Gtk3 only
if (GTK_MINOR_VERSION < 20) {