[gnome-break-timer] Don't run "skip" breaks when they are are disabled



commit 95b7b95e2f43d9eb012fe26f2a79c5ee07b28034
Author: Dylan McCall <dylan dylanmccall ca>
Date:   Thu Nov 19 19:27:52 2020 -0800

    Don't run "skip" breaks when they are are disabled
    
    This was causing odd behaviour when stale notifications were closed.

 src/daemon/break/BreakController.vala | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/daemon/break/BreakController.vala b/src/daemon/break/BreakController.vala
index 142bcf6..b730099 100644
--- a/src/daemon/break/BreakController.vala
+++ b/src/daemon/break/BreakController.vala
@@ -181,9 +181,15 @@ public abstract class BreakController : GLib.Object {
      * @param forget_start true to reset the value returned by get_seconds_since_start
      */
     public void skip (bool forget_start = false) {
+        if (this.state == State.DISABLED) {
+            return;
+        }
+
         bool was_active = this.is_active ();
         this.state = State.WAITING;
-        if (forget_start) this.activate_timestamp = null;
+        if (forget_start) {
+            this.activate_timestamp = null;
+        }
         this.finished (BreakController.FinishedReason.SKIPPED, was_active);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]