[gnome-shell] modalDialog: Inherit from St.Widget
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] modalDialog: Inherit from St.Widget
- Date: Fri, 24 May 2019 21:40:19 +0000 (UTC)
commit d25bcbc3a7e921e0b2aa19a6a0cfd87fc57b324f
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Thu May 23 15:45:44 2019 -0500
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
js/ui/accessDialog.js | 11 ++++----
js/ui/audioDeviceSelection.js | 17 ++++++-------
js/ui/components/keyring.js | 9 ++++---
js/ui/components/networkAgent.js | 11 ++++----
js/ui/components/polkitAgent.js | 15 +++++------
js/ui/endSessionDialog.js | 13 +++++-----
js/ui/extensionDownloader.js | 10 ++++----
js/ui/main.js | 17 +++++++------
js/ui/modalDialog.js | 54 +++++++++++++++++-----------------------
js/ui/runDialog.js | 14 +++++------
js/ui/shellMountOperation.js | 47 ++++++++++++++++++++--------------
js/ui/status/location.js | 13 +++++-----
js/ui/status/network.js | 15 +++++------
js/ui/windowManager.js | 9 ++++---
14 files changed, 131 insertions(+), 124 deletions(-)
---
diff --git a/js/ui/accessDialog.js b/js/ui/accessDialog.js
index 69ba42c8d..6f9b7f9a0 100644
--- a/js/ui/accessDialog.js
+++ b/js/ui/accessDialog.js
@@ -1,4 +1,4 @@
-const { Clutter, Gio, GLib, Shell } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Shell } = imports.gi;
const CheckBox = imports.ui.checkBox;
const Dialog = imports.ui.dialog;
@@ -15,9 +15,10 @@ var DialogResponse = {
CLOSED: 2
};
-var AccessDialog = class extends ModalDialog.ModalDialog {
- constructor(invocation, handle, title, subtitle, body, options) {
- super({ styleClass: 'access-dialog' });
+var AccessDialog = GObject.registerClass(
+class AccessDialog extends ModalDialog.ModalDialog {
+ _init(invocation, handle, title, subtitle, body, options) {
+ super._init({ styleClass: 'access-dialog' });
this._invocation = invocation;
this._handle = handle;
@@ -109,7 +110,7 @@ var AccessDialog = class extends ModalDialog.ModalDialog {
});
this.close();
}
-};
+});
var AccessDialogDBus = class {
constructor() {
diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js
index 25fde891f..2a83b7fdb 100644
--- a/js/ui/audioDeviceSelection.js
+++ b/js/ui/audioDeviceSelection.js
@@ -1,4 +1,4 @@
-const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog;
@@ -13,10 +13,11 @@ var AudioDevice = {
const AudioDeviceSelectionIface = loadInterfaceXML('org.gnome.Shell.AudioDeviceSelection');
-var AudioDeviceSelectionDialog =
-class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
- constructor(devices) {
- super({ styleClass: 'audio-device-selection-dialog' });
+var AudioDeviceSelectionDialog = GObject.registerClass({
+ Signals: { 'device-selected': { param_types: [GObject.TYPE_UINT] } }
+}, class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
+ _init(devices) {
+ super._init({ styleClass: 'audio-device-selection-dialog' });
this._deviceItems = {};
@@ -33,10 +34,6 @@ class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
throw new Error('Too few devices for a selection');
}
- destroy() {
- super.destroy();
- }
-
_buildLayout(devices) {
let title = new St.Label({ style_class: 'audio-selection-title',
text: _("Select Audio Device"),
@@ -125,7 +122,7 @@ class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
Main.overview.hide();
app.activate();
}
-};
+});
var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
constructor() {
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
index ab0793f54..fccadca12 100644
--- a/js/ui/components/keyring.js
+++ b/js/ui/components/keyring.js
@@ -10,9 +10,10 @@ const CheckBox = imports.ui.checkBox;
var WORK_SPINNER_ICON_SIZE = 16;
-var KeyringDialog = class extends ModalDialog.ModalDialog {
- constructor() {
- super({ styleClass: 'prompt-dialog' });
+var KeyringDialog = GObject.registerClass(
+class KeyringDialog extends ModalDialog.ModalDialog {
+ _init() {
+ super._init({ styleClass: 'prompt-dialog' });
this.prompt = new Shell.KeyringPrompt();
this.prompt.connect('show-password', this._onShowPassword.bind(this));
@@ -212,7 +213,7 @@ var KeyringDialog = class extends ModalDialog.ModalDialog {
_onCancelButton() {
this.prompt.cancel();
}
-};
+});
var KeyringDummyDialog = class {
constructor() {
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index f871c732d..48bbd308f 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, NM, Pango, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, NM, Pango, Shell, St } = imports.gi;
const Signals = imports.signals;
const Config = imports.misc.config;
@@ -12,9 +12,10 @@ const ShellEntry = imports.ui.shellEntry;
const VPN_UI_GROUP = 'VPN Plugin UI';
-var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
- constructor(agent, requestId, connection, settingName, hints, flags, contentOverride) {
- super({ styleClass: 'prompt-dialog' });
+var NetworkSecretDialog = GObject.registerClass(
+class NetworkSecretDialog extends ModalDialog.ModalDialog {
+ _init(agent, requestId, connection, settingName, hints, flags, contentOverride) {
+ super._init({ styleClass: 'prompt-dialog' });
this._agent = agent;
this._requestId = requestId;
@@ -347,7 +348,7 @@ var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
return content;
}
-};
+});
var VPNRequestHandler = class {
constructor(agent, requestId, authHelper, serviceType, connection, hints, flags) {
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
index 21feb4090..27566531f 100644
--- a/js/ui/components/polkitAgent.js
+++ b/js/ui/components/polkitAgent.js
@@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { AccountsService, Clutter, Gio, GLib,
- Pango, PolkitAgent, Polkit, Shell, St } = imports.gi;
+ GObject, Pango, PolkitAgent, Polkit, Shell, St } = imports.gi;
const Signals = imports.signals;
const Animation = imports.ui.animation;
@@ -15,9 +15,11 @@ var DIALOG_ICON_SIZE = 48;
var WORK_SPINNER_ICON_SIZE = 16;
-var AuthenticationDialog = class extends ModalDialog.ModalDialog {
- constructor(actionId, body, cookie, userNames) {
- super({ styleClass: 'prompt-dialog' });
+var AuthenticationDialog = GObject.registerClass({
+ Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } }
+}, class AuthenticationDialog extends ModalDialog.ModalDialog {
+ _init(actionId, body, cookie, userNames) {
+ super._init({ styleClass: 'prompt-dialog' });
this.actionId = actionId;
this.message = body;
@@ -25,7 +27,7 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog {
this._wasDismissed = false;
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
- this._group.visible = !Main.sessionMode.isLocked;
+ this.visible = !Main.sessionMode.isLocked;
});
this.connect('closed', this._onDialogClosed.bind(this));
@@ -326,8 +328,7 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog {
this._destroySession();
}
-};
-Signals.addSignalMethods(AuthenticationDialog.prototype);
+});
var AuthenticationAgent = class {
constructor() {
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 0d4aa9d4d..d83578fb9 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -19,7 +19,7 @@
const Mainloop = imports.mainloop;
const { AccountsService, Clutter, Gio,
- GLib, Pango, Polkit, Shell, St } = imports.gi;
+ GLib, GObject, Pango, Polkit, Shell, St } = imports.gi;
const CheckBox = imports.ui.checkBox;
const GnomeSession = imports.misc.gnomeSession;
@@ -226,10 +226,11 @@ function init() {
_endSessionDialog = new EndSessionDialog();
}
-var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog {
- constructor() {
- super({ styleClass: 'end-session-dialog',
- destroyOnClose: false });
+var EndSessionDialog = GObject.registerClass(
+class EndSessionDialog extends ModalDialog.ModalDialog {
+ _init() {
+ super._init({ styleClass: 'end-session-dialog',
+ destroyOnClose: false });
this._loginManager = LoginManager.getLoginManager();
this._userManager = AccountsService.UserManager.get_default();
@@ -747,4 +748,4 @@ var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog {
Close(parameters, invocation) {
this.close();
}
-};
+});
diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js
index 9aed29c69..fdef0b9d2 100644
--- a/js/ui/extensionDownloader.js
+++ b/js/ui/extensionDownloader.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, Soup, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Soup, St } = imports.gi;
const Config = imports.misc.config;
const ExtensionUtils = imports.misc.extensionUtils;
@@ -176,10 +176,10 @@ function checkForUpdates() {
});
}
-var InstallExtensionDialog =
+var InstallExtensionDialog = GObject.registerClass(
class InstallExtensionDialog extends ModalDialog.ModalDialog {
- constructor(uuid, info, invocation) {
- super({ styleClass: 'extension-dialog' });
+ _init(uuid, info, invocation) {
+ super._init({ styleClass: 'extension-dialog' });
this._uuid = uuid;
this._info = info;
@@ -255,7 +255,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
this.close();
}
-};
+});
function init() {
_httpSession = new Soup.SessionAsync({ ssl_use_system_ca_file: true });
diff --git a/js/ui/main.js b/js/ui/main.js
index a6444a79a..d9f287cd9 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Mainloop = imports.mainloop;
const AccessDialog = imports.ui.accessDialog;
@@ -689,12 +689,13 @@ function queueDeferredWork(workId) {
}
}
-var RestartMessage = class extends ModalDialog.ModalDialog {
- constructor(message) {
- super({ shellReactive: true,
- styleClass: 'restart-message headline',
- shouldFadeIn: false,
- destroyOnClose: true });
+var RestartMessage = GObject.registerClass(
+class RestartMessage extends ModalDialog.ModalDialog {
+ _init(message) {
+ super._init({ shellReactive: true,
+ styleClass: 'restart-message headline',
+ shouldFadeIn: false,
+ destroyOnClose: true });
let label = new St.Label({ text: message });
@@ -704,7 +705,7 @@ var RestartMessage = class extends ModalDialog.ModalDialog {
y_align: St.Align.MIDDLE });
this.buttonLayout.hide();
}
-};
+});
function showRestartMessage(message) {
let restartMessage = new RestartMessage(message);
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 0a7cd30be..06476059b 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Atk, Clutter, Shell, St } = imports.gi;
+const { Atk, Clutter, GObject, Shell, St } = imports.gi;
const Signals = imports.signals;
const Dialog = imports.ui.dialog;
@@ -21,8 +21,15 @@ var State = {
FADED_OUT: 4
};
-var ModalDialog = class {
- constructor(params) {
+var ModalDialog = GObject.registerClass({
+ Signals: { 'opened': {}, 'closed': {} }
+}, class ModalDialog extends St.Widget {
+ _init(params) {
+ super._init({ visible: false,
+ x: 0,
+ y: 0,
+ accessible_role: Atk.Role.DIALOG });
+
params = Params.parse(params, { shellReactive: false,
styleClass: null,
actionMode: Shell.ActionMode.SYSTEM_MODAL,
@@ -38,31 +45,25 @@ var ModalDialog = class {
this._shouldFadeOut = params.shouldFadeOut;
this._destroyOnClose = params.destroyOnClose;
- this._group = new St.Widget({ visible: false,
- x: 0,
- y: 0,
- accessible_role: Atk.Role.DIALOG });
- Main.layoutManager.modalDialogGroup.add_actor(this._group);
+ Main.layoutManager.modalDialogGroup.add_actor(this);
let constraint = new Clutter.BindConstraint({ source: global.stage,
coordinate: Clutter.BindCoordinate.ALL });
- this._group.add_constraint(constraint);
-
- this._group.connect('destroy', this._onGroupDestroy.bind(this));
+ this.add_constraint(constraint);
this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
this._backgroundBin = new St.Bin({ child: this.backgroundStack,
x_fill: true, y_fill: true });
this._monitorConstraint = new Layout.MonitorConstraint();
this._backgroundBin.add_constraint(this._monitorConstraint);
- this._group.add_actor(this._backgroundBin);
+ this.add_actor(this._backgroundBin);
this.dialogLayout = new Dialog.Dialog(this.backgroundStack, params.styleClass);
this.contentLayout = this.dialogLayout.contentLayout;
this.buttonLayout = this.dialogLayout.buttonLayout;
if (!this._shellReactive) {
- this._lightbox = new Lightbox.Lightbox(this._group,
+ this._lightbox = new Lightbox.Lightbox(this,
{ inhibitEvents: true,
radialEffect: true });
this._lightbox.highlight(this._backgroundBin);
@@ -77,10 +78,6 @@ var ModalDialog = class {
this._savedKeyFocus = null;
}
- destroy() {
- this._group.destroy();
- }
-
clearButtons() {
this.dialogLayout.clearButtons();
}
@@ -96,10 +93,6 @@ var ModalDialog = class {
return this.dialogLayout.addButton(buttonInfo);
}
- _onGroupDestroy() {
- this.emit('destroy');
- }
-
_fadeOpen(onPrimary) {
if (onPrimary)
this._monitorConstraint.primary = true;
@@ -111,9 +104,9 @@ var ModalDialog = class {
this.dialogLayout.opacity = 255;
if (this._lightbox)
this._lightbox.show();
- this._group.opacity = 0;
- this._group.show();
- Tweener.addTween(this._group,
+ this.opacity = 0;
+ this.show();
+ Tweener.addTween(this,
{ opacity: 255,
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
transition: 'easeOutQuad',
@@ -149,7 +142,7 @@ var ModalDialog = class {
_closeComplete() {
this.state = State.CLOSED;
- this._group.hide();
+ this.hide();
this.emit('closed');
if (this._destroyOnClose)
@@ -165,7 +158,7 @@ var ModalDialog = class {
this._savedKeyFocus = null;
if (this._shouldFadeOut)
- Tweener.addTween(this._group,
+ Tweener.addTween(this,
{ opacity: 0,
time: OPEN_AND_CLOSE_TIME,
transition: 'easeOutQuad',
@@ -183,11 +176,11 @@ var ModalDialog = class {
return;
let focus = global.stage.key_focus;
- if (focus && this._group.contains(focus))
+ if (focus && this.contains(focus))
this._savedKeyFocus = focus;
else
this._savedKeyFocus = null;
- Main.popModal(this._group, timestamp);
+ Main.popModal(this, timestamp);
this._hasModal = false;
if (!this._shellReactive)
@@ -201,7 +194,7 @@ var ModalDialog = class {
let params = { actionMode: this._actionMode };
if (timestamp)
params['timestamp'] = timestamp;
- if (!Main.pushModal(this._group, params))
+ if (!Main.pushModal(this, params))
return false;
this._hasModal = true;
@@ -246,5 +239,4 @@ var ModalDialog = class {
}
});
}
-};
-Signals.addSignalMethods(ModalDialog.prototype);
+});
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 49f14026f..a4ac8c82b 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
const Main = imports.ui.main;
@@ -23,10 +23,11 @@ const EXEC_ARG_KEY = 'exec-arg';
var DIALOG_GROW_TIME = 0.1;
-var RunDialog = class extends ModalDialog.ModalDialog {
- constructor() {
- super({ styleClass: 'run-dialog',
- destroyOnClose: false });
+var RunDialog = GObject.registerClass(
+class RunDialog extends ModalDialog.ModalDialog {
+ _init() {
+ super._init({ styleClass: 'run-dialog',
+ destroyOnClose: false });
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA });
@@ -282,5 +283,4 @@ var RunDialog = class extends ModalDialog.ModalDialog {
super.open();
}
-};
-Signals.addSignalMethods(RunDialog.prototype);
+});
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index 1311b451a..8cb690b6e 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const { Clutter, Gio, GLib, Pango, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Pango, Shell, St } = imports.gi;
const Signals = imports.signals;
const Animation = imports.ui.animation;
@@ -269,9 +269,11 @@ var ShellUnmountNotifier = class extends MessageTray.Source {
}
};
-var ShellMountQuestionDialog = class extends ModalDialog.ModalDialog {
- constructor(icon) {
- super({ styleClass: 'mount-dialog' });
+var ShellMountQuestionDialog = GObject.registerClass({
+ Signals: { 'response': { param_types: [GObject.TYPE_INT] } }
+}, class ShellMountQuestionDialog extends ModalDialog.ModalDialog {
+ _init(icon) {
+ super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon });
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
@@ -281,15 +283,21 @@ var ShellMountQuestionDialog = class extends ModalDialog.ModalDialog {
_setLabelsForMessage(this._content, message);
_setButtonsForChoices(this, choices);
}
-};
-Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
-
-var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
- constructor(message, icon, flags) {
+});
+
+var ShellMountPasswordDialog = GObject.registerClass({
+ Signals: { 'response': { param_types: [GObject.TYPE_INT,
+ GObject.TYPE_STRING,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_UINT] } }
+}, class ShellMountPasswordDialog extends ModalDialog.ModalDialog {
+ _init(message, icon, flags) {
let strings = message.split('\n');
let title = strings.shift() || null;
let body = strings.shift() || null;
- super({ styleClass: 'prompt-dialog' });
+ super._init({ styleClass: 'prompt-dialog' });
let disksApp = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
@@ -422,7 +430,7 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
}
_onCancelButton() {
- this.emit('response', -1, '', false);
+ this.emit('response', -1, '', false, false, false, 0);
}
_onUnlockButton() {
@@ -453,7 +461,7 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
this._hiddenVolume.actor.checked,
this._systemVolume &&
this._systemVolume.actor.checked,
- pim);
+ parseInt(pim));
}
_onKeyfilesCheckboxClicked() {
@@ -485,11 +493,13 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
);
this._onCancelButton();
}
-};
+});
-var ShellProcessesDialog = class extends ModalDialog.ModalDialog {
- constructor(icon) {
- super({ styleClass: 'mount-dialog' });
+var ShellProcessesDialog = GObject.registerClass({
+ Signals: { 'response': { param_types: [GObject.TYPE_INT] } }
+}, class ShellProcessesDialog extends ModalDialog.ModalDialog {
+ _init(icon) {
+ super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon });
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
@@ -542,8 +552,7 @@ var ShellProcessesDialog = class extends ModalDialog.ModalDialog {
_setLabelsForMessage(this._content, message);
_setButtonsForChoices(this, choices);
}
-};
-Signals.addSignalMethods(ShellProcessesDialog.prototype);
+});
const GnomeShellMountOpIface = loadInterfaceXML('org.Gtk.MountOperationHandler');
@@ -659,7 +668,7 @@ var GnomeShellMountOpHandler = class {
details['password'] = GLib.Variant.new('s', password);
details['hidden_volume'] = GLib.Variant.new('b', hiddenVolume);
details['system_volume'] = GLib.Variant.new('b', systemVolume);
- details['pim'] = GLib.Variant.new('u', parseInt(pim));
+ details['pim'] = GLib.Variant.new('u', pim);
}
this._clearCurrentRequest(response, details);
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index e565367bb..7dc3b81f6 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -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);
+});
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 20a6317a5..4ab82e9f2 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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) {
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 599790677..1ab99fcdd 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -40,9 +40,10 @@ const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
const GsdWacomIface = loadInterfaceXML('org.gnome.SettingsDaemon.Wacom');
const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface);
-var DisplayChangeDialog = class extends ModalDialog.ModalDialog {
- constructor(wm) {
- super({ styleClass: 'prompt-dialog' });
+var DisplayChangeDialog = GObject.registerClass(
+class DisplayChangeDialog extends ModalDialog.ModalDialog {
+ _init(wm) {
+ super._init({ styleClass: 'prompt-dialog' });
this._wm = wm;
@@ -111,7 +112,7 @@ var DisplayChangeDialog = class extends ModalDialog.ModalDialog {
this._wm.complete_display_change(true);
this.close();
}
-};
+});
var WindowDimmer = class {
constructor(actor) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]