extensionPrefs: Block notify::active signal handler while updating state

We disable and enable extensions inside the `notify::active` signal
handler, but we shouldn't do that in case the change didn't come from
the user but because something else changed the state of the extension.

This causes an issue when the extensionPrefs window is open and the
session gets locked: The extensions are temporarily disabled by the
shell, extensionPrefs updates its switches on the state change and adds
those extensions to the `disabled-extensions` gsettings key inside the
signal handler. Now when the session is unlocked again, the extensions
won't be enabled again since they're forced-disabled.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/705
This commit is contained in:
Jonas Dreßler 2019-09-09 17:08:53 +02:00 committed by Florian Müllner
parent 17fa5a2db4
commit 1e68e78d8e

View File

@ -578,7 +578,11 @@ class ExtensionRow extends Gtk.ListBoxRow {
this._extension = ExtensionUtils.deserializeExtension(newState); this._extension = ExtensionUtils.deserializeExtension(newState);
let state = (this._extension.state == ExtensionState.ENABLED); let state = (this._extension.state == ExtensionState.ENABLED);
GObject.signal_handler_block(this._switch, this._notifyActiveId);
this._switch.state = state; this._switch.state = state;
GObject.signal_handler_unblock(this._switch, this._notifyActiveId);
this._switch.sensitive = this._canToggle(); this._switch.sensitive = this._canToggle();
}); });
} }
@ -646,7 +650,7 @@ class ExtensionRow extends Gtk.ListBoxRow {
sensitive: this._canToggle(), sensitive: this._canToggle(),
state: this._extension.state === ExtensionState.ENABLED state: this._extension.state === ExtensionState.ENABLED
}); });
this._switch.connect('notify::active', () => { this._notifyActiveId = this._switch.connect('notify::active', () => {
if (this._switch.active) if (this._switch.active)
this._app.shellProxy.EnableExtensionRemote(this.uuid); this._app.shellProxy.EnableExtensionRemote(this.uuid);
else else