Commit 0580098a authored by Mikhail Zolotukhin's avatar Mikhail Zolotukhin

[GTK Config] Parameterise GTK config editing

Summary:
This diff is only touches the editing part of the ConfigEditor.

Changes:
1. Pass config values as the respecting types: `int`, `bool` and
   `string`. This simplifies config editing in some extent - no more
   hardcoded options names, that requires quotes around values in
   gtkrc-2.0 and xsettingsd.conf. Also it simplifies working with
   GSettings API and helps to transform KDE config options to GTK config
   options.
2. Remove redundant `\\n` symbols, when adding new option in
   gtkrc-2.0 and xsettingsd.conf

Test Plan:
1. Restart Kded
2. Test all settings syncing. Specifically boolean ones and enum ones, as the format in configuration files has changed:
- `Settings.ini` uses new booleans (`true` and `false` instead of `1` and `0`)
- `Settings.ini`, `.gtkrc-2.0` and `xsettingsd.conf` use `int` value of enum instead of `string`

Reviewers: #plasma, cblack

Reviewed By: #plasma, cblack

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27100
parent 20afd2a9
......@@ -19,6 +19,7 @@
*/
#include <QString>
#include <QVariant>
#include "configeditor.h"
......@@ -49,8 +50,8 @@ void upgradeGtk3Theme() {
|| currentGtk3Theme == QStringLiteral("BreezyGTK")
|| currentGtk3Theme == QStringLiteral("Orion")
) {
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("gtk-theme"), QStringLiteral("Breeze"));
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("gtk-theme"), QStringLiteral("Breeze"));
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-theme-name"), QStringLiteral("Breeze"));
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Net/ThemeName"), QStringLiteral("Breeze"));
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Net/ThemeName"), QStringLiteral("Breeze"));
}
}
......@@ -24,6 +24,7 @@ target_link_libraries(gtkconfig
KF5::ConfigCore
KF5::DBusAddons
KF5::IconThemes
PkgConfig::GTK+3
PkgConfig::GIO
PkgConfig::GObject
)
......
......@@ -23,6 +23,7 @@
#include <QRegularExpression>
#include <QStandardPaths>
#include <QProcess>
#include <QVariant>
#include <KSharedConfig>
#include <KConfigGroup>
......@@ -35,19 +36,26 @@
#include "configeditor.h"
void ConfigEditor::setGtk3ConfigValueDconf(const QString &paramName, bool paramValue, const QString &category)
void ConfigEditor::setGtk3ConfigValueGSettings(const QString &paramName, const QVariant &paramValue, const QString &category)
{
g_autoptr(GSettings) gsettings = g_settings_new(category.toUtf8().constData());
g_settings_set_boolean(gsettings, paramName.toUtf8().constData(), paramValue);
if (paramValue.type() == QVariant::Type::String) {
g_settings_set_string(gsettings, paramName.toUtf8().constData(), paramValue.toString().toUtf8().constData());
} else if (paramValue.type() == QVariant::Type::Int) {
g_settings_set_int(gsettings, paramName.toUtf8().constData(), paramValue.toInt());
} else if (paramValue.type() == QVariant::Type::Bool) {
g_settings_set_boolean(gsettings, paramName.toUtf8().constData(), paramValue.toBool());
}
}
void ConfigEditor::setGtk3ConfigValueDconf(const QString &paramName, const QString &paramValue, const QString &category)
void ConfigEditor::setGtk3ConfigValueGSettingsAsEnum(const QString& paramName, int paramValue, const QString& category)
{
g_autoptr(GSettings) gsettings = g_settings_new(category.toUtf8().constData());
g_settings_set_string(gsettings, paramName.toUtf8().constData(), paramValue.toUtf8().constData());
g_settings_set_enum(gsettings, paramName.toUtf8().constData(), paramValue);
}
void ConfigEditor::setGtk3ConfigValueSettingsIni(const QString &paramName, const QString &paramValue)
void ConfigEditor::setGtk3ConfigValueSettingsIni(const QString &paramName, const QVariant &paramValue)
{
QString configLocation = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QString gtk3ConfigPath = configLocation + QStringLiteral("/gtk-3.0/settings.ini");
......@@ -59,10 +67,9 @@ void ConfigEditor::setGtk3ConfigValueSettingsIni(const QString &paramName, const
group.sync();
}
void ConfigEditor::setGtk3ConfigValueXSettingsd(const QString &paramName, const QString &paramValue)
void ConfigEditor::setGtk3ConfigValueXSettingsd(const QString &paramName, const QVariant &paramValue)
{
using qsp = QStandardPaths;
QString configLocation = qsp::writableLocation(qsp::GenericConfigLocation);
QString configLocation = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QDir xsettingsdPath = configLocation + QStringLiteral("/xsettingsd");
if (!xsettingsdPath.exists()) {
......@@ -80,7 +87,7 @@ void ConfigEditor::setGtk3ConfigValueXSettingsd(const QString &paramName, const
reloadXSettingsd();
}
void ConfigEditor::setGtk2ConfigValue(const QString &paramName, const QString &paramValue)
void ConfigEditor::setGtk2ConfigValue(const QString &paramName, const QVariant &paramValue)
{
QString gtkrcPath = qEnvironmentVariable("GTK2_RC_FILES", QDir::homePath() + QStringLiteral("/.gtkrc-2.0"));
if (gtkrcPath.contains(QStringLiteral(":/"))) { // I.e. env variable contains multiple paths
......@@ -161,55 +168,45 @@ QString ConfigEditor::readFileContents(QFile &file)
}
}
void ConfigEditor::replaceValueInGtkrcContents(QString &gtkrcContents, const QString &paramName, const QString &paramValue)
void ConfigEditor::replaceValueInGtkrcContents(QString &gtkrcContents, const QString &paramName, const QVariant &paramValue)
{
const QRegularExpression regExp(paramName + QStringLiteral("=[^\n]*($|\n)"));
static const QStringList nonStringProperties{
QStringLiteral("gtk-toolbar-style"),
QStringLiteral("gtk-menu-images"),
QStringLiteral("gtk-button-images"),
QStringLiteral("gtk-primary-button-warps-slider"),
QStringLiteral("gtk-enable-animations"),
};
QString newConfigString;
if (nonStringProperties.contains(paramName)) {
newConfigString = paramName + QStringLiteral("=") + paramValue + QStringLiteral("\n");
if (paramValue.type() == QVariant::Type::String) {
newConfigString = QStringLiteral("%1=\"%2\"\n").arg(paramName, paramValue.toString());
} else if (paramValue.type() == QVariant::Type::Bool) {
// GTK2 does not support 'true' and 'false' as values
newConfigString = QStringLiteral("%1=%2\n").arg(paramName, QString::number(paramValue.toInt()));
} else {
newConfigString = paramName + QStringLiteral("=\"") + paramValue + QStringLiteral("\"\n");
newConfigString = QStringLiteral("%1=%2\n").arg(paramName, paramValue.toString());
}
if (gtkrcContents.contains(regExp)) {
gtkrcContents.replace(regExp, newConfigString);
} else {
gtkrcContents = newConfigString + QStringLiteral("\n") + gtkrcContents;
gtkrcContents = newConfigString + gtkrcContents;
}
}
void ConfigEditor::replaceValueInXSettingsdContents(QString &xSettingsdContents, const QString &paramName, const QString &paramValue)
void ConfigEditor::replaceValueInXSettingsdContents(QString &xSettingsdContents, const QString &paramName, const QVariant &paramValue)
{
const QRegularExpression regExp(paramName + QStringLiteral(" [^\n]*($|\n)"));
static const QStringList nonStringProperties{
QStringLiteral("Gtk/ButtonImages"),
QStringLiteral("Gtk/MenuImages"),
QStringLiteral("Gtk/ToolbarStyle"),
QStringLiteral("Gtk/PrimaryButtonWarpsSlider"),
QStringLiteral("Gtk/EnableAnimations"),
};
QString newConfigString;
if (nonStringProperties.contains(paramName)) {
newConfigString = paramName + QStringLiteral(" ") + paramValue + QStringLiteral("\n");
if (paramValue.type() == QVariant::Type::String) {
newConfigString = QStringLiteral("%1 \"%2\"\n").arg(paramName, paramValue.toString());
} else if (paramValue.type() == QVariant::Type::Bool) {
// XSettigsd does not support 'true' and 'false' as values
newConfigString = QStringLiteral("%1 %2\n").arg(paramName, QString::number(paramValue.toInt()));
} else {
newConfigString = paramName + QStringLiteral(" \"") + paramValue + QStringLiteral("\"\n");
newConfigString = QStringLiteral("%1 %2\n").arg(paramName, paramValue.toString());
}
if (xSettingsdContents.contains(regExp)) {
xSettingsdContents.replace(regExp, newConfigString);
} else {
xSettingsdContents = newConfigString + QStringLiteral("\n") + xSettingsdContents;
xSettingsdContents = newConfigString + xSettingsdContents;
}
}
......
......@@ -23,15 +23,16 @@
#include <QString>
class QFile;
class QString;
class QVariant;
namespace ConfigEditor
{
void setGtk2ConfigValue(const QString &paramName, const QString &paramValue);
void setGtk3ConfigValueDconf(const QString &paramName, bool paramValue, const QString &category = QStringLiteral("org.gnome.desktop.interface"));
void setGtk3ConfigValueDconf(const QString &paramName, const QString &paramValue, const QString &category = QStringLiteral("org.gnome.desktop.interface"));
void setGtk3ConfigValueSettingsIni(const QString &paramName, const QString &paramValue);
void setGtk3ConfigValueXSettingsd(const QString &paramName, const QString &paramValue);
void setGtk2ConfigValue(const QString &paramName, const QVariant &paramValue);
void setGtk3ConfigValueGSettings(const QString &paramName, const QVariant &paramValue, const QString &category = QStringLiteral("org.gnome.desktop.interface"));
void setGtk3ConfigValueGSettingsAsEnum(const QString &paramName, int paramValue, const QString &category = QStringLiteral("org.gnome.desktop.interface"));
void setGtk3ConfigValueSettingsIni(const QString &paramName, const QVariant &paramValue);
void setGtk3ConfigValueXSettingsd(const QString &paramName, const QVariant &paramValue);
QString gtk2ConfigValue(const QString& paramName);
QString gtk3ConfigValueSettingsIni(const QString& paramName);
......@@ -39,8 +40,8 @@ namespace ConfigEditor
void removeLegacyGtk2Strings();
void replaceValueInGtkrcContents(QString &gtkrcContents, const QString &paramName, const QString &paramValue);
void replaceValueInXSettingsdContents(QString &xSettingsdContents, const QString &paramName, const QString &paramValue);
void replaceValueInGtkrcContents(QString &gtkrcContents, const QString &paramName, const QVariant &paramValue);
void replaceValueInXSettingsdContents(QString &xSettingsdContents, const QString &paramName, const QVariant &paramValue);
QString readFileContents(QFile &gtkrc);
......
......@@ -27,6 +27,8 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <gtk/gtk.h>
#include "configvalueprovider.h"
ConfigValueProvider::ConfigValueProvider() :
......@@ -123,60 +125,49 @@ QString ConfigValueProvider::cursorThemeName() const
return configGroup.readEntry(QStringLiteral("cursorTheme"), QStringLiteral("breeze_cursors"));
}
QString ConfigValueProvider::iconsOnButtons() const
bool ConfigValueProvider::iconsOnButtons() const
{
KConfigGroup configGroup = kdeglobalsConfig->group(QStringLiteral("KDE"));
bool kdeConfigValue = configGroup.readEntry(QStringLiteral("ShowIconsOnPushButtons"), true);
if (kdeConfigValue) {
return QStringLiteral("1");
} else {
return QStringLiteral("0");
}
return configGroup.readEntry(QStringLiteral("ShowIconsOnPushButtons"), true);
}
QString ConfigValueProvider::iconsInMenus() const
bool ConfigValueProvider::iconsInMenus() const
{
KConfigGroup configGroup = kdeglobalsConfig->group(QStringLiteral("KDE"));
bool kdeConfigValue = configGroup.readEntry(QStringLiteral("ShowIconsInMenuItems"), true);
if (kdeConfigValue) {
return QStringLiteral("1");
} else {
return QStringLiteral("0");
}
return configGroup.readEntry(QStringLiteral("ShowIconsInMenuItems"), true);
}
QString ConfigValueProvider::toolbarStyle(ConfigValueProvider::ToolbarStyleNotation notation) const
int ConfigValueProvider::toolbarStyle() const
{
KConfigGroup configGroup = kdeglobalsConfig->group(QStringLiteral("Toolbar style"));
QString kdeConfigValue = configGroup.readEntry(QStringLiteral("ToolButtonStyle"), "TextBesideIcon");
return toolbarStyleInDesiredNotation(kdeConfigValue, notation);
if (kdeConfigValue == QStringLiteral("NoText")) {
return GtkToolbarStyle::GTK_TOOLBAR_ICONS;
} else if (kdeConfigValue == QStringLiteral("TextOnly")) {
return GtkToolbarStyle::GTK_TOOLBAR_TEXT;
} else if (kdeConfigValue == QStringLiteral("TextBesideIcon")) {
return GtkToolbarStyle::GTK_TOOLBAR_BOTH_HORIZ;
} else {
return GtkToolbarStyle::GTK_TOOLBAR_BOTH;
}
}
QString ConfigValueProvider::scrollbarBehavior() const
bool ConfigValueProvider::scrollbarBehavior() const
{
KConfigGroup configGroup = kdeglobalsConfig->group(QStringLiteral("KDE"));
bool kdeConfigValue = configGroup.readEntry(QStringLiteral("ScrollbarLeftClickNavigatesByPage"), true);
if (kdeConfigValue) { // GTK setting is inverted
return QStringLiteral("0");
} else {
return QStringLiteral("1");
}
return !kdeConfigValue; // GTK setting is inverted
}
QString ConfigValueProvider::preferDarkTheme() const
bool ConfigValueProvider::preferDarkTheme() const
{
KConfigGroup colorsConfigGroup = kdeglobalsConfig->group(QStringLiteral("Colors:Window"));
QColor windowBackgroundColor = colorsConfigGroup.readEntry(QStringLiteral("BackgroundNormal"), QColor(239, 240, 241));
const int windowBackgroundGray = qGray(windowBackgroundColor.rgb());
// We use heuristic to determine if current color scheme is dark or not
if (windowBackgroundGray >= 192) {
return QStringLiteral("0");
} else {
return QStringLiteral("1");
}
return windowBackgroundGray < 192;
}
QString ConfigValueProvider::windowDecorationsButtonsOrder() const
......@@ -191,55 +182,12 @@ QString ConfigValueProvider::windowDecorationsButtonsOrder() const
return buttonsOnLeftInGtkNotation + QStringLiteral(":") + buttonsOnRightInGtkNotation;
}
QString ConfigValueProvider::enableAnimations() const
bool ConfigValueProvider::enableAnimations() const
{
KConfigGroup generalCfg = kdeglobalsConfig->group(QStringLiteral("KDE"));
const qreal animationSpeedModifier = qMax(0.0, generalCfg.readEntry("AnimationDurationFactor", 1.0));
const bool enableAnimations = !qFuzzyIsNull(animationSpeedModifier);
if (enableAnimations) {
return QStringLiteral("1");
} else {
return QStringLiteral("0");
}
}
QString ConfigValueProvider::toolbarStyleInDesiredNotation(const QString &kdeConfigValue, ConfigValueProvider::ToolbarStyleNotation notation) const
{
QStringList toolbarStyles {};
if (notation == ToolbarStyleNotation::SettingsIni) {
toolbarStyles.append({
QStringLiteral("GTK_TOOLBAR_ICONS"),
QStringLiteral("GTK_TOOLBAR_TEXT"),
QStringLiteral("GTK_TOOLBAR_BOTH_HORIZ"),
QStringLiteral("GTK_TOOLBAR_BOTH")
});
} else if (notation == ToolbarStyleNotation::Xsettingsd) {
toolbarStyles.append({
QStringLiteral("0"),
QStringLiteral("1"),
QStringLiteral("3"),
QStringLiteral("2")
});
} else {
toolbarStyles.append({
QStringLiteral("icons"),
QStringLiteral("text"),
QStringLiteral("both-horiz"),
QStringLiteral("both")
});
}
if (kdeConfigValue == QStringLiteral("NoText")) {
return toolbarStyles[0];
} else if (kdeConfigValue == QStringLiteral("TextOnly")) {
return toolbarStyles[1];
} else if (kdeConfigValue == QStringLiteral("TextBesideIcon")) {
return toolbarStyles[2];
} else {
return toolbarStyles[3];
}
return !qFuzzyIsNull(animationSpeedModifier);
}
QString ConfigValueProvider::windowDecorationButtonsOrderInGtkNotation(const QString &kdeConfigValue) const
......
......@@ -28,28 +28,21 @@ class QFont;
class ConfigValueProvider
{
public:
enum class ToolbarStyleNotation {
Xsettingsd = 0,
SettingsIni,
Dconf
};
ConfigValueProvider();
QString fontName() const;
QString iconThemeName() const;
QString cursorThemeName() const;
QString iconsOnButtons() const;
QString iconsInMenus() const;
QString toolbarStyle(ToolbarStyleNotation notation) const;
QString scrollbarBehavior() const;
QString preferDarkTheme() const;
bool iconsOnButtons() const;
bool iconsInMenus() const;
int toolbarStyle() const;
bool scrollbarBehavior() const;
bool preferDarkTheme() const;
QString windowDecorationsButtonsOrder() const;
QString enableAnimations() const;
bool enableAnimations() const;
private:
QString fontStyleHelper(const QFont &font) const;
QString toolbarStyleInDesiredNotation(const QString &kdeConfigValue, ToolbarStyleNotation notation) const;
QString windowDecorationButtonsOrderInGtkNotation(const QString &kdeConfigValue) const;
KSharedConfigPtr kdeglobalsConfig;
......
......@@ -68,7 +68,7 @@ void GtkConfig::setGtk2Theme(const QString &themeName) const
void GtkConfig::setGtk3Theme(const QString &themeName) const
{
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("gtk-theme"), themeName);
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("gtk-theme"), themeName);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-theme-name"), themeName);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Net/ThemeName"), themeName);
}
......@@ -97,7 +97,7 @@ void GtkConfig::setFont() const
{
const QString configFontName = configValueProvider->fontName();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-font-name"), configFontName);
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("font-name"), configFontName);
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("font-name"), configFontName);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-font-name"), configFontName);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/FontName"), configFontName);
}
......@@ -106,7 +106,7 @@ void GtkConfig::setIconTheme() const
{
const QString iconThemeName = configValueProvider->iconThemeName();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-icon-theme-name"), iconThemeName);
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("icon-theme"), iconThemeName);
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("icon-theme"), iconThemeName);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-icon-theme-name"), iconThemeName);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Net/IconThemeName"), iconThemeName);
}
......@@ -115,14 +115,14 @@ void GtkConfig::setCursorTheme() const
{
const QString cursorThemeName = configValueProvider->cursorThemeName();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-cursor-theme-name"), cursorThemeName);
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("cursor-theme"), cursorThemeName);
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("cursor-theme"), cursorThemeName);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-cursor-theme-name"), cursorThemeName);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/CursorThemeName"), cursorThemeName);
}
void GtkConfig::setIconsOnButtons() const
{
const QString iconsOnButtonsConfigValue = configValueProvider->iconsOnButtons();
const bool iconsOnButtonsConfigValue = configValueProvider->iconsOnButtons();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-button-images"), iconsOnButtonsConfigValue);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-button-images"), iconsOnButtonsConfigValue);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/ButtonImages"), iconsOnButtonsConfigValue);
......@@ -130,7 +130,7 @@ void GtkConfig::setIconsOnButtons() const
void GtkConfig::setIconsInMenus() const
{
const QString iconsInMenusConfigValue = configValueProvider->iconsInMenus();
const bool iconsInMenusConfigValue = configValueProvider->iconsInMenus();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-menu-images"), iconsInMenusConfigValue);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-menu-images"), iconsInMenusConfigValue);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/MenuImages"), iconsInMenusConfigValue);
......@@ -138,21 +138,16 @@ void GtkConfig::setIconsInMenus() const
void GtkConfig::setToolbarStyle() const
{
using ToolbarStyleNotation = ConfigValueProvider::ToolbarStyleNotation;
QString toolbarStyleSettingsIni = configValueProvider->toolbarStyle(ToolbarStyleNotation::SettingsIni);
QString toolbarStyleDConf = configValueProvider->toolbarStyle(ToolbarStyleNotation::Dconf);
QString toolbarStyleXSettingsd = configValueProvider->toolbarStyle(ToolbarStyleNotation::Xsettingsd);
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-toolbar-style"), toolbarStyleSettingsIni);
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("toolbar-style"), toolbarStyleDConf);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-toolbar-style"), toolbarStyleSettingsIni);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/ToolbarStyle"), toolbarStyleXSettingsd);
const int toolbarStyle = configValueProvider->toolbarStyle();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-toolbar-style"), toolbarStyle);
ConfigEditor::setGtk3ConfigValueGSettingsAsEnum(QStringLiteral("toolbar-style"), toolbarStyle);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-toolbar-style"), toolbarStyle);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/ToolbarStyle"), toolbarStyle);
}
void GtkConfig::setScrollbarBehavior() const
{
const QString scrollbarBehavior = configValueProvider->scrollbarBehavior();
const bool scrollbarBehavior = configValueProvider->scrollbarBehavior();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-primary-button-warps-slider"), scrollbarBehavior);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-primary-button-warps-slider"), scrollbarBehavior);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/PrimaryButtonWarpsSlider"), scrollbarBehavior);
......@@ -160,24 +155,23 @@ void GtkConfig::setScrollbarBehavior() const
void GtkConfig::setDarkThemePreference() const
{
const QString preferDarkTheme = configValueProvider->preferDarkTheme();
const bool preferDarkTheme = configValueProvider->preferDarkTheme();
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-application-prefer-dark-theme"), preferDarkTheme);
}
void GtkConfig::setWindowDecorationsButtonsOrder() const
{
const QString windowDecorationsButtonOrder = configValueProvider->windowDecorationsButtonsOrder();
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("button-layout"), windowDecorationsButtonOrder, QStringLiteral("org.gnome.desktop.wm.preferences"));
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("button-layout"), windowDecorationsButtonOrder, QStringLiteral("org.gnome.desktop.wm.preferences"));
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-decoration-layout"), windowDecorationsButtonOrder);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/DecorationLayout"), windowDecorationsButtonOrder);
}
void GtkConfig::setEnableAnimations() const
{
const QString enableAnimations = configValueProvider->enableAnimations();
const bool enableAnimations = configValueProvider->enableAnimations();
ConfigEditor::setGtk2ConfigValue(QStringLiteral("gtk-enable-animations"), enableAnimations);
// FIXME work with booleans in configValueProvider...
ConfigEditor::setGtk3ConfigValueDconf(QStringLiteral("enable-animations"), enableAnimations == QLatin1String("1"));
ConfigEditor::setGtk3ConfigValueGSettings(QStringLiteral("enable-animations"), enableAnimations);
ConfigEditor::setGtk3ConfigValueSettingsIni(QStringLiteral("gtk-enable-animations"), enableAnimations);
ConfigEditor::setGtk3ConfigValueXSettingsd(QStringLiteral("Gtk/EnableAnimations"), enableAnimations);
}
......
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