extensions-app: Add compat code for older shell versions

The Extensions app is also distributed as flatpak, so we cannot
assume that its version matches the shell. In order to not show
all extensions as disabled when running under a shell version that
doesn't include the `enabled` property yet, add a fallback based
on the current state.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7004

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3073>
This commit is contained in:
Florian Müllner 2023-12-20 00:17:29 +01:00 committed by Marge Bot
parent fec523f83f
commit 7a9bfa2744

View File

@ -142,6 +142,10 @@ const Extension = GObject.registerClass({
this._state = state;
this.notify('state');
// Compat with older shell versions
if (this._enabled === undefined)
this.notify('enabled');
if (this.hasError !== hadError) {
this.notify('has-error');
this.notify('error');
@ -203,6 +207,12 @@ const Extension = GObject.registerClass({
}
get enabled() {
// Compat with older shell versions
if (this._enabled === undefined) {
return this.state === ExtensionState.ACTIVE ||
this.state === ExtensionState.ACTIVATING;
}
return this._enabled;
}