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. BUG: 415770 BUG: 417534 FIXED-IN: 5.27.2
Loading
-
mentioned in commit 85bfea56
-
mentioned in merge request !62 (merged)
Please register or sign in to comment