Skip to content

Commit

Permalink
Remove _settings from global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Noobsai committed Aug 4, 2021
1 parent ea5d695 commit d098a0f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ const _ = Gettext.gettext;

const ExtensionUtils = imports.misc.extensionUtils;

let _settings;

function init() {
ExtensionUtils.initTranslations();
}

function buildPrefsWidget() {
_settings = ExtensionUtils.getSettings();
let settings = ExtensionUtils.getSettings();
let box = new Gtk.Box({
halign: Gtk.Align.CENTER,
orientation: Gtk.Orientation.VERTICAL,
Expand All @@ -26,19 +24,19 @@ function buildPrefsWidget() {
spacing: 16
});

box.append(buildSwitcher('move-hot-corners', _('Move Hot Corners:')));
box.append(buildSwitcher(settings, 'move-hot-corners', _('Move Hot Corners:')));

return box;
}

function buildSwitcher(key, labeltext) {
function buildSwitcher(settings, key, labeltext) {
let hbox = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL, spacing: 10 });

let label = new Gtk.Label({label: labeltext });

let switcher = new Gtk.Switch();

_settings.bind(key, switcher, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind(key, switcher, 'active', Gio.SettingsBindFlags.DEFAULT);

hbox.append(label);
hbox.append(switcher);
Expand Down

0 comments on commit d098a0f

Please sign in to comment.