-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.js
52 lines (47 loc) · 1.65 KB
/
conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (c) 2020 Justus Croskery
* To contact me, email me at [email protected].
*
* ServerCheck is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* ServerCheck is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with ServerCheck; if not, see <https://www.gnu.org/licenses/>.
*
*/
"use strict";
const Me = imports.misc.extensionUtils.getCurrentExtension();
const { Gio, GLib } = imports.gi;
var Conf = class {
constructor() {
this.settings = Conf.getSettings();
}
static getSettings() {
let schemaName = 'org.gnome.shell.extensions.ServerCheck';
let schemaDir = Me.dir.get_child('schemas').get_path();
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir,
Gio.SettingsSchemaSource.get_default(),
false);
let schema = schemaSource.lookup(schemaName, false);
return new Gio.Settings({ settings_schema: schema });
}
getTimer() {
return this.settings.get_int('timer');
}
getServer() {
return this.settings.get_string('server');
}
setTimer(timer) {
this.settings.set_int('timer', timer);
}
setServer(server) {
this.settings.set_string('server', server);
}
}