kde-gtk-config: Set path for GSettings schemas

Fixes: #38919

The KCModule is patched to set the appropriate environment variables in
the parent process when it is initialized.
This commit is contained in:
Thomas Tuegel 2018-05-12 20:23:09 -05:00
parent 6db7f92cc2
commit 1c3492f358
No known key found for this signature in database
GPG key ID: 22CBF5249D4B4D59
4 changed files with 53 additions and 29 deletions

View file

@ -1,21 +1,25 @@
{ {
mkDerivation, mkDerivation,
extra-cmake-modules, extra-cmake-modules, wrapGAppsHook,
glib, gtk2, gtk3, karchive, kcmutils, kconfigwidgets, ki18n, kiconthemes, kio, glib, gtk2, gtk3, karchive, kcmutils, kconfigwidgets, ki18n, kiconthemes, kio,
knewstuff, gsettings-desktop-schemas knewstuff, gsettings-desktop-schemas
}: }:
mkDerivation { mkDerivation {
name = "kde-gtk-config"; name = "kde-gtk-config";
nativeBuildInputs = [ extra-cmake-modules ]; nativeBuildInputs = [ extra-cmake-modules wrapGAppsHook ];
dontWrapGApps = true; # There is nothing to wrap
buildInputs = [ buildInputs = [
ki18n kio glib gtk2 gtk3 karchive kcmutils kconfigwidgets kiconthemes ki18n kio glib gtk2 gtk3 karchive kcmutils kconfigwidgets kiconthemes
knewstuff gsettings-desktop-schemas knewstuff gsettings-desktop-schemas
]; ];
patches = [ ./0001-follow-symlinks.patch ]; patches = [ ./patches/follow-symlinks.patch ./patches/gsettings.patch ];
cmakeFlags = [ cmakeFlags = [
"-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include" "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
"-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include" "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
"-DGLIB_SCHEMAS_DIR=${gsettings-desktop-schemas.out}/" "-DGLIB_SCHEMAS_DIR=${gsettings-desktop-schemas.out}/"
]; ];
preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DGSETTINGS_SCHEMAS_PATH=\"$GSETTINGS_SCHEMAS_PATH\""
'';
} }

View file

@ -8,11 +8,11 @@ Subject: [PATCH] follow symlinks
src/iconthemesmodel.cpp | 2 +- src/iconthemesmodel.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-) 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/appearancegtk2.cpp b/src/appearancegtk2.cpp Index: kde-gtk-config-5.12.4/src/appearancegtk2.cpp
index b1e0b52..095cddc 100644 ===================================================================
--- a/src/appearancegtk2.cpp --- kde-gtk-config-5.12.4.orig/src/appearancegtk2.cpp
+++ b/src/appearancegtk2.cpp +++ kde-gtk-config-5.12.4/src/appearancegtk2.cpp
@@ -73,7 +73,7 @@ QString AppearanceGTK2::themesGtkrcFile(const QString& themeName) const @@ -69,7 +69,7 @@ QString AppearanceGTK2::themesGtkrcFile(
QStringList themes=installedThemes(); QStringList themes=installedThemes();
themes=themes.filter(QRegExp("/"+themeName+"/?$")); themes=themes.filter(QRegExp("/"+themeName+"/?$"));
if(themes.size()==1) { if(themes.size()==1) {
@ -21,27 +21,24 @@ index b1e0b52..095cddc 100644
while(it.hasNext()) { while(it.hasNext()) {
it.next(); it.next();
if(it.fileName()=="gtkrc") { if(it.fileName()=="gtkrc") {
diff --git a/src/iconthemesmodel.cpp b/src/iconthemesmodel.cpp Index: kde-gtk-config-5.12.4/src/iconthemesmodel.cpp
index 07c7ad7..b04d978 100644 ===================================================================
--- a/src/iconthemesmodel.cpp --- kde-gtk-config-5.12.4.orig/src/iconthemesmodel.cpp
+++ b/src/iconthemesmodel.cpp +++ kde-gtk-config-5.12.4/src/iconthemesmodel.cpp
@@ -46,7 +46,7 @@ QList<QDir> IconThemesModel::installedThemesPaths() @@ -47,7 +47,7 @@ QList<QDir> IconThemesModel::installedTh
foreach(const QString& dir, dirs) { foreach(const QString& dir, dirs) {
QDir userIconsDir(dir); QDir userIconsDir(dir);
- QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs|QDir::NoSymLinks); - QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs|QDir::NoSymLinks);
+ QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs); + QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs);
while(it.hasNext()) { while(it.hasNext()) {
QString currentPath = it.next(); QString currentPath = it.next();
QDir dir(currentPath); QDir dir(currentPath);
-- Index: kde-gtk-config-5.12.4/src/cursorthemesmodel.cpp
2.6.2 ===================================================================
--- kde-gtk-config-5.12.4.orig/src/cursorthemesmodel.cpp
diff --git a/src/cursorthemesmodel.cpp b/src/cursorthemesmodel.cpp +++ kde-gtk-config-5.12.4/src/cursorthemesmodel.cpp
index 926a666..85b10f8 100644 @@ -47,7 +47,7 @@ QList<QDir> CursorThemesModel::installed
--- a/src/cursorthemesmodel.cpp
+++ b/src/cursorthemesmodel.cpp
@@ -47,7 +47,7 @@ QList<QDir> CursorThemesModel::installedThemesPaths()
foreach(const QString& dir, dirs) { foreach(const QString& dir, dirs) {
QDir userIconsDir(dir); QDir userIconsDir(dir);

View file

@ -0,0 +1,21 @@
Index: kde-gtk-config-5.12.4/src/gtkconfigkcmodule.cpp
===================================================================
--- kde-gtk-config-5.12.4.orig/src/gtkconfigkcmodule.cpp
+++ kde-gtk-config-5.12.4/src/gtkconfigkcmodule.cpp
@@ -78,6 +78,16 @@ GTKConfigKCModule::GTKConfigKCModule(QWi
m_iconsModel = new IconThemesModel(false, this);
ui->cb_icon->setModel(m_iconsModel);
ui->cb_icon_fallback->setModel(m_iconsModel);
+
+ // Add GSETTINGS_SCHEMAS_PATH to the front of XDG_DATA_DIRS.
+ // Normally this would be done by wrapGAppsHook, but this plugin
+ // (shared object) cannot be wrapped.
+ QByteArray xdgdata = qgetenv("XDG_DATA_DIRS");
+ if (!xdgdata.isEmpty()) {
+ xdgdata.push_front(":");
+ }
+ xdgdata.push_front(QByteArray(GSETTINGS_SCHEMAS_PATH));
+ qputenv("XDG_DATA_DIRS", xdgdata);
m_tempGtk2Preview = QStandardPaths::writableLocation(QStandardPaths::TempLocation)+ "/gtkrc-2.0";
m_tempGtk3Preview = QStandardPaths::writableLocation(QStandardPaths::TempLocation)+ "/.config/gtk-3.0/settings.ini";

View file

@ -0,0 +1,2 @@
follow-symlinks.patch
gsettings.patch