extensionPrefs: Simplify state change handling

The new `ExtensionStateChanged` signal already passes the changed
extension object, no need to request it again with `GetExtensionInfo`.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/873
This commit is contained in:
Florian Müllner 2019-11-30 06:01:44 +01:00 committed by Florian Müllner
parent 59a43f496d
commit 2703eed446

View File

@ -258,23 +258,15 @@ class Application extends Gtk.Application {
} }
_onExtensionStateChanged(proxy, senderName, [uuid, newState]) { _onExtensionStateChanged(proxy, senderName, [uuid, newState]) {
let extension = ExtensionUtils.deserializeExtension(newState);
let row = this._findExtensionRow(uuid); let row = this._findExtensionRow(uuid);
if (row) { if (row) {
let { state } = ExtensionUtils.deserializeExtension(newState); if (extension.state === ExtensionState.UNINSTALLED)
if (state == ExtensionState.UNINSTALLED)
row.destroy(); row.destroy();
return; // we only deal with new and deleted extensions here return; // we only deal with new and deleted extensions here
} }
this._addExtensionRow(extension);
this._shellProxy.GetExtensionInfoRemote(uuid, ([serialized]) => {
let extension = ExtensionUtils.deserializeExtension(serialized);
if (!extension)
return;
// check the extension wasn't added in between
if (this._findExtensionRow(uuid) != null)
return;
this._addExtensionRow(extension);
});
} }
_scanExtensions() { _scanExtensions() {