From 25756332724628b48576dd38818f1d0be2ffe85f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 7 Jun 2024 16:13:54 +0100 Subject: [PATCH] fixup! breakManager: Add new state machine for screen time/health breaks --- js/misc/breakManager.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/js/misc/breakManager.js b/js/misc/breakManager.js index c5a5b0339..9ae06761b 100644 --- a/js/misc/breakManager.js +++ b/js/misc/breakManager.js @@ -826,8 +826,10 @@ class BreakNotificationSource extends MessageTray.Source { this._notification = null; this._timerId = 0; this._manager = manager; - this._notifyStateId = this._manager.connect('notify::state', this._onStateChanged.bind(this)); - this._notifyNextId = this._manager.connect('notify::next-break-due-time', this._onStateChanged.bind(this)); + this._manager.connectObject( + 'notify::state', this._onStateChanged.bind(this), + 'notify::next-break-due-time', this._onStateChanged.bind(this), + this); this.connect('destroy', this._onDestroy.bind(this)); this._previousState = BreakState.DISABLED; @@ -844,12 +846,7 @@ class BreakNotificationSource extends MessageTray.Source { GLib.source_remove(this._timerId); this._timerId = 0; - if (this._manager != null && this._notifyStateId !== 0) - this._manager.disconnect(this._notifyStateId); - this._notifyStateId = 0; - if (this._manager != null && this._notifyNextId !== 0) - this._manager.disconnect(this._notifyNextId); - this._notifyNextId = 0; + this._manager?.disconnectObject(this); this._manager = null; }