https://bugs.kde.org/show_bug.cgi?id=415770

Fushan Wen <qydwhotm...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/kde-gtk-config/commit/af |ma/kde-gtk-config/commit/85
                   |1cc78d96fdbb2ad9adbb27a3742 |bfea563102e9a149c54ff420c78
                   |3201b9cc8c9                 |972387d73f7

--- Comment #10 from Fushan Wen <qydwhotm...@gmail.com> ---
Git commit 85bfea563102e9a149c54ff420c78972387d73f7 by Fushan Wen, on behalf of
Rocket Aaron.
Committed on 25/02/2023 at 14:49.
Pushed by fusionfuture into branch 'Plasma/5.27'.

Avoid creating gtkrc-2.0 if it does not exist

This MR would fix the following 2 bugs: Plasma does not follow `GTK2_RC_FILES`
environment variable and would create `~/.gtkrc-2.0` every time on login.

---

Here is the more detailed explanation:

`gmenu-dbusmenu-proxy` hardcoded `gtkrcPath` as `QDir::homePath() +
QLatin1String("/.gtkrc-2.0")`:

https://invent.kde.org/plasma/plasma-workspace/-/blob/v5.27.1/gmenu-dbusmenu-proxy/menuproxy.cpp#L163

but it's not creating the file if it's not present. `kde-gtk-config`'s
`Gtk2ConfigEditor::removeLegacyStrings()` is the cause:

https://invent.kde.org/plasma/kde-gtk-config/-/blob/v5.27.1/kded/config_editor/gtk2.cpp#L54

it uses `Utils::readFileContents(QFile &file)`

https://invent.kde.org/plasma/kde-gtk-config/-/blob/v5.27.1/kded/config_editor/utils.cpp#L19

which calls `file.open(QIODevice::ReadWrite | QIODevice::Text)`, and the mode
`ReadWrite` means to create the file if it's not exist:

https://doc.qt.io/qt-5/qfile.html#open

So at startup, `kde-gtk-config` launches and a empty `~/.gtkrc-2.0` file is
created, then `gmenu-dbusmenu-proxy` watchs the file creation

https://invent.kde.org/plasma/plasma-workspace/-/blob/v5.27.1/gmenu-dbusmenu-proxy/menuproxy.cpp#L106

and write the content to the file.

Furthermore, even if `~/.gtkrc-2.0` does not exist,
`Gtk2ConfigEditor::removeLegacyStrings()` would still write "modified" content
to the file

https://invent.kde.org/plasma/kde-gtk-config/-/blob/v5.27.1/kded/config_editor/gtk2.cpp#L76

but in that case, it would just create an empty file, for
`gmenu-dbusmenu-proxy` to watch and write something to it.
Related: bug 417534
FIXED-IN: 5.27.2


(cherry picked from commit af1cc78d96fdbb2ad9adbb27a37423201b9cc8c9)

M  +3    -0    kded/config_editor/gtk2.cpp
M  +1    -1    kded/config_editor/utils.cpp

https://invent.kde.org/plasma/kde-gtk-config/commit/85bfea563102e9a149c54ff420c78972387d73f7

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to