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,4 +1,4 @@
const { Clutter, Gio, GLib, Shell } = imports.gi; const { Clutter, Gio, GLib, GObject, Shell } = imports.gi;
const CheckBox = imports.ui.checkBox; const CheckBox = imports.ui.checkBox;
const Dialog = imports.ui.dialog; const Dialog = imports.ui.dialog;
@ -15,9 +15,10 @@ var DialogResponse = {
CLOSED: 2 CLOSED: 2
}; };
var AccessDialog = class extends ModalDialog.ModalDialog { var AccessDialog = GObject.registerClass(
constructor(invocation, handle, title, subtitle, body, options) { class AccessDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'access-dialog' }); _init(invocation, handle, title, subtitle, body, options) {
super._init({ styleClass: 'access-dialog' });
this._invocation = invocation; this._invocation = invocation;
this._handle = handle; this._handle = handle;
@ -109,7 +110,7 @@ var AccessDialog = class extends ModalDialog.ModalDialog {
}); });
this.close(); this.close();
} }
}; });
var AccessDialogDBus = class { var AccessDialogDBus = class {
constructor() { constructor() {

View File

@ -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 Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog; const ModalDialog = imports.ui.modalDialog;
@ -13,10 +13,11 @@ var AudioDevice = {
const AudioDeviceSelectionIface = loadInterfaceXML('org.gnome.Shell.AudioDeviceSelection'); const AudioDeviceSelectionIface = loadInterfaceXML('org.gnome.Shell.AudioDeviceSelection');
var AudioDeviceSelectionDialog = var AudioDeviceSelectionDialog = GObject.registerClass({
class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog { Signals: { 'device-selected': { param_types: [GObject.TYPE_UINT] } }
constructor(devices) { }, class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'audio-device-selection-dialog' }); _init(devices) {
super._init({ styleClass: 'audio-device-selection-dialog' });
this._deviceItems = {}; this._deviceItems = {};
@ -33,10 +34,6 @@ class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
throw new Error('Too few devices for a selection'); throw new Error('Too few devices for a selection');
} }
destroy() {
super.destroy();
}
_buildLayout(devices) { _buildLayout(devices) {
let title = new St.Label({ style_class: 'audio-selection-title', let title = new St.Label({ style_class: 'audio-selection-title',
text: _("Select Audio Device"), text: _("Select Audio Device"),
@ -125,7 +122,7 @@ class AudioDeviceSelectionDialog extends ModalDialog.ModalDialog {
Main.overview.hide(); Main.overview.hide();
app.activate(); app.activate();
} }
}; });
var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus { var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
constructor() { constructor() {

View File

@ -10,9 +10,10 @@ const CheckBox = imports.ui.checkBox;
var WORK_SPINNER_ICON_SIZE = 16; var WORK_SPINNER_ICON_SIZE = 16;
var KeyringDialog = class extends ModalDialog.ModalDialog { var KeyringDialog = GObject.registerClass(
constructor() { class KeyringDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'prompt-dialog' }); _init() {
super._init({ styleClass: 'prompt-dialog' });
this.prompt = new Shell.KeyringPrompt(); this.prompt = new Shell.KeyringPrompt();
this.prompt.connect('show-password', this._onShowPassword.bind(this)); this.prompt.connect('show-password', this._onShowPassword.bind(this));
@ -212,7 +213,7 @@ var KeyringDialog = class extends ModalDialog.ModalDialog {
_onCancelButton() { _onCancelButton() {
this.prompt.cancel(); this.prompt.cancel();
} }
}; });
var KeyringDummyDialog = class { var KeyringDummyDialog = class {
constructor() { constructor() {

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Signals = imports.signals;
const Config = imports.misc.config; const Config = imports.misc.config;
@ -12,9 +12,10 @@ const ShellEntry = imports.ui.shellEntry;
const VPN_UI_GROUP = 'VPN Plugin UI'; const VPN_UI_GROUP = 'VPN Plugin UI';
var NetworkSecretDialog = class extends ModalDialog.ModalDialog { var NetworkSecretDialog = GObject.registerClass(
constructor(agent, requestId, connection, settingName, hints, flags, contentOverride) { class NetworkSecretDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'prompt-dialog' }); _init(agent, requestId, connection, settingName, hints, flags, contentOverride) {
super._init({ styleClass: 'prompt-dialog' });
this._agent = agent; this._agent = agent;
this._requestId = requestId; this._requestId = requestId;
@ -347,7 +348,7 @@ var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
return content; return content;
} }
}; });
var VPNRequestHandler = class { var VPNRequestHandler = class {
constructor(agent, requestId, authHelper, serviceType, connection, hints, flags) { constructor(agent, requestId, authHelper, serviceType, connection, hints, flags) {

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { AccountsService, Clutter, Gio, GLib, 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 Signals = imports.signals;
const Animation = imports.ui.animation; const Animation = imports.ui.animation;
@ -15,9 +15,11 @@ var DIALOG_ICON_SIZE = 48;
var WORK_SPINNER_ICON_SIZE = 16; var WORK_SPINNER_ICON_SIZE = 16;
var AuthenticationDialog = class extends ModalDialog.ModalDialog { var AuthenticationDialog = GObject.registerClass({
constructor(actionId, body, cookie, userNames) { Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } }
super({ styleClass: 'prompt-dialog' }); }, class AuthenticationDialog extends ModalDialog.ModalDialog {
_init(actionId, body, cookie, userNames) {
super._init({ styleClass: 'prompt-dialog' });
this.actionId = actionId; this.actionId = actionId;
this.message = body; this.message = body;
@ -25,7 +27,7 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog {
this._wasDismissed = false; this._wasDismissed = false;
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => { this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
this._group.visible = !Main.sessionMode.isLocked; this.visible = !Main.sessionMode.isLocked;
}); });
this.connect('closed', this._onDialogClosed.bind(this)); this.connect('closed', this._onDialogClosed.bind(this));
@ -326,8 +328,7 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog {
this._destroySession(); this._destroySession();
} }
}; });
Signals.addSignalMethods(AuthenticationDialog.prototype);
var AuthenticationAgent = class { var AuthenticationAgent = class {
constructor() { constructor() {

View File

@ -19,7 +19,7 @@
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const { AccountsService, Clutter, Gio, 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 CheckBox = imports.ui.checkBox;
const GnomeSession = imports.misc.gnomeSession; const GnomeSession = imports.misc.gnomeSession;
@ -226,10 +226,11 @@ function init() {
_endSessionDialog = new EndSessionDialog(); _endSessionDialog = new EndSessionDialog();
} }
var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog { var EndSessionDialog = GObject.registerClass(
constructor() { class EndSessionDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'end-session-dialog', _init() {
destroyOnClose: false }); super._init({ styleClass: 'end-session-dialog',
destroyOnClose: false });
this._loginManager = LoginManager.getLoginManager(); this._loginManager = LoginManager.getLoginManager();
this._userManager = AccountsService.UserManager.get_default(); this._userManager = AccountsService.UserManager.get_default();
@ -747,4 +748,4 @@ var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog {
Close(parameters, invocation) { Close(parameters, invocation) {
this.close(); this.close();
} }
}; });

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Config = imports.misc.config;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@ -176,10 +176,10 @@ function checkForUpdates() {
}); });
} }
var InstallExtensionDialog = var InstallExtensionDialog = GObject.registerClass(
class InstallExtensionDialog extends ModalDialog.ModalDialog { class InstallExtensionDialog extends ModalDialog.ModalDialog {
constructor(uuid, info, invocation) { _init(uuid, info, invocation) {
super({ styleClass: 'extension-dialog' }); super._init({ styleClass: 'extension-dialog' });
this._uuid = uuid; this._uuid = uuid;
this._info = info; this._info = info;
@ -255,7 +255,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
this.close(); this.close();
} }
}; });
function init() { function init() {
_httpSession = new Soup.SessionAsync({ ssl_use_system_ca_file: true }); _httpSession = new Soup.SessionAsync({ ssl_use_system_ca_file: true });

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Mainloop = imports.mainloop;
const AccessDialog = imports.ui.accessDialog; const AccessDialog = imports.ui.accessDialog;
@ -689,12 +689,13 @@ function queueDeferredWork(workId) {
} }
} }
var RestartMessage = class extends ModalDialog.ModalDialog { var RestartMessage = GObject.registerClass(
constructor(message) { class RestartMessage extends ModalDialog.ModalDialog {
super({ shellReactive: true, _init(message) {
styleClass: 'restart-message headline', super._init({ shellReactive: true,
shouldFadeIn: false, styleClass: 'restart-message headline',
destroyOnClose: true }); shouldFadeIn: false,
destroyOnClose: true });
let label = new St.Label({ text: message }); let label = new St.Label({ text: message });
@ -704,7 +705,7 @@ var RestartMessage = class extends ModalDialog.ModalDialog {
y_align: St.Align.MIDDLE }); y_align: St.Align.MIDDLE });
this.buttonLayout.hide(); this.buttonLayout.hide();
} }
}; });
function showRestartMessage(message) { function showRestartMessage(message) {
let restartMessage = new RestartMessage(message); let restartMessage = new RestartMessage(message);

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Signals = imports.signals;
const Dialog = imports.ui.dialog; const Dialog = imports.ui.dialog;
@ -21,8 +21,15 @@ var State = {
FADED_OUT: 4 FADED_OUT: 4
}; };
var ModalDialog = class { var ModalDialog = GObject.registerClass({
constructor(params) { 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, params = Params.parse(params, { shellReactive: false,
styleClass: null, styleClass: null,
actionMode: Shell.ActionMode.SYSTEM_MODAL, actionMode: Shell.ActionMode.SYSTEM_MODAL,
@ -38,31 +45,25 @@ var ModalDialog = class {
this._shouldFadeOut = params.shouldFadeOut; this._shouldFadeOut = params.shouldFadeOut;
this._destroyOnClose = params.destroyOnClose; this._destroyOnClose = params.destroyOnClose;
this._group = new St.Widget({ visible: false, Main.layoutManager.modalDialogGroup.add_actor(this);
x: 0,
y: 0,
accessible_role: Atk.Role.DIALOG });
Main.layoutManager.modalDialogGroup.add_actor(this._group);
let constraint = new Clutter.BindConstraint({ source: global.stage, let constraint = new Clutter.BindConstraint({ source: global.stage,
coordinate: Clutter.BindCoordinate.ALL }); coordinate: Clutter.BindCoordinate.ALL });
this._group.add_constraint(constraint); this.add_constraint(constraint);
this._group.connect('destroy', this._onGroupDestroy.bind(this));
this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
this._backgroundBin = new St.Bin({ child: this.backgroundStack, this._backgroundBin = new St.Bin({ child: this.backgroundStack,
x_fill: true, y_fill: true }); x_fill: true, y_fill: true });
this._monitorConstraint = new Layout.MonitorConstraint(); this._monitorConstraint = new Layout.MonitorConstraint();
this._backgroundBin.add_constraint(this._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.dialogLayout = new Dialog.Dialog(this.backgroundStack, params.styleClass);
this.contentLayout = this.dialogLayout.contentLayout; this.contentLayout = this.dialogLayout.contentLayout;
this.buttonLayout = this.dialogLayout.buttonLayout; this.buttonLayout = this.dialogLayout.buttonLayout;
if (!this._shellReactive) { if (!this._shellReactive) {
this._lightbox = new Lightbox.Lightbox(this._group, this._lightbox = new Lightbox.Lightbox(this,
{ inhibitEvents: true, { inhibitEvents: true,
radialEffect: true }); radialEffect: true });
this._lightbox.highlight(this._backgroundBin); this._lightbox.highlight(this._backgroundBin);
@ -77,10 +78,6 @@ var ModalDialog = class {
this._savedKeyFocus = null; this._savedKeyFocus = null;
} }
destroy() {
this._group.destroy();
}
clearButtons() { clearButtons() {
this.dialogLayout.clearButtons(); this.dialogLayout.clearButtons();
} }
@ -96,10 +93,6 @@ var ModalDialog = class {
return this.dialogLayout.addButton(buttonInfo); return this.dialogLayout.addButton(buttonInfo);
} }
_onGroupDestroy() {
this.emit('destroy');
}
_fadeOpen(onPrimary) { _fadeOpen(onPrimary) {
if (onPrimary) if (onPrimary)
this._monitorConstraint.primary = true; this._monitorConstraint.primary = true;
@ -111,9 +104,9 @@ var ModalDialog = class {
this.dialogLayout.opacity = 255; this.dialogLayout.opacity = 255;
if (this._lightbox) if (this._lightbox)
this._lightbox.show(); this._lightbox.show();
this._group.opacity = 0; this.opacity = 0;
this._group.show(); this.show();
Tweener.addTween(this._group, Tweener.addTween(this,
{ opacity: 255, { opacity: 255,
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0, time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
transition: 'easeOutQuad', transition: 'easeOutQuad',
@ -149,7 +142,7 @@ var ModalDialog = class {
_closeComplete() { _closeComplete() {
this.state = State.CLOSED; this.state = State.CLOSED;
this._group.hide(); this.hide();
this.emit('closed'); this.emit('closed');
if (this._destroyOnClose) if (this._destroyOnClose)
@ -165,7 +158,7 @@ var ModalDialog = class {
this._savedKeyFocus = null; this._savedKeyFocus = null;
if (this._shouldFadeOut) if (this._shouldFadeOut)
Tweener.addTween(this._group, Tweener.addTween(this,
{ opacity: 0, { opacity: 0,
time: OPEN_AND_CLOSE_TIME, time: OPEN_AND_CLOSE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
@ -183,11 +176,11 @@ var ModalDialog = class {
return; return;
let focus = global.stage.key_focus; let focus = global.stage.key_focus;
if (focus && this._group.contains(focus)) if (focus && this.contains(focus))
this._savedKeyFocus = focus; this._savedKeyFocus = focus;
else else
this._savedKeyFocus = null; this._savedKeyFocus = null;
Main.popModal(this._group, timestamp); Main.popModal(this, timestamp);
this._hasModal = false; this._hasModal = false;
if (!this._shellReactive) if (!this._shellReactive)
@ -201,7 +194,7 @@ var ModalDialog = class {
let params = { actionMode: this._actionMode }; let params = { actionMode: this._actionMode };
if (timestamp) if (timestamp)
params['timestamp'] = timestamp; params['timestamp'] = timestamp;
if (!Main.pushModal(this._group, params)) if (!Main.pushModal(this, params))
return false; return false;
this._hasModal = true; this._hasModal = true;
@ -246,5 +239,4 @@ var ModalDialog = class {
} }
}); });
} }
}; });
Signals.addSignalMethods(ModalDialog.prototype);

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Signals = imports.signals;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -23,10 +23,11 @@ const EXEC_ARG_KEY = 'exec-arg';
var DIALOG_GROW_TIME = 0.1; var DIALOG_GROW_TIME = 0.1;
var RunDialog = class extends ModalDialog.ModalDialog { var RunDialog = GObject.registerClass(
constructor() { class RunDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'run-dialog', _init() {
destroyOnClose: false }); super._init({ styleClass: 'run-dialog',
destroyOnClose: false });
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA }); this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA }); this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA });
@ -282,5 +283,4 @@ var RunDialog = class extends ModalDialog.ModalDialog {
super.open(); super.open();
} }
}; });
Signals.addSignalMethods(RunDialog.prototype);

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- 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 Signals = imports.signals;
const Animation = imports.ui.animation; const Animation = imports.ui.animation;
@ -269,9 +269,11 @@ var ShellUnmountNotifier = class extends MessageTray.Source {
} }
}; };
var ShellMountQuestionDialog = class extends ModalDialog.ModalDialog { var ShellMountQuestionDialog = GObject.registerClass({
constructor(icon) { Signals: { 'response': { param_types: [GObject.TYPE_INT] } }
super({ styleClass: 'mount-dialog' }); }, class ShellMountQuestionDialog extends ModalDialog.ModalDialog {
_init(icon) {
super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon }); this._content = new Dialog.MessageDialogContent({ icon });
this.contentLayout.add(this._content, { x_fill: true, y_fill: false }); 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); _setLabelsForMessage(this._content, message);
_setButtonsForChoices(this, choices); _setButtonsForChoices(this, choices);
} }
}; });
Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog { var ShellMountPasswordDialog = GObject.registerClass({
constructor(message, icon, flags) { 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 strings = message.split('\n');
let title = strings.shift() || null; let title = strings.shift() || null;
let body = 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'); let disksApp = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
@ -422,7 +430,7 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
} }
_onCancelButton() { _onCancelButton() {
this.emit('response', -1, '', false); this.emit('response', -1, '', false, false, false, 0);
} }
_onUnlockButton() { _onUnlockButton() {
@ -453,7 +461,7 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
this._hiddenVolume.actor.checked, this._hiddenVolume.actor.checked,
this._systemVolume && this._systemVolume &&
this._systemVolume.actor.checked, this._systemVolume.actor.checked,
pim); parseInt(pim));
} }
_onKeyfilesCheckboxClicked() { _onKeyfilesCheckboxClicked() {
@ -485,11 +493,13 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
); );
this._onCancelButton(); this._onCancelButton();
} }
}; });
var ShellProcessesDialog = class extends ModalDialog.ModalDialog { var ShellProcessesDialog = GObject.registerClass({
constructor(icon) { Signals: { 'response': { param_types: [GObject.TYPE_INT] } }
super({ styleClass: 'mount-dialog' }); }, class ShellProcessesDialog extends ModalDialog.ModalDialog {
_init(icon) {
super._init({ styleClass: 'mount-dialog' });
this._content = new Dialog.MessageDialogContent({ icon }); this._content = new Dialog.MessageDialogContent({ icon });
this.contentLayout.add(this._content, { x_fill: true, y_fill: false }); 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); _setLabelsForMessage(this._content, message);
_setButtonsForChoices(this, choices); _setButtonsForChoices(this, choices);
} }
}; });
Signals.addSignalMethods(ShellProcessesDialog.prototype);
const GnomeShellMountOpIface = loadInterfaceXML('org.Gtk.MountOperationHandler'); const GnomeShellMountOpIface = loadInterfaceXML('org.Gtk.MountOperationHandler');
@ -659,7 +668,7 @@ var GnomeShellMountOpHandler = class {
details['password'] = GLib.Variant.new('s', password); details['password'] = GLib.Variant.new('s', password);
details['hidden_volume'] = GLib.Variant.new('b', hiddenVolume); details['hidden_volume'] = GLib.Variant.new('b', hiddenVolume);
details['system_volume'] = GLib.Variant.new('b', systemVolume); 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); this._clearCurrentRequest(response, details);

View File

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

View File

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

View File

@ -40,9 +40,10 @@ const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
const GsdWacomIface = loadInterfaceXML('org.gnome.SettingsDaemon.Wacom'); const GsdWacomIface = loadInterfaceXML('org.gnome.SettingsDaemon.Wacom');
const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface); const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface);
var DisplayChangeDialog = class extends ModalDialog.ModalDialog { var DisplayChangeDialog = GObject.registerClass(
constructor(wm) { class DisplayChangeDialog extends ModalDialog.ModalDialog {
super({ styleClass: 'prompt-dialog' }); _init(wm) {
super._init({ styleClass: 'prompt-dialog' });
this._wm = wm; this._wm = wm;
@ -111,7 +112,7 @@ var DisplayChangeDialog = class extends ModalDialog.ModalDialog {
this._wm.complete_display_change(true); this._wm.complete_display_change(true);
this.close(); this.close();
} }
}; });
var WindowDimmer = class { var WindowDimmer = class {
constructor(actor) { constructor(actor) {