modalDialog: Inherit from St.Widget

Make the dialog a widget itself, removing the `_group` property used for
handling the actor.

Update all the inherited classes to be also GObject implementations, moving all
the signals to proper object ones.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/55
This commit is contained in:
Marco Trevisan (Treviño)
2019-05-23 15:45:44 -05:00
parent dd5d7d3b70
commit d25bcbc3a7
14 changed files with 130 additions and 123 deletions

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { Clutter, Gio, GLib, Shell } = imports.gi;
const { Clutter, Gio, GLib, GObject, Shell } = imports.gi;
const Dialog = imports.ui.dialog;
const Main = imports.ui.main;
@ -342,9 +342,11 @@ var AppAuthorizer = class {
}
};
var GeolocationDialog = class extends ModalDialog.ModalDialog {
constructor(name, subtitle, reqAccuracyLevel) {
super({ styleClass: 'geolocation-dialog' });
var GeolocationDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_UINT] } }
}, class GeolocationDialog extends ModalDialog.ModalDialog {
_init(name, subtitle, reqAccuracyLevel) {
super._init({ styleClass: 'geolocation-dialog' });
this.reqAccuracyLevel = reqAccuracyLevel;
let icon = new Gio.ThemedIcon({ name: 'find-location-symbolic' });
@ -375,5 +377,4 @@ var GeolocationDialog = class extends ModalDialog.ModalDialog {
this.emit('response', GeoclueAccuracyLevel.NONE);
this.close();
}
};
Signals.addSignalMethods(GeolocationDialog.prototype);
});

View File

@ -676,9 +676,10 @@ var NMWirelessDialogItem = GObject.registerClass({
}
});
var NMWirelessDialog = class extends ModalDialog.ModalDialog {
constructor(client, device) {
super({ styleClass: 'nm-dialog' });
var NMWirelessDialog = GObject.registerClass(
class NMWirelessDialog extends ModalDialog.ModalDialog {
_init(client, device) {
super._init({ styleClass: 'nm-dialog' });
this._client = client;
this._device = device;
@ -724,9 +725,11 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
Main.sessionMode.disconnect(id);
this.close();
});
this.connect('destroy', this._onDestroy.bind(this));
}
destroy() {
_onDestroy() {
if (this._apAddedId) {
GObject.Object.prototype.disconnect.call(this._device, this._apAddedId);
this._apAddedId = 0;
@ -752,8 +755,6 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
Mainloop.source_remove(this._scanTimeoutId);
this._scanTimeoutId = 0;
}
super.destroy();
}
_onScanTimeout() {
@ -1144,7 +1145,7 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
this._itemBox.grab_key_focus();
});
}
};
});
var NMDeviceWireless = class {
constructor(client, device) {