extensions-app: Only change state if necessary

The `state-set` signal is emitted to change the underlying state,
which can have two reasons:

 1. the user toggled the switch
 2. the extension's `enabled` state changed externally

In the second case, calling enable/disable is pointless at best,
and can mess up the expected state by permanently disabling an
extension that was disabled because of the global kill switch.

Address this by only calling enable/disable if the new state does
not already match the current value of the `enabled` property.

Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7305

Fixes: fec523f83f ("extensions-app: Use new 'enabled' property")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3090>
This commit is contained in:
Florian Müllner 2024-01-05 10:52:08 +01:00 committed by Marge Bot
parent 1c5a10a71f
commit e75a2ca146

View File

@ -59,7 +59,10 @@ export const ExtensionRow = GObject.registerClass({
this._bindActionEnabled(actionEntries);
this._switch.connect('state-set', (sw, state) => {
const {uuid} = this._extension;
const {uuid, enabled} = this._extension;
if (enabled === state)
return true;
if (state)
this._app.extensionManager.enableExtension(uuid);
else