extensions-app: Use details popover

Showing all the extension info and possible actions in every
row is fairly noisy, and doesn't match the usual list patterns.

Streamline the UI by moving the actions and most of the info into
a details popover, so the rows themselves get closer to the
standard pattern.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7119

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3051>
This commit is contained in:
Florian Müllner
2023-12-10 23:21:38 +01:00
committed by Marge Bot
parent 82d3e55b68
commit 628e41890f
7 changed files with 226 additions and 154 deletions

View File

@ -357,7 +357,7 @@ var ExtensionRow = GObject.registerClass({
GTypeName: 'ExtensionRow',
Template: 'resource:///org/gnome/Extensions/ui/extension-row.ui',
InternalChildren: [
'nameLabel',
'detailsPopover',
'descriptionLabel',
'versionLabel',
'errorLabel',
@ -366,7 +366,7 @@ var ExtensionRow = GObject.registerClass({
'switch',
'actionsBox',
],
}, class ExtensionRow extends Gtk.ListBoxRow {
}, class ExtensionRow extends Adw.ActionRow {
_init(extension) {
super._init();
@ -384,7 +384,10 @@ var ExtensionRow = GObject.registerClass({
name: 'show-prefs',
enabled: this.hasPrefs,
});
action.connect('activate', () => this.get_root().openPrefs(this.uuid));
action.connect('activate', () => {
this._detailsPopover.popdown();
this.get_root().openPrefs(this.uuid);
});
this._actionGroup.add_action(action);
action = new Gio.SimpleAction({
@ -392,6 +395,7 @@ var ExtensionRow = GObject.registerClass({
enabled: this.url !== '',
});
action.connect('activate', () => {
this._detailsPopover.popdown();
Gio.AppInfo.launch_default_for_uri(
this.url, this.get_display().get_app_launch_context());
});
@ -401,7 +405,10 @@ var ExtensionRow = GObject.registerClass({
name: 'uninstall',
enabled: this.type === ExtensionType.PER_USER,
});
action.connect('activate', () => this.get_root().uninstall(this.uuid));
action.connect('activate', () => {
this._detailsPopover.popdown();
this.get_root().uninstall(this.uuid);
});
this._actionGroup.add_action(action);
action = new Gio.SimpleAction({
@ -417,7 +424,7 @@ var ExtensionRow = GObject.registerClass({
});
this._actionGroup.add_action(action);
this._nameLabel.label = this.name;
this.title = this.name;
const desc = this._extension.metadata.description.split('\n')[0];
this._descriptionLabel.label = desc;
@ -436,10 +443,6 @@ var ExtensionRow = GObject.registerClass({
this._updateState();
}
vfunc_activate() {
this._switch.mnemonic_activate(false);
}
get uuid() {
return this._extension.uuid;
}
@ -520,7 +523,7 @@ var ExtensionRow = GObject.registerClass({
this._errorButton.visible = this.hasError;
this._errorLabel.label = this.error;
this._versionLabel.label = this.version.toString();
this._versionLabel.label = _('Version %s').format(this.version.toString());
this._versionLabel.visible = this.version !== '';
}