endSessionDialog: Don't stop the timer when we have inhibitors
https://bugzilla.gnome.org/show_bug.cgi?id=706612
This commit is contained in:
parent
aaaf25d578
commit
a779e2aeca
@ -61,18 +61,16 @@ const EndSessionDialogIface = <interface name="org.gnome.SessionManager.EndSessi
|
|||||||
const logoutDialogContent = {
|
const logoutDialogContent = {
|
||||||
subjectWithUser: C_("title", "Log Out %s"),
|
subjectWithUser: C_("title", "Log Out %s"),
|
||||||
subject: C_("title", "Log Out"),
|
subject: C_("title", "Log Out"),
|
||||||
inhibitedDescription: _("Click Log Out to quit these applications and log out of the system."),
|
descriptionWithUser: function(user, seconds) {
|
||||||
uninhibitedDescriptionWithUser: function(user, seconds) {
|
|
||||||
return ngettext("%s will be logged out automatically in %d second.",
|
return ngettext("%s will be logged out automatically in %d second.",
|
||||||
"%s will be logged out automatically in %d seconds.",
|
"%s will be logged out automatically in %d seconds.",
|
||||||
seconds).format(user, seconds);
|
seconds).format(user, seconds);
|
||||||
},
|
},
|
||||||
uninhibitedDescription: function(seconds) {
|
description: function(seconds) {
|
||||||
return ngettext("You will be logged out automatically in %d second.",
|
return ngettext("You will be logged out automatically in %d second.",
|
||||||
"You will be logged out automatically in %d seconds.",
|
"You will be logged out automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
},
|
},
|
||||||
endDescription: _("Logging out of the system."),
|
|
||||||
confirmButtons: [{ signal: 'ConfirmedLogout',
|
confirmButtons: [{ signal: 'ConfirmedLogout',
|
||||||
label: C_("button", "Log Out") }],
|
label: C_("button", "Log Out") }],
|
||||||
iconStyleClass: 'end-session-dialog-logout-icon'
|
iconStyleClass: 'end-session-dialog-logout-icon'
|
||||||
@ -80,13 +78,11 @@ const logoutDialogContent = {
|
|||||||
|
|
||||||
const shutdownDialogContent = {
|
const shutdownDialogContent = {
|
||||||
subject: C_("title", "Power Off"),
|
subject: C_("title", "Power Off"),
|
||||||
inhibitedDescription: _("Click Power Off to quit these applications and power off the system."),
|
description: function(seconds) {
|
||||||
uninhibitedDescription: function(seconds) {
|
|
||||||
return ngettext("The system will power off automatically in %d second.",
|
return ngettext("The system will power off automatically in %d second.",
|
||||||
"The system will power off automatically in %d seconds.",
|
"The system will power off automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
},
|
},
|
||||||
endDescription: _("Powering off the system."),
|
|
||||||
confirmButtons: [{ signal: 'ConfirmedReboot',
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
label: C_("button", "Restart") },
|
label: C_("button", "Restart") },
|
||||||
{ signal: 'ConfirmedShutdown',
|
{ signal: 'ConfirmedShutdown',
|
||||||
@ -97,13 +93,11 @@ const shutdownDialogContent = {
|
|||||||
|
|
||||||
const restartDialogContent = {
|
const restartDialogContent = {
|
||||||
subject: C_("title", "Restart"),
|
subject: C_("title", "Restart"),
|
||||||
inhibitedDescription: _("Click Restart to quit these applications and restart the system."),
|
description: function(seconds) {
|
||||||
uninhibitedDescription: function(seconds) {
|
|
||||||
return ngettext("The system will restart automatically in %d second.",
|
return ngettext("The system will restart automatically in %d second.",
|
||||||
"The system will restart automatically in %d seconds.",
|
"The system will restart automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
},
|
},
|
||||||
endDescription: _("Restarting the system."),
|
|
||||||
confirmButtons: [{ signal: 'ConfirmedReboot',
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
label: C_("button", "Restart") }],
|
label: C_("button", "Restart") }],
|
||||||
iconName: 'view-refresh-symbolic',
|
iconName: 'view-refresh-symbolic',
|
||||||
@ -307,10 +301,6 @@ const EndSessionDialog = new Lang.Class({
|
|||||||
this._user.disconnect(this._userChangedId);
|
this._user.disconnect(this._userChangedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hasInhibitors: function() {
|
|
||||||
return (this._inhibitors.length > 0) || (this._sessions.length > 0);
|
|
||||||
},
|
|
||||||
|
|
||||||
_sync: function() {
|
_sync: function() {
|
||||||
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
|
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
|
||||||
if (!open)
|
if (!open)
|
||||||
@ -321,9 +311,6 @@ const EndSessionDialog = new Lang.Class({
|
|||||||
let subject = dialogContent.subject;
|
let subject = dialogContent.subject;
|
||||||
|
|
||||||
let description;
|
let description;
|
||||||
if (this._hasInhibitors()) {
|
|
||||||
description = dialogContent.inhibitedDescription;
|
|
||||||
} else if (this._secondsLeft > 0) {
|
|
||||||
let displayTime = _roundSecondsToInterval(this._totalSecondsToStayOpen,
|
let displayTime = _roundSecondsToInterval(this._totalSecondsToStayOpen,
|
||||||
this._secondsLeft,
|
this._secondsLeft,
|
||||||
10);
|
10);
|
||||||
@ -335,18 +322,15 @@ const EndSessionDialog = new Lang.Class({
|
|||||||
if (dialogContent.subjectWithUser)
|
if (dialogContent.subjectWithUser)
|
||||||
subject = dialogContent.subjectWithUser.format(realName);
|
subject = dialogContent.subjectWithUser.format(realName);
|
||||||
|
|
||||||
if (dialogContent.uninhibitedDescriptionWithUser)
|
if (dialogContent.descriptionWithUser)
|
||||||
description = dialogContent.uninhibitedDescriptionWithUser(realName, displayTime);
|
description = dialogContent.descriptionWithUser(realName, displayTime);
|
||||||
else
|
else
|
||||||
description = dialogContent.uninhibitedDescription(displayTime);
|
description = dialogContent.description(displayTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!description)
|
if (!description)
|
||||||
description = dialogContent.uninhibitedDescription(displayTime);
|
description = dialogContent.description(displayTime);
|
||||||
} else {
|
|
||||||
description = dialogContent.endDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
_setLabelText(this._descriptionLabel, description);
|
_setLabelText(this._descriptionLabel, description);
|
||||||
_setLabelText(this._subjectLabel, subject);
|
_setLabelText(this._subjectLabel, subject);
|
||||||
@ -363,11 +347,6 @@ const EndSessionDialog = new Lang.Class({
|
|||||||
this._iconBin.child = avatarWidget.actor;
|
this._iconBin.child = avatarWidget.actor;
|
||||||
avatarWidget.update();
|
avatarWidget.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._hasInhibitors())
|
|
||||||
this._stopTimer();
|
|
||||||
else
|
|
||||||
this._startTimer();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateButtons: function() {
|
_updateButtons: function() {
|
||||||
@ -551,6 +530,7 @@ const EndSessionDialog = new Lang.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._startTimer();
|
||||||
this._sync();
|
this._sync();
|
||||||
|
|
||||||
let signalId = this.connect('opened',
|
let signalId = this.connect('opened',
|
||||||
|
Loading…
Reference in New Issue
Block a user