diff --git a/rtgui/options.cc b/rtgui/options.cc index 1895d91c2..3fb8e0c1a 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -373,7 +373,7 @@ void Options::setDefaults () languageAutoDetect = langMgr.isOSLanguageDetectSupported(); lastSaveAsPath = ""; overwriteOutputFile = false; // if TRUE, existing output JPGs/PNGs are overwritten, instead of adding ..-1.jpg, -2.jpg etc. - theme = "25-Gray-Gray"; + theme = "cookiedough"; slimUI = false; useSystemTheme = false; maxThumbnailHeight = 250; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index b3fec7b4f..c29cfd676 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -909,7 +909,7 @@ Gtk::Widget* Preferences::getGeneralPanel () theme->set_active (0); std::vector themes; - parseDir (argv0 + "/themes", themes, ".gtkrc"); + parseDir (argv0 + "/themes", themes, ".css"); for (size_t i = 0; i < themes.size(); i++) { theme->append (themes[i]); @@ -1339,6 +1339,10 @@ void Preferences::parseDir (Glib::ustring dirname, std::vector& i Glib::ustring fname = Glib::build_filename(dirname, *i); Glib::ustring sname = *i; + if (sname == "slim.css") { + continue; + } + // ignore directories if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR) && sname.size() >= ext.size() && sname.substr (sname.size() - ext.size(), ext.size()).casefold() == ext) { items.push_back (sname.substr(0, sname.size() - ext.size())); @@ -1960,20 +1964,33 @@ void Preferences::fontChanged () void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface) { - //Glib::ustring filename(argv0 + "/themes/" + options.theme + ".css"); - // Forcing the default dark theme - Glib::ustring filename(argv0 + "/themes/rtcommon.css"); + Glib::ustring filename(argv0 + "/themes/" + newTheme + ".css"); if (!css) { css = Gtk::CssProvider::create(); } + bool loaded = true; try { css->load_from_path (filename); } catch (Glib::Error &err) { printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); + loaded = false; } catch (...) { printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + loaded = false; + } + + if (!loaded && options.theme != "rtcommon") { + try { + printf("Trying with \"rtcommon.css\"\n"); + filename = argv0 + "/themes/rtcommon.css"; + css->load_from_path (filename); + } catch (Glib::Error &err) { + printf("Error: Can't load css file \"rtcommon.css\"\nMessage: %s\n", err.what().c_str()); + } catch (...) { + printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + } } options.slimUI = slimInterface; @@ -1985,7 +2002,7 @@ void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface) slimCreated = true; } - filename = argv0 + "/themes/cookiedough.css"; + filename = argv0 + "/themes/slim.css"; try { cssSlim->load_from_path (filename); diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index 6bff33c48..56f2ae46a 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -101,12 +101,16 @@ Glib::ustring RTImage::findIconAbsolutePath(const Glib::ustring &iconFName) void RTImage::setPaths(Options &opt) { + imagesPaths.clear(); + + /* + * Forcing the Dark theme, so reading the .iconset file is useless for now + * + * Glib::ustring configFilename; rtengine::SafeKeyFile keyFile; bool hasKeyFile = true; - imagesPaths.clear(); - // system theme will use the theme set in system.iconset if (opt.useSystemTheme) { configFilename = Glib::build_filename(argv0, Glib::build_filename("themes", "system.iconset")); @@ -119,7 +123,7 @@ void RTImage::setPaths(Options &opt) try { if (!safe_file_test(configFilename, Glib::FILE_TEST_EXISTS) || !keyFile.load_from_file (configFilename)) { // ...otherwise fallback to the iconset set in default.iconset - configFilename = Glib::build_filename(argv0, Glib::build_filename("themes", "Default.iconset")); + configFilename = Glib::build_filename(argv0, Glib::build_filename("themes", "default.iconset")); if (!keyFile.load_from_file (configFilename)) { hasKeyFile = false; @@ -139,7 +143,7 @@ void RTImage::setPaths(Options &opt) Glib::ustring iSet; if (keyFile.has_key ("General", "Iconset")) { - iSet = "Dark"; //keyFile.get_string ("General", "Iconset"); + iSet = keyFile.get_string ("General", "Iconset"); } if (iSet.length()) { @@ -161,7 +165,12 @@ void RTImage::setPaths(Options &opt) imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", Glib::build_filename(iSet, "devices")))); imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", Glib::build_filename(iSet, "places")))); } - } + }*/ + + imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", Glib::build_filename("Dark", "actions")))); + imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", "Dark"))); + imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", Glib::build_filename("Dark", "devices")))); + imagesPaths.push_back (Glib::build_filename(argv0, Glib::build_filename("images", Glib::build_filename("Dark", "places")))); // The images/ folder is the second fallback solution imagesPaths.push_back (Glib::build_filename(argv0, "images"));