diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:19:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:19:51 +0000 |
commit | df7baa2644d541634825e28851c2bd8a47cd5233 (patch) | |
tree | 097c499ac161feb4345b18a4f6605e7199d6a635 /impatience/prefs.js | |
parent | Initial commit. (diff) | |
download | gnome-shell-extension-impatience-df7baa2644d541634825e28851c2bd8a47cd5233.tar.xz gnome-shell-extension-impatience-df7baa2644d541634825e28851c2bd8a47cd5233.zip |
Adding upstream version 0.4.8.upstream/0.4.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | impatience/prefs.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/impatience/prefs.js b/impatience/prefs.js new file mode 100644 index 0000000..286599e --- /dev/null +++ b/impatience/prefs.js @@ -0,0 +1,62 @@ +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, + 'margin-top': 20, + 'margin-bottom': 20, + 'margin-start': 20, + 'margin-end': 20 + }); + + (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.Scale({ + orientation: Gtk.Orientation.HORIZONTAL, + digits:2, + adjustment: adjustment, + hexpand: true, + value_pos: Gtk.PositionType.RIGHT + }); + + hbox.append(label); + hbox.append(scale); + frame.append(hbox); + + var pref = config.SPEED; + scale.set_value(pref.get()); + [0.25, 0.5, 1.0, 2.0].forEach( + mark => scale.add_mark(mark, Gtk.PositionType.TOP, "<small>" + mark + "</small>") + ); + scale.connect('value-changed', function(sw) { + var oldval = pref.get(); + var newval = sw.get_value(); + if (newval != pref.get()) { + pref.set(newval); + } + }); + })(); + + frame.show(); + return frame; +} |