extensions-app: Indicate extension errors
Currently there is no indication that an extension had an error except for the sensitivity of the switch (which may have a different cause). This is useful information to users, so add a small error indicator alongside the updates icon and show the actual error in the details. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2337
This commit is contained in:

committed by
Florian Müllner

parent
48e6a58250
commit
9cad7ae975
@ -331,6 +331,8 @@ var ExtensionRow = GObject.registerClass({
|
||||
'descriptionLabel',
|
||||
'versionLabel',
|
||||
'authorLabel',
|
||||
'errorLabel',
|
||||
'errorIcon',
|
||||
'updatesIcon',
|
||||
'switch',
|
||||
'revealButton',
|
||||
@ -429,6 +431,12 @@ var ExtensionRow = GObject.registerClass({
|
||||
return this._extension.hasUpdate || false;
|
||||
}
|
||||
|
||||
get hasError() {
|
||||
const { state } = this._extension;
|
||||
return state === ExtensionState.OUT_OF_DATE ||
|
||||
state === ExtensionState.ERROR;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this._extension.type;
|
||||
}
|
||||
@ -445,6 +453,17 @@ var ExtensionRow = GObject.registerClass({
|
||||
return this._extension.metadata.version || '';
|
||||
}
|
||||
|
||||
get error() {
|
||||
if (!this.hasError)
|
||||
return '';
|
||||
|
||||
if (this._extension.state === ExtensionState.OUT_OF_DATE)
|
||||
return _('The extension is incompatible with the current GNOME version');
|
||||
|
||||
return this._extension.error
|
||||
? this._extension.error : _('The extension had an error');
|
||||
}
|
||||
|
||||
_updateState() {
|
||||
let state = this._extension.state === ExtensionState.ENABLED;
|
||||
|
||||
@ -456,6 +475,10 @@ var ExtensionRow = GObject.registerClass({
|
||||
this._switch.active = state;
|
||||
|
||||
this._updatesIcon.visible = this.hasUpdate;
|
||||
this._errorIcon.visible = this.hasError;
|
||||
|
||||
this._errorLabel.label = this.error;
|
||||
this._errorLabel.visible = this.error !== '';
|
||||
|
||||
this._versionLabel.label = this.version.toString();
|
||||
this._versionLabel.visible = this.version !== '';
|
||||
|
Reference in New Issue
Block a user