[geary: 2/3] Don't show brief notifications when brief-notification-duration is 0



commit 0d7e94b880a731ffcc6b7c5dff004a86586af9f7
Author: Adam Dingle <adam medovina org>
Date:   Tue Jan 21 11:54:59 2020 +0100

    Don't show brief notifications when brief-notification-duration is 0

 src/client/components/components-in-app-notification.vala | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/client/components/components-in-app-notification.vala 
b/src/client/components/components-in-app-notification.vala
index 565e3974..fd5a7797 100644
--- a/src/client/components/components-in-app-notification.vala
+++ b/src/client/components/components-in-app-notification.vala
@@ -26,8 +26,12 @@ public class Components.InAppNotification : Gtk.Revealer {
      * @param message The message that should be displayed.
      * @param keepalive The amount of seconds that the notification should stay visible.
      */
-    public InAppNotification(string message, uint keepalive = 0) {
-        if (keepalive == 0)
+    public InAppNotification(string message, uint keepalive = -1) {
+        if (keepalive == 0) {
+            this.message_label.label = "";
+            return;   // skip the notification
+        }
+        if (keepalive == -1)
             keepalive = DEFAULT_KEEPALIVE;
         this.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN;
         this.message_label.label = message;
@@ -46,8 +50,10 @@ public class Components.InAppNotification : Gtk.Revealer {
     }
 
     public override void show() {
-        base.show();
-        this.reveal_child = true;
+        if (this.message_label.label != "") {
+            base.show();
+            this.reveal_child = true;
+        }
     }
 
     /**


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