glib: Add helpers for finding schema datadir

It is commonly needed for test environments.
This commit is contained in:
Jan Tojnar 2022-01-02 20:34:53 +01:00
parent a10675f43d
commit 7e95149bdb
4 changed files with 8 additions and 4 deletions

View file

@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
# Add “org.gnome.crypto.pgp” GSettings schema to path # Add “org.gnome.crypto.pgp” GSettings schema to path
# to make it available for “gpgme-backend” test. # to make it available for “gpgme-backend” test.
# It is used by Seahorses internal “common” library. # It is used by Seahorses internal “common” library.
addToSearchPath XDG_DATA_DIRS "${glib.getSchemaPath gcr}/../.." addToSearchPath XDG_DATA_DIRS "${glib.getSchemaDataDirPath gcr}"
# The same test also requires home directory so that it can store settings. # The same test also requires home directory so that it can store settings.
export HOME=$TMPDIR export HOME=$TMPDIR
''; '';

View file

@ -191,8 +191,12 @@ stdenv.mkDerivation rec {
passthru = rec { passthru = rec {
gioModuleDir = "lib/gio/modules"; gioModuleDir = "lib/gio/modules";
makeSchemaPath = dir: name: "${dir}/share/gsettings-schemas/${name}/glib-2.0/schemas";
makeSchemaDataDirPath = dir: name: "${dir}/share/gsettings-schemas/${name}";
makeSchemaPath = dir: name: "${makeSchemaDataDirPath dir name}/glib-2.0/schemas";
getSchemaPath = pkg: makeSchemaPath pkg pkg.name; getSchemaPath = pkg: makeSchemaPath pkg pkg.name;
getSchemaDataDirPath = pkg: makeSchemaDataDirPath pkg pkg.name;
inherit flattenInclude; inherit flattenInclude;
updateScript = gnome.updateScript { packageName = "glib"; }; updateScript = gnome.updateScript { packageName = "glib"; };
}; };

View file

@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
# AdwSettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme. # AdwSettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
# It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name. # It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
# See adw_settings_constructed function in https://gitlab.gnome.org/GNOME/libadwaita/commit/60ec69f0a5d49cad8a6d79e4ecefd06dc6e3db12 # See adw_settings_constructed function in https://gitlab.gnome.org/GNOME/libadwaita/commit/60ec69f0a5d49cad8a6d79e4ecefd06dc6e3db12
"XDG_DATA_DIRS=${glib.getSchemaPath gsettings-desktop-schemas}/../.." "XDG_DATA_DIRS=${glib.getSchemaDataDirPath gsettings-desktop-schemas}"
# Tests need a cache directory # Tests need a cache directory
"HOME=$TMPDIR" "HOME=$TMPDIR"

View file

@ -94,7 +94,7 @@ stdenv.mkDerivation rec {
# HdySettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme. # HdySettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
# It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name. # It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
# See hdy_settings_constructed function in https://gitlab.gnome.org/GNOME/libhandy/-/commit/bb68249b005c445947bfb2bee66c91d0fe9c41a4 # See hdy_settings_constructed function in https://gitlab.gnome.org/GNOME/libhandy/-/commit/bb68249b005c445947bfb2bee66c91d0fe9c41a4
"${glib.getSchemaPath gsettings-desktop-schemas}/../.." (glib.getSchemaDataDirPath gsettings-desktop-schemas)
# Some tests require icons # Some tests require icons
"${hicolor-icon-theme}/share" "${hicolor-icon-theme}/share"