Common code for retrieving translations and GSettings schemas has been factored out into lib/convenience.js, which is part of every extension installation. Since that code relies on renames done at zip file creation time, extensions can no longer be installed with "make install". Instead, one should create the zip file and install it with the tweak-tool. There is also a bash script, local-install.sh, that will install everything in zip-files. Also, since the GSettingsSchemaSource code is not yet in a stable GLib release, extensions using GSettings have seen their stable shell version removed.
18 lines
654 B
JavaScript
18 lines
654 B
JavaScript
const Gettext = imports.gettext;
|
|
const Gio = imports.gi.Gio;
|
|
|
|
function initTranslations(metadata) {
|
|
let localeDir = metadata.dir.get_child('locale').get_path();
|
|
Gettext.bindtextdomain('gnome-shell-extensions', localeDir);
|
|
}
|
|
|
|
function getSettings(metadata, extension_id) {
|
|
let schemaDir = metadata.dir.get_child('schemas').get_path();
|
|
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir,
|
|
Gio.SettingsSchemaSource.get_default(),
|
|
false);
|
|
let schema = schemaSource.lookup('org.gnome.shell.extensions.' + extension_id, false);
|
|
return new Gio.Settings({ settings_schema: schema });
|
|
}
|
|
|