endSessionDialog: make shutdown dialog work like latest mock ups
This commit adds a restart button to the shutdown dialog and changes the terminology from Shut Down to Power Off. This brings things in line with the latest mockups here: http://live.gnome.org/GnomeShell/Design/Whiteboards/SystemStopRestart https://bugzilla.gnome.org/show_bug.cgi?id=641375
This commit is contained in:
parent
35e410fe96
commit
dba02f8f08
@ -66,16 +66,20 @@ const logoutDialogContent = {
|
|||||||
uninhibitedDescriptionWithUser: _("%s will be logged out automatically in %d seconds."),
|
uninhibitedDescriptionWithUser: _("%s will be logged out automatically in %d seconds."),
|
||||||
uninhibitedDescription: _("You will be logged out automatically in %d seconds."),
|
uninhibitedDescription: _("You will be logged out automatically in %d seconds."),
|
||||||
endDescription: _("Logging out of the system."),
|
endDescription: _("Logging out of the system."),
|
||||||
confirmButtonText: _("Log Out"),
|
confirmButtons: [{ signal: 'ConfirmedLogout',
|
||||||
|
label: _("Log Out") }],
|
||||||
iconStyleClass: 'end-session-dialog-logout-icon'
|
iconStyleClass: 'end-session-dialog-logout-icon'
|
||||||
};
|
};
|
||||||
|
|
||||||
const shutdownDialogContent = {
|
const shutdownDialogContent = {
|
||||||
subject: _("Shut Down"),
|
subject: _("Power Off"),
|
||||||
inhibitedDescription: _("Click Shut Down to quit these applications and shut down the system."),
|
inhibitedDescription: _("Click Power Off to quit these applications and power off the system."),
|
||||||
uninhibitedDescription: _("The system will shut down automatically in %d seconds."),
|
uninhibitedDescription: _("The system will power off automatically in %d seconds."),
|
||||||
endDescription: _("Shutting down the system."),
|
endDescription: _("Powering off the system."),
|
||||||
confirmButtonText: _("Shut Down"),
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
|
label: _("Restart") },
|
||||||
|
{ signal: 'ConfirmedShutdown',
|
||||||
|
label: _("Power Off") }],
|
||||||
iconName: 'system-shutdown',
|
iconName: 'system-shutdown',
|
||||||
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
||||||
};
|
};
|
||||||
@ -85,7 +89,8 @@ const restartDialogContent = {
|
|||||||
inhibitedDescription: _("Click Restart to quit these applications and restart the system."),
|
inhibitedDescription: _("Click Restart to quit these applications and restart the system."),
|
||||||
uninhibitedDescription: _("The system will restart automatically in %d seconds."),
|
uninhibitedDescription: _("The system will restart automatically in %d seconds."),
|
||||||
endDescription: _("Restarting the system."),
|
endDescription: _("Restarting the system."),
|
||||||
confirmButtonText: _("Restart"),
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
|
label: _("Restart") }],
|
||||||
iconName: 'system-shutdown',
|
iconName: 'system-shutdown',
|
||||||
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
||||||
};
|
};
|
||||||
@ -406,18 +411,20 @@ EndSessionDialog.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let dialogContent = DialogContent[this._type];
|
let dialogContent = DialogContent[this._type];
|
||||||
let confirmButtonText = _("Confirm");
|
let buttons = [{ action: Lang.bind(this, this.cancel),
|
||||||
|
label: _("Cancel"),
|
||||||
|
key: Clutter.Escape }];
|
||||||
|
|
||||||
if (dialogContent.confirmButtonText)
|
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
||||||
confirmButtonText = dialogContent.confirmButtonText;
|
let signal = dialogContent.confirmButtons[i].signal;
|
||||||
|
let label = dialogContent.confirmButtons[i].label;
|
||||||
|
buttons.push({ action: Lang.bind(this, function() {
|
||||||
|
this._confirm(signal);
|
||||||
|
}),
|
||||||
|
label: label });
|
||||||
|
}
|
||||||
|
|
||||||
this.setButtons([{ label: _("Cancel"),
|
this.setButtons(buttons);
|
||||||
action: Lang.bind(this, this.cancel),
|
|
||||||
key: Clutter.Escape
|
|
||||||
},
|
|
||||||
{ label: confirmButtonText,
|
|
||||||
action: Lang.bind(this, this._confirm)
|
|
||||||
}]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
@ -435,12 +442,12 @@ EndSessionDialog.prototype = {
|
|||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_confirm: function() {
|
_confirm: function(signal) {
|
||||||
this._fadeOutDialog();
|
this._fadeOutDialog();
|
||||||
this._stopTimer();
|
this._stopTimer();
|
||||||
DBus.session.emit_signal('/org/gnome/SessionManager/EndSessionDialog',
|
DBus.session.emit_signal('/org/gnome/SessionManager/EndSessionDialog',
|
||||||
'org.gnome.SessionManager.EndSessionDialog',
|
'org.gnome.SessionManager.EndSessionDialog',
|
||||||
'Confirmed', '', []);
|
signal, '', []);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOpened: function() {
|
_onOpened: function() {
|
||||||
@ -455,7 +462,11 @@ EndSessionDialog.prototype = {
|
|||||||
time: this._secondsLeft,
|
time: this._secondsLeft,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onUpdate: Lang.bind(this, this._updateContent),
|
onUpdate: Lang.bind(this, this._updateContent),
|
||||||
onComplete: Lang.bind(this, this._confirm),
|
onComplete: Lang.bind(this, function() {
|
||||||
|
let dialogContent = DialogContent[this._type];
|
||||||
|
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
|
||||||
|
this._confirm(button.signal);
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user