Unverified Commit 9133a765 authored by Erik Reider's avatar Erik Reider Committed by GitHub

All notification urgencies can now use 0 as timeout to not expire (#158)

parent 3bc2b5e5
...@@ -287,7 +287,7 @@ namespace SwayNotificationCenter { ...@@ -287,7 +287,7 @@ namespace SwayNotificationCenter {
return _timeout; return _timeout;
} }
set { set {
_timeout = value < 1 ? TIMEOUT_DEFAULT : value; _timeout = value < 0 ? TIMEOUT_DEFAULT : value;
} }
} }
...@@ -299,19 +299,7 @@ namespace SwayNotificationCenter { ...@@ -299,19 +299,7 @@ namespace SwayNotificationCenter {
return _timeout_low; return _timeout_low;
} }
set { set {
_timeout_low = value < 1 ? TIMEOUT_LOW_DEFAULT : value; _timeout_low = value < 0 ? TIMEOUT_LOW_DEFAULT : value;
}
}
/** The transition time for all animations */
private const int TRANSITION_TIME_DEFAULT = 200;
private int _transition_time = TRANSITION_TIME_DEFAULT;
public int transition_time {
get {
return _transition_time;
}
set {
_transition_time = value < 0 ? TRANSITION_TIME_DEFAULT : value;
} }
} }
...@@ -327,6 +315,18 @@ namespace SwayNotificationCenter { ...@@ -327,6 +315,18 @@ namespace SwayNotificationCenter {
} }
} }
/** The transition time for all animations */
private const int TRANSITION_TIME_DEFAULT = 200;
private int _transition_time = TRANSITION_TIME_DEFAULT;
public int transition_time {
get {
return _transition_time;
}
set {
_transition_time = value < 0 ? TRANSITION_TIME_DEFAULT : value;
}
}
/* /*
* Specifies if the control center should use keyboard shortcuts * Specifies if the control center should use keyboard shortcuts
* and block keyboard input for other applications while open * and block keyboard input for other applications while open
......
...@@ -474,20 +474,19 @@ namespace SwayNotificationCenter { ...@@ -474,20 +474,19 @@ namespace SwayNotificationCenter {
timeout = timeout_delay * 1000; timeout = timeout_delay * 1000;
break; break;
case UrgencyLevels.CRITICAL: case UrgencyLevels.CRITICAL:
if (timeout_critical_delay == 0) { // Critical notifications should not automatically expire.
return; // Ignores the notifications expire_timeout.
} if (timeout_critical_delay == 0) return;
timeout = timeout_critical_delay * 1000; timeout = timeout_critical_delay * 1000;
break; break;
} }
uint ms = param.expire_timeout > 0 ? param.expire_timeout : timeout; uint ms = param.expire_timeout > 0 ? param.expire_timeout : timeout;
if (ms != 0) { if (ms <= 0) return;
timeout_id = Timeout.add (ms, () => { timeout_id = Timeout.add (ms, () => {
close_notification (true); close_notification (true);
return GLib.Source.REMOVE; return GLib.Source.REMOVE;
}); });
} }
}
public void remove_noti_timeout () { public void remove_noti_timeout () {
if (timeout_id > 0) { if (timeout_id > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment