-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefs.ts
88 lines (83 loc) · 2.53 KB
/
prefs.ts
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk';
import Adw from 'gi://Adw';
import {
ExtensionPreferences,
gettext as _
} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
const MAX_UNIX_PORT = 65535;
export default class MumblePingPreferences extends ExtensionPreferences {
private _settings: Gio.Settings = this.getSettings();
fillPreferencesWindow(window: Adw.PreferencesWindow) {
const page = new Adw.PreferencesPage();
const generalSettings = new Adw.PreferencesGroup({
title: _('General Settings'),
});
const connectionSettings = new Adw.PreferencesGroup({
title: _('Connection'),
});
const refreshTimeoutRow = new Adw.SpinRow({
title: _('Poll Server Every (sec)'),
adjustment: new Gtk.Adjustment({
value: 120,
lower: 1,
upper: 3600,
stepIncrement: 1,
pageIncrement: 1,
pageSize: 10,
}),
climbRate: 2,
digits: 0,
});
const hostnameRow = new Adw.EntryRow({
title: _('Mumble Server'),
});
const portRow = new Adw.SpinRow({
title: _('Mumble Port'),
adjustment: new Gtk.Adjustment({
value: 64738,
lower: 1,
upper: MAX_UNIX_PORT,
stepIncrement: 1,
pageIncrement: 1,
pageSize: 10,
}),
climbRate: 1,
digits: 0,
});
const debugRow = new Adw.SwitchRow({
title: _('Debug Mode'),
});
generalSettings.add(refreshTimeoutRow);
generalSettings.add(debugRow);
connectionSettings.add(hostnameRow);
connectionSettings.add(portRow);
page.add(generalSettings);
page.add(connectionSettings);
window.add(page);
this._settings.bind(
'refresh-timeout',
refreshTimeoutRow,
'value',
Gio.SettingsBindFlags.DEFAULT
);
this._settings.bind(
'mumble-host',
hostnameRow,
'text',
Gio.SettingsBindFlags.DEFAULT
);
this._settings.bind(
'mumble-port',
portRow,
'value',
Gio.SettingsBindFlags.DEFAULT
);
this._settings.bind(
'debug',
debugRow,
'active',
Gio.SettingsBindFlags.DEFAULT
);
}
}