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 {
return _timeout;
}
set {
_timeout = value < 1 ? TIMEOUT_DEFAULT : value;
_timeout = value < 0 ? TIMEOUT_DEFAULT : value;
}
}
......@@ -299,19 +299,7 @@ namespace SwayNotificationCenter {
return _timeout_low;
}
set {
_timeout_low = value < 1 ? 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;
_timeout_low = value < 0 ? TIMEOUT_LOW_DEFAULT : value;
}
}
......@@ -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
* and block keyboard input for other applications while open
......
......@@ -474,19 +474,18 @@ namespace SwayNotificationCenter {
timeout = timeout_delay * 1000;
break;
case UrgencyLevels.CRITICAL:
if (timeout_critical_delay == 0) {
return;
}
// Critical notifications should not automatically expire.
// Ignores the notifications expire_timeout.
if (timeout_critical_delay == 0) return;
timeout = timeout_critical_delay * 1000;
break;
}
uint ms = param.expire_timeout > 0 ? param.expire_timeout : timeout;
if (ms != 0) {
timeout_id = Timeout.add (ms, () => {
close_notification (true);
return GLib.Source.REMOVE;
});
}
if (ms <= 0) return;
timeout_id = Timeout.add (ms, () => {
close_notification (true);
return GLib.Source.REMOVE;
});
}
public void remove_noti_timeout () {
......
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