Set state on panel open

This commit is contained in:
Balazs Gyurak
2020-01-05 22:32:51 +00:00
parent 40cf21160d
commit fee3ed9c0c

View File

@@ -94,6 +94,7 @@ function buildPrefsWidget() {
layout.attach(maximizeInput, 1, row++, 1, 1); layout.attach(maximizeInput, 1, row++, 1, 1);
// Preview settings // Preview settings
let previewEnabled = this.settings.get_boolean ('preview');
let previewLabel = new Gtk.Label({ let previewLabel = new Gtk.Label({
label: _("Enable preview while dragging windows"), label: _("Enable preview while dragging windows"),
visible: true, visible: true,
@@ -101,7 +102,7 @@ function buildPrefsWidget() {
halign: Gtk.Align.START halign: Gtk.Align.START
}); });
let previewInput = new Gtk.Switch({ let previewInput = new Gtk.Switch({
active: this.settings.get_boolean ('preview'), active: previewEnabled,
halign: Gtk.Align.END, halign: Gtk.Align.END,
visible: true visible: true
}); });
@@ -123,11 +124,6 @@ function buildPrefsWidget() {
layout.attach(doubleWidthLabel, 0, row, 1, 1); layout.attach(doubleWidthLabel, 0, row, 1, 1);
layout.attach(doubleWidthInput, 1, row++, 1, 1); layout.attach(doubleWidthInput, 1, row++, 1, 1);
previewInput.connect('state-set', function(widget, state) {
doubleWidthLabel.set_sensitive(state);
doubleWidthInput.set_sensitive(state);
});
// Debug setting // Debug setting
let debugLabel = new Gtk.Label({ let debugLabel = new Gtk.Label({
label: _("Turn on debugging"), label: _("Turn on debugging"),
@@ -149,6 +145,16 @@ function buildPrefsWidget() {
this.settings.bind('preview', previewInput, 'active', Gio.SettingsBindFlags.DEFAULT); this.settings.bind('preview', previewInput, 'active', Gio.SettingsBindFlags.DEFAULT);
this.settings.bind('debug', debugInput, 'active', Gio.SettingsBindFlags.DEFAULT); this.settings.bind('debug', debugInput, 'active', Gio.SettingsBindFlags.DEFAULT);
let setDoubleWidthWidgetsEnabled = function(enabled) {
doubleWidthLabel.set_sensitive(enabled);
doubleWidthInput.set_sensitive(enabled);
};
setDoubleWidthWidgetsEnabled(previewEnabled);
previewInput.connect('state-set', function(widget, state) {
setDoubleWidthWidgetsEnabled(state);
});
// Return our widget which will be added to the window // Return our widget which will be added to the window
return layout; return layout;
} }