[gnome-shell/gnome-3-22] notificationDaemon: Keep source alive when replacing notification



commit df7727a82b195420d5871f1d05dc814f6085b6da
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 26 19:32:22 2016 +0100

    notificationDaemon: Keep source alive when replacing notification
    
    When a GNotification has the same ID as a previous one, it should
    be shown as a new notification after withdrawing the old one.
    However for this to work, we must not destroy the corresponding
    source if withdrawing the old notification lets the notification
    count drop to zero, so make sure the source is kept alive until
    the replace operation has completed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775149

 js/ui/notificationDaemon.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 9e942b4..3e68460 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -690,6 +690,7 @@ const GtkNotificationDaemonAppSource = new Lang.Class({
             throw new InvalidAppError();
 
         this._notifications = {};
+        this._notificationPending = false;
 
         this.parent(this._app.get_name());
     },
@@ -723,6 +724,8 @@ const GtkNotificationDaemonAppSource = new Lang.Class({
     },
 
     addNotification: function(notificationId, notificationParams, showBanner) {
+        this._notificationPending = true;
+
         if (this._notifications[notificationId])
             this._notifications[notificationId].destroy();
 
@@ -736,6 +739,14 @@ const GtkNotificationDaemonAppSource = new Lang.Class({
             this.notify(notification);
         else
             this.pushNotification(notification);
+
+        this._notificationPending = false;
+    },
+
+    destroy: function(reason) {
+        if (this._notificationPending)
+            return;
+        this.parent(reason);
     },
 
     removeNotification: function(notificationId) {


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