From 17ff2281774cc9bfccac72f14b2960de914d955e Mon Sep 17 00:00:00 2001 From: Hombre Date: Sun, 20 Nov 2016 12:33:47 +0100 Subject: [PATCH] Making the codified theme file name mandatory (#3446) ...which mean that TooWaBlue.css can't be loaded until it has been reworked and renamed to the new mechanism. The default theme will be loaded instead. --- rtgui/main.cc | 3 ++- rtgui/options.h | 2 ++ rtgui/preferences.cc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rtgui/main.cc b/rtgui/main.cc index c984b4632..9b1102337 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -310,8 +310,9 @@ int main(int argc, char **argv) Gtk::Settings::get_for_screen(screen)->property_gtk_theme_name() = "Adwaita"; Gtk::Settings::get_for_screen(screen)->property_gtk_application_prefer_dark_theme() = true; + Glib::RefPtr regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS); Glib::ustring filename = Glib::build_filename(argv0, "themes", options.theme + ".css"); - if (!Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { + if (!regex->match(options.theme) || !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) { diff --git a/rtgui/options.h b/rtgui/options.h index ff29b789d..1cd9e63e6 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -27,6 +27,8 @@ #define STARTUPDIR_CUSTOM 2 #define STARTUPDIR_LAST 3 +#define THEMEREGEXSTR "^(.+)-GTK3-(\\d{1,2})?_(\\d{1,2})?\\.css$" + // Default bundled profile name to use for Raw images #ifdef WIN32 #define DEFPROFILE_RAW "${G}\\Default" diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index efc5d3972..5cec36f1f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -41,7 +41,7 @@ Preferences::Preferences (RTWindow *rtwindow) , parent (rtwindow) , splash (nullptr) { - regex = Glib::Regex::create("^(.+)-GTK3-(\\d{1,2})?_(\\d{1,2})?\\.css$", Glib::RegexCompileFlags::REGEX_CASELESS); + regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS); moptions.copyFrom (&options);