Adding CSS theme selection ; the Dark iconset is forced, so *.iconset
files are useless for now.
This commit is contained in:
@@ -373,7 +373,7 @@ void Options::setDefaults ()
|
|||||||
languageAutoDetect = langMgr.isOSLanguageDetectSupported();
|
languageAutoDetect = langMgr.isOSLanguageDetectSupported();
|
||||||
lastSaveAsPath = "";
|
lastSaveAsPath = "";
|
||||||
overwriteOutputFile = false; // if TRUE, existing output JPGs/PNGs are overwritten, instead of adding ..-1.jpg, -2.jpg etc.
|
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;
|
slimUI = false;
|
||||||
useSystemTheme = false;
|
useSystemTheme = false;
|
||||||
maxThumbnailHeight = 250;
|
maxThumbnailHeight = 250;
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ Gtk::Widget* Preferences::getGeneralPanel ()
|
|||||||
|
|
||||||
theme->set_active (0);
|
theme->set_active (0);
|
||||||
std::vector<Glib::ustring> themes;
|
std::vector<Glib::ustring> themes;
|
||||||
parseDir (argv0 + "/themes", themes, ".gtkrc");
|
parseDir (argv0 + "/themes", themes, ".css");
|
||||||
|
|
||||||
for (size_t i = 0; i < themes.size(); i++) {
|
for (size_t i = 0; i < themes.size(); i++) {
|
||||||
theme->append (themes[i]);
|
theme->append (themes[i]);
|
||||||
@@ -1339,6 +1339,10 @@ void Preferences::parseDir (Glib::ustring dirname, std::vector<Glib::ustring>& i
|
|||||||
Glib::ustring fname = Glib::build_filename(dirname, *i);
|
Glib::ustring fname = Glib::build_filename(dirname, *i);
|
||||||
Glib::ustring sname = *i;
|
Glib::ustring sname = *i;
|
||||||
|
|
||||||
|
if (sname == "slim.css") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// ignore directories
|
// 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) {
|
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()));
|
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)
|
void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Glib::ustring filename(argv0 + "/themes/" + options.theme + ".css");
|
Glib::ustring filename(argv0 + "/themes/" + newTheme + ".css");
|
||||||
// Forcing the default dark theme
|
|
||||||
Glib::ustring filename(argv0 + "/themes/rtcommon.css");
|
|
||||||
|
|
||||||
if (!css) {
|
if (!css) {
|
||||||
css = Gtk::CssProvider::create();
|
css = Gtk::CssProvider::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool loaded = true;
|
||||||
try {
|
try {
|
||||||
css->load_from_path (filename);
|
css->load_from_path (filename);
|
||||||
} catch (Glib::Error &err) {
|
} catch (Glib::Error &err) {
|
||||||
printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str());
|
printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str());
|
||||||
|
loaded = false;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
printf("Error: Can't load css file \"%s\"\n", filename.c_str());
|
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;
|
options.slimUI = slimInterface;
|
||||||
@@ -1985,7 +2002,7 @@ void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface)
|
|||||||
slimCreated = true;
|
slimCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = argv0 + "/themes/cookiedough.css";
|
filename = argv0 + "/themes/slim.css";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cssSlim->load_from_path (filename);
|
cssSlim->load_from_path (filename);
|
||||||
|
|||||||
@@ -101,12 +101,16 @@ Glib::ustring RTImage::findIconAbsolutePath(const Glib::ustring &iconFName)
|
|||||||
|
|
||||||
void RTImage::setPaths(Options &opt)
|
void RTImage::setPaths(Options &opt)
|
||||||
{
|
{
|
||||||
|
imagesPaths.clear();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Forcing the Dark theme, so reading the .iconset file is useless for now
|
||||||
|
*
|
||||||
|
*
|
||||||
Glib::ustring configFilename;
|
Glib::ustring configFilename;
|
||||||
rtengine::SafeKeyFile keyFile;
|
rtengine::SafeKeyFile keyFile;
|
||||||
bool hasKeyFile = true;
|
bool hasKeyFile = true;
|
||||||
|
|
||||||
imagesPaths.clear();
|
|
||||||
|
|
||||||
// system theme will use the theme set in system.iconset
|
// system theme will use the theme set in system.iconset
|
||||||
if (opt.useSystemTheme) {
|
if (opt.useSystemTheme) {
|
||||||
configFilename = Glib::build_filename(argv0, Glib::build_filename("themes", "system.iconset"));
|
configFilename = Glib::build_filename(argv0, Glib::build_filename("themes", "system.iconset"));
|
||||||
@@ -119,7 +123,7 @@ void RTImage::setPaths(Options &opt)
|
|||||||
try {
|
try {
|
||||||
if (!safe_file_test(configFilename, Glib::FILE_TEST_EXISTS) || !keyFile.load_from_file (configFilename)) {
|
if (!safe_file_test(configFilename, Glib::FILE_TEST_EXISTS) || !keyFile.load_from_file (configFilename)) {
|
||||||
// ...otherwise fallback to the iconset set in default.iconset
|
// ...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)) {
|
if (!keyFile.load_from_file (configFilename)) {
|
||||||
hasKeyFile = false;
|
hasKeyFile = false;
|
||||||
@@ -139,7 +143,7 @@ void RTImage::setPaths(Options &opt)
|
|||||||
Glib::ustring iSet;
|
Glib::ustring iSet;
|
||||||
|
|
||||||
if (keyFile.has_key ("General", "Iconset")) {
|
if (keyFile.has_key ("General", "Iconset")) {
|
||||||
iSet = "Dark"; //keyFile.get_string ("General", "Iconset");
|
iSet = keyFile.get_string ("General", "Iconset");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iSet.length()) {
|
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, "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(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
|
// The images/ folder is the second fallback solution
|
||||||
imagesPaths.push_back (Glib::build_filename(argv0, "images"));
|
imagesPaths.push_back (Glib::build_filename(argv0, "images"));
|
||||||
|
|||||||
Reference in New Issue
Block a user