Commit 5734413d authored by Mikhail Zolotukhin's avatar Mikhail Zolotukhin
Browse files

Respect GTK2_RC_FILES environmental variable

Summary:
If the above variable is set and it does not contain multiple paths,
write GTK2 config into the designated config file, instead of the
default one.

BUG: 415770
FIXED-IN: 5.18.0

Test Plan:
Check if the custom file provided by env variable is modified, when changing any settings, that are synchronized by kded module (icon theme, cursor theme etc)
Simple test:

# `mv ~/.gtkrc-2.0 ~/.gtkrc-2.0.bak`
# `export GTK2_RC_FILES=~/.gtkrc-2.0.bak`
# Restart kded5 with the above env variable
# Change e.g. icon theme and see, that `.gtkrc-2.0.bak` is modified, but `.gtkrc-2.0`

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26375
parent 0f6c58de
...@@ -86,7 +86,10 @@ void ConfigEditor::setGtk3ConfigValueXSettingsd(const QString &paramName, const ...@@ -86,7 +86,10 @@ void ConfigEditor::setGtk3ConfigValueXSettingsd(const QString &paramName, const
void ConfigEditor::setGtk2ConfigValue(const QString &paramName, const QString &paramValue) void ConfigEditor::setGtk2ConfigValue(const QString &paramName, const QString &paramValue)
{ {
QString gtkrcPath = QDir::homePath() + QStringLiteral("/.gtkrc-2.0"); QString gtkrcPath = qEnvironmentVariable("GTK2_RC_FILES", QDir::homePath() + QStringLiteral("/.gtkrc-2.0"));
if (gtkrcPath.contains(QStringLiteral(":/"))) { // I.e. env variable contains multiple paths
gtkrcPath = QDir::homePath() + QStringLiteral("/.gtkrc-2.0");
}
QFile gtkrc(gtkrcPath); QFile gtkrc(gtkrcPath);
QString gtkrcContents = readFileContents(gtkrc); QString gtkrcContents = readFileContents(gtkrc);
replaceValueInGtkrcContents(gtkrcContents, paramName, paramValue); replaceValueInGtkrcContents(gtkrcContents, paramName, paramValue);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment