blob: d394a8f66e00d8dcd5d582f382fa8c7cc087e027 (
plain)
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
|
const Gtk = imports.gi.Gtk;
let Extension = imports.misc.extensionUtils.getCurrentExtension();
let Settings = Extension.imports.settings;
function init() {
}
function buildPrefsWidget() {
let config = new Settings.Prefs();
let frame = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL,
border_width: 10
});
(function() {
let hbox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
spacing: 20
});
let label = new Gtk.Label({
label: "Speed scaling\n<small>(1 = normal, 0.5 = twice as fast)</small>",
use_markup: true,
});
let adjustment = new Gtk.Adjustment({
lower: 0,
upper: 2,
step_increment: 0.05
});
let scale = new Gtk.HScale({
digits:2,
adjustment: adjustment,
value_pos: Gtk.PositionType.RIGHT
});
hbox.add(label);
hbox.pack_end(scale, true, true, 0);
frame.add(hbox);
var pref = config.SPEED;
scale.set_value(pref.get());
scale.connect('value-changed', function(sw) {
var oldval = pref.get();
var newval = sw.get_value();
if (newval != pref.get()) {
pref.set(newval);
}
});
})();
frame.show_all();
return frame;
}
|