breakManager: Clarify some nextBreakType variables
This doesn’t introduce any functional changes, as `this._manager.currentBreakType` is set to the value returned by `this._manager.getNextBreakDue()` when entering `BreakState.BREAK_DUE`. However, it should make the code a little clearer as now the code refers to the ’next’ break type rather than the ‘current’ one in the context of an upcoming break. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3687>
This commit is contained in:
@@ -1190,11 +1190,11 @@ class BreakNotificationSource extends GObject.Object {
|
|||||||
if ((this._previousState === BreakState.ACTIVE ||
|
if ((this._previousState === BreakState.ACTIVE ||
|
||||||
this._previousState === BreakState.DISABLED) &&
|
this._previousState === BreakState.DISABLED) &&
|
||||||
breakDueAgo < BREAK_OVERDUE_TIME_SECONDS) {
|
breakDueAgo < BREAK_OVERDUE_TIME_SECONDS) {
|
||||||
const durationSecs = this._manager.getDurationForBreakType(this._manager.currentBreakType);
|
const durationSecs = this._manager.getDurationForBreakType(nextBreakType);
|
||||||
const [durationText, durationValue, unused] = this._formatTimeSpan(durationSecs);
|
const [durationText, durationValue, unused] = this._formatTimeSpan(durationSecs);
|
||||||
|
|
||||||
let titleText, bodyText;
|
let titleText, bodyText;
|
||||||
switch (this._manager.currentBreakType) {
|
switch (nextBreakType) {
|
||||||
case 'movement':
|
case 'movement':
|
||||||
titleText = _('Time for a Movement Break');
|
titleText = _('Time for a Movement Break');
|
||||||
bodyText = Gettext.ngettext(
|
bodyText = Gettext.ngettext(
|
||||||
@@ -1255,7 +1255,7 @@ class BreakNotificationSource extends GObject.Object {
|
|||||||
|
|
||||||
this._scheduleUpdateState(updateTimeoutSeconds);
|
this._scheduleUpdateState(updateTimeoutSeconds);
|
||||||
} else if (this._previousState === BreakState.IN_BREAK) {
|
} else if (this._previousState === BreakState.IN_BREAK) {
|
||||||
const durationSecs = this._manager.getDurationForBreakType(this._manager.currentBreakType);
|
const durationSecs = this._manager.getDurationForBreakType(nextBreakType);
|
||||||
const [countdownText, countdownValue, updateTimeoutSeconds] = this._formatTimeSpan(durationSecs - breakDueAgo);
|
const [countdownText, countdownValue, updateTimeoutSeconds] = this._formatTimeSpan(durationSecs - breakDueAgo);
|
||||||
const bodyText = Gettext.ngettext(
|
const bodyText = Gettext.ngettext(
|
||||||
/* %s will be replaced with a string that describes a time interval, such as “2 minutes”, “40 seconds” or “1 hour” */
|
/* %s will be replaced with a string that describes a time interval, such as “2 minutes”, “40 seconds” or “1 hour” */
|
||||||
|
Reference in New Issue
Block a user