Bug 342320

Summary: All user entries on .config/gtk-3.0/settings.ini always removed after changing GTK configuration in KDE settings
Product: [Plasma] kde-gtk-config Reporter: Andrey Loskutov <loskutov>
Component: generalAssignee: Manuel Tortosa <manutortosa>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.17.0

Description Andrey Loskutov 2014-12-29 22:42:34 UTC
Edit file ~/.config/gtk-3.0/settings.ini
Add two settings:

gtk-alternative-button-order=1
gtk-application-prefer-dark-theme=false

Go to System Settings->Application Appearance->GTK.
Change the theme here.

Reproducible: Always


Actual Results:  
Any content from file is entirely removed and replaced by new settings, event if they have no common keys.

Expected Results:  
The user defined key/value pairs which do not conflict with settings written by KDE/GTK settings wizard should be kept.
Comment 1 Aleix Pol 2014-12-30 14:51:44 UTC
Confirming, this can happen indeed. I'll look into this.
Comment 2 Aleix Pol 2014-12-30 15:11:14 UTC
Git commit 8c9d8e9ad2b530a60ecf73aa340f727197319921 by Aleix Pol.
Committed on 30/12/2014 at 14:59.
Pushed by apol into branch 'master'.

Add a warning if the field wasn't found

M  +24   -7    src/appearancegtk2.cpp
M  +24   -8    src/appearancegtk3.cpp

http://commits.kde.org/kde-gtk-config/8c9d8e9ad2b530a60ecf73aa340f727197319921
Comment 3 Nate Graham 2019-08-24 13:06:54 UTC
Git commit a9f3a3ddcb0b197f96b750323201da438f15c4ad by Nate Graham, on behalf of Mikhail Zolotukhin.
Committed on 24/08/2019 at 13:06.
Pushed by ngraham into branch 'master'.

Keep existing configurations' strings               

Summary:
Gtk configurator has been replacing .gtkrc-2.0 config file with it's own settings, discarding present file contents. Now it only modifies configuration strings, or add them if they are not present at the beginning of the file.

This patch also removes redundant configurations, such as including theme from /usr/share/themes gtkrc's, "user-font" style, widget_class and unneeded symlink .gtkrc-2.0-kde4. Those options do not seem needed, as gtk2 applications look the same without these options without any regressions. This was tested on Gimp, Inkscape and BleachBit apps on Manjaro, OpenSUSE and KDE Neon distributions.

As for gtk3 ini file - this is not reproducible anymore, any line, which does not hold parameter changeable in configurator, remains in settings.ini.
Related: bug 322797, bug 354963
FIXED-IN: 5.17.0

Test Plan:
Insert some lines in .gtkrc-2.0 file, that do not represent settings, that configurator changes, check if they are still present after applying new settings.

Check if gtk2 apps look identical with or without .gtkrc-2.0-kde4 symlink, with or without similar lines in .gtrkrc-2.0:

```
include "/usr/share/themes/Breeze/gtk-2.0/gtkrc"
style "user-font"
{
	font_name="Noto Sans Regular"
}
widget_class "*" style "user-font"

```

Reviewers: apol, #plasma

Reviewed By: apol

Subscribers: GB_2, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D21524

M  +52   -51   src/appearancegtk2.cpp
M  +2    -0    src/appearancegtk2.h

https://commits.kde.org/kde-gtk-config/a9f3a3ddcb0b197f96b750323201da438f15c4ad