ui: Theme lookup should respect XDG_DATA_DIRS

Modes, extensions and other GNOME Shell assets are searched in appropriate
subdirectories of each directory in XDG_DATA_DIRS, falling back
to global.datadir.
However, this isn't the case for themes, which are currently always expected
in global.datadir, even when referenced by a mode in a different XDG_DATA_DIR.

The fix is to have the theme finding pattern follow the same logic as other
elements.
Fixes #167.


(cherry picked from commit d6d09fd3c8)
This commit is contained in:
Didier Roche 2018-03-30 09:44:14 +02:00 committed by Marco Trevisan
parent 4b2e0247af
commit da96408098

View File

@ -256,6 +256,14 @@ function _getStylesheet(name) {
if (stylesheet.query_exists(null)) if (stylesheet.query_exists(null))
return stylesheet; return stylesheet;
let dataDirs = GLib.get_system_data_dirs();
for (let i = 0; i < dataDirs.length; i++) {
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]);
let stylesheet = Gio.file_new_for_path(path);
if (stylesheet.query_exists(null))
return stylesheet;
}
stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name); stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
if (stylesheet.query_exists(null)) if (stylesheet.query_exists(null))
return stylesheet; return stylesheet;