endSessionDialog: Use DialogType constants instead of magic numbers

This commit is contained in:
Florian Müllner 2014-09-11 14:55:07 +01:00
parent ebfdb8ec3c
commit 0258c7a518

View File

@ -134,11 +134,18 @@ const restartInstallDialogContent = {
showOtherSessions: true, showOtherSessions: true,
}; };
const DialogType = {
LOGOUT: 0 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT */,
SHUTDOWN: 1 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN */,
RESTART: 2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */,
UPDATE_RESTART: 3
};
const DialogContent = { const DialogContent = {
0 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT */: logoutDialogContent, DialogType.LOGOUT: logoutDialogContent,
1 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN */: shutdownDialogContent, DialogType.SHUTDOWN: shutdownDialogContent,
2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */: restartDialogContent, DialogType.RESTART: restartDialogContent,
3: restartInstallDialogContent DialogType.UPDATE_RESTART: restartInstallDialogContent
}; };
const MAX_USERS_IN_SESSION_DIALOG = 5; const MAX_USERS_IN_SESSION_DIALOG = 5;
@ -677,8 +684,9 @@ const EndSessionDialog = new Lang.Class({
this._totalSecondsToStayOpen = totalSecondsToStayOpen; this._totalSecondsToStayOpen = totalSecondsToStayOpen;
this._type = type; this._type = type;
if (this._type == 2 && this._updatesFile.query_exists(null)) if (this._type == DialogType.RESTART &&
this._type = 3; this._updatesFile.query_exists(null))
this._type = DialogType.UPDATE_RESTART;
this._applications = []; this._applications = [];
this._applicationList.destroy_all_children(); this._applicationList.destroy_all_children();