extensions-app: Use new adaptive dialogs
We already fulfill all prerequisites of the new adaptive dialogs, so the port is straight-forward and painless. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3148>
This commit is contained in:
parent
d3e96a36ce
commit
0c705aefc1
@ -50,7 +50,7 @@ export const ExtensionRow = GObject.registerClass({
|
|||||||
name: 'uninstall',
|
name: 'uninstall',
|
||||||
activate: () => {
|
activate: () => {
|
||||||
this._detailsPopover.popdown();
|
this._detailsPopover.popdown();
|
||||||
this.get_root().uninstall(extension);
|
this.get_root().uninstall(extension).catch(logError);
|
||||||
},
|
},
|
||||||
enabledProp: 'is-user',
|
enabledProp: 'is-user',
|
||||||
},
|
},
|
||||||
|
@ -11,6 +11,7 @@ import * as Gettext from 'gettext';
|
|||||||
import * as Config from './misc/config.js';
|
import * as Config from './misc/config.js';
|
||||||
import {ExtensionRow} from './extensionRow.js';
|
import {ExtensionRow} from './extensionRow.js';
|
||||||
|
|
||||||
|
Gio._promisify(Adw.AlertDialog.prototype, 'choose');
|
||||||
Gio._promisify(Gio.DBusConnection.prototype, 'call');
|
Gio._promisify(Gio.DBusConnection.prototype, 'call');
|
||||||
Gio._promisify(Shew.WindowExporter.prototype, 'export');
|
Gio._promisify(Shew.WindowExporter.prototype, 'export');
|
||||||
|
|
||||||
@ -108,26 +109,22 @@ export const ExtensionsWindow = GObject.registerClass({
|
|||||||
() => this._extensionsLoaded());
|
() => this._extensionsLoaded());
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall(extension) {
|
async uninstall(extension) {
|
||||||
const dialog = new Gtk.MessageDialog({
|
const dialog = new Adw.AlertDialog({
|
||||||
transient_for: this,
|
heading: _('Remove “%s”?').format(extension.name),
|
||||||
modal: true,
|
body: _('If you remove the extension, you need to return to download it if you want to enable it again'),
|
||||||
text: _('Remove “%s”?').format(extension.name),
|
|
||||||
secondary_text: _('If you remove the extension, you need to return to download it if you want to enable it again'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL);
|
dialog.add_response('cancel', _('_Cancel'));
|
||||||
dialog.add_button(_('_Remove'), Gtk.ResponseType.ACCEPT)
|
dialog.add_response('remove', _('_Remove'));
|
||||||
.get_style_context().add_class('destructive-action');
|
|
||||||
|
|
||||||
dialog.connect('response', (dlg, response) => {
|
dialog.set_response_appearance('remove',
|
||||||
const {extensionManager} = this.application;
|
Adw.ResponseAppearance.DESTRUCTIVE);
|
||||||
|
|
||||||
if (response === Gtk.ResponseType.ACCEPT)
|
const {extensionManager} = this.application;
|
||||||
extensionManager.uninstallExtension(extension.uuid);
|
const response = await dialog.choose(this, null);
|
||||||
dialog.destroy();
|
if (response === 'remove')
|
||||||
});
|
extensionManager.uninstallExtension(extension.uuid);
|
||||||
dialog.present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async openPrefs(extension) {
|
async openPrefs(extension) {
|
||||||
@ -144,7 +141,7 @@ export const ExtensionsWindow = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_showAbout() {
|
_showAbout() {
|
||||||
const aboutWindow = new Adw.AboutWindow({
|
const aboutDialog = new Adw.AboutDialog({
|
||||||
developers: [
|
developers: [
|
||||||
'Florian Müllner <fmuellner@gnome.org>',
|
'Florian Müllner <fmuellner@gnome.org>',
|
||||||
'Jasper St. Pierre <jstpierre@mecheye.net>',
|
'Jasper St. Pierre <jstpierre@mecheye.net>',
|
||||||
@ -163,10 +160,8 @@ export const ExtensionsWindow = GObject.registerClass({
|
|||||||
developer_name: _('The GNOME Project'),
|
developer_name: _('The GNOME Project'),
|
||||||
website: 'https://apps.gnome.org/app/org.gnome.Extensions/',
|
website: 'https://apps.gnome.org/app/org.gnome.Extensions/',
|
||||||
issue_url: 'https://gitlab.gnome.org/GNOME/gnome-shell/issues/new',
|
issue_url: 'https://gitlab.gnome.org/GNOME/gnome-shell/issues/new',
|
||||||
|
|
||||||
transient_for: this,
|
|
||||||
});
|
});
|
||||||
aboutWindow.present();
|
aboutDialog.present(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logout() {
|
_logout() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user