Port ModalDialog to the class framework

Similar to the previous commits, time to port shell modal dialogs
to the class framework.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
This commit is contained in:
Giovanni Campagna 2011-11-20 16:32:59 +01:00
parent b356aa8e3b
commit 987099ea55
7 changed files with 41 additions and 67 deletions

View File

@ -750,12 +750,12 @@ function LoginDialog() {
return _loginDialog;
}
LoginDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const LoginDialog = new Lang.Class({
Name: 'LoginDialog',
Extends: ModalDialog.ModalDialog,
_init: function() {
ModalDialog.ModalDialog.prototype._init.call(this, { shellReactive: true,
styleClass: 'login-dialog' });
this.parent({ shellReactive: true, styleClass: 'login-dialog' });
this.connect('destroy',
Lang.bind(this, this._onDestroy));
this.connect('opened',
@ -1399,8 +1399,8 @@ LoginDialog.prototype = {
},
close: function() {
ModalDialog.ModalDialog.prototype.close.call(this);
this.parent();
Main.ctrlAltTabManager.removeGroup(this._group);
}
};
});

View File

@ -230,27 +230,19 @@ function _setLabelText(label, text) {
}
}
function EndSessionDialog() {
if (_endSessionDialog == null) {
this._init();
_endSessionDialog = this;
}
return _endSessionDialog;
}
function init() {
// This always returns the same singleton object
// By instantiating it initially, we register the
// bus object, etc.
let dialog = new EndSessionDialog();
_endSessionDialog = new EndSessionDialog();
}
EndSessionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const EndSessionDialog = new Lang.Class({
Name: 'EndSessionDialog',
Extends: ModalDialog.ModalDialog,
_init: function() {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'end-session-dialog' });
this.parent({ styleClass: 'end-session-dialog' });
this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
@ -441,7 +433,7 @@ EndSessionDialog.prototype = {
},
close: function() {
ModalDialog.ModalDialog.prototype.close.call(this);
this.parent();
this._dbusImpl.emit_signal('Closed', null);
},
@ -543,4 +535,4 @@ EndSessionDialog.prototype = {
this.disconnect(signalId);
}));
}
};
});

View File

@ -502,15 +502,12 @@ function loadExtensions() {
_loadExtensionsIn(userExtensionsDir, ExtensionType.PER_USER);
}
function InstallExtensionDialog(uuid, version_tag, name) {
this._init(uuid, version_tag, name);
}
InstallExtensionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const InstallExtensionDialog = new Lang.Class({
Name: 'InstallExtensionDialog',
Extends: ModalDialog.ModalDialog,
_init: function(uuid, version_tag, name) {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'extension-dialog' });
this.parent({ styleClass: 'extension-dialog' });
this._uuid = uuid;
this._version_tag = version_tag;
@ -570,4 +567,4 @@ InstallExtensionDialog.prototype = {
this.close(global.get_current_time());
}
};
});

View File

@ -29,11 +29,9 @@ const State = {
FADED_OUT: 4
};
function ModalDialog() {
this._init();
}
const ModalDialog = new Lang.Class({
Name: 'ModalDialog',
ModalDialog.prototype = {
_init: function(params) {
params = Params.parse(params, { shellReactive: false,
styleClass: null });
@ -303,5 +301,5 @@ ModalDialog.prototype = {
})
});
}
};
});
Signals.addSignalMethods(ModalDialog.prototype);

View File

@ -32,15 +32,12 @@ const ModalDialog = imports.ui.modalDialog;
const PopupMenu = imports.ui.popupMenu;
const ShellEntry = imports.ui.shellEntry;
function NetworkSecretDialog() {
this._init.apply(this, arguments);
}
NetworkSecretDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const NetworkSecretDialog = new Lang.Class({
Name: 'NetworkSecretDialog',
Extends: ModalDialog.ModalDialog,
_init: function(agent, requestId, connection, settingName, hints) {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
this.parent({ styleClass: 'polkit-dialog' });
this._agent = agent;
this._requestId = requestId;
@ -358,7 +355,7 @@ NetworkSecretDialog.prototype = {
return content;
}
};
});
function NetworkAgent() {
this._init.apply(this, arguments);

View File

@ -36,15 +36,12 @@ const PolkitAgent = imports.gi.PolkitAgent;
const ModalDialog = imports.ui.modalDialog;
const ShellEntry = imports.ui.shellEntry;
function AuthenticationDialog(actionId, message, cookie, userNames) {
this._init(actionId, message, cookie, userNames);
}
AuthenticationDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const AuthenticationDialog = new Lang.Class({
Name: 'AuthenticationDialog',
Extends: ModalDialog.ModalDialog,
_init: function(actionId, message, cookie, userNames) {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
this.parent({ styleClass: 'polkit-dialog' });
this.actionId = actionId;
this.message = message;
@ -335,8 +332,7 @@ AuthenticationDialog.prototype = {
this.close(global.get_current_time());
this._emitDone(false, true);
},
};
});
Signals.addSignalMethods(AuthenticationDialog.prototype);
function AuthenticationAgent() {

View File

@ -192,15 +192,12 @@ ShellMountOperation.prototype = {
},
}
function ShellMountQuestionDialog(icon) {
this._init(icon);
}
ShellMountQuestionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const ShellMountQuestionDialog = new Lang.Class({
Name: 'ShellMountQuestionDialog',
Extends: ModalDialog.ModalDialog,
_init: function(icon) {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'mount-question-dialog' });
this.parent({ styleClass: 'mount-question-dialog' });
let mainContentLayout = new St.BoxLayout();
this.contentLayout.add(mainContentLayout, { x_fill: true,
@ -236,7 +233,7 @@ ShellMountQuestionDialog.prototype = {
_setLabelsForMessage(this, message);
_setButtonsForChoices(this, choices);
}
}
});
Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
const ShellMountPasswordSource = new Lang.Class({
@ -298,15 +295,12 @@ const ShellMountPasswordNotification = new Lang.Class({
}
});
function ShellProcessesDialog(icon) {
this._init(icon);
}
ShellProcessesDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
const ShellProcessesDialog = new Lang.Class({
Name: 'ShellProcessesDialog',
Extends: ModalDialog.ModalDialog,
_init: function(icon) {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'show-processes-dialog' });
this.parent({ styleClass: 'show-processes-dialog' });
let mainContentLayout = new St.BoxLayout();
this.contentLayout.add(mainContentLayout, { x_fill: true,
@ -392,5 +386,5 @@ ShellProcessesDialog.prototype = {
_setLabelsForMessage(this, message);
_setButtonsForChoices(this, choices);
}
}
});
Signals.addSignalMethods(ShellProcessesDialog.prototype);