forked from pop-os/cosmic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.js
21 lines (16 loc) · 761 Bytes
/
settings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { Gio } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
const extension = ExtensionUtils.getCurrentExtension();
function settings_new_schema(schema) {
const GioSSS = Gio.SettingsSchemaSource;
const schemaDir = extension.dir.get_child("schemas");
let schemaSource = schemaDir.query_exists(null) ?
GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false) :
GioSSS.get_default();
const schemaObj = schemaSource.lookup(schema, true);
if (!schemaObj) {
throw new Error("Schema " + schema + " could not be found for extension "
+ extension.metadata.uuid + ". Please check your installation.")
}
return new Gio.Settings({ settings_schema: schemaObj });
}