[gnome-shell] messageTray: Use the count to display the number of unread notifications



commit 40f4e92461855760a6c96243ddaeacd59cc7f507
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jun 24 15:47:24 2011 -0400

    messageTray: Use the count to display the number of unread notifications
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649356

 js/ui/messageTray.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index dd4049f..a29dede 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -948,6 +948,11 @@ Source.prototype = {
         this._counterLabel.set_text(count.toString());
     },
 
+    _updateCount: function() {
+        let count = this.notifications.length;
+        this._setCount(count, count > 1);
+    },
+
     setTransient: function(isTransient) {
         this.isTransient = isTransient;
     },
@@ -986,7 +991,11 @@ Source.prototype = {
                 this.notifications.splice(index, 1);
                 if (this.notifications.length == 0)
                     this._lastNotificationRemoved();
+
+                this._updateCount();
             }));
+
+        this._updateCount();
     },
 
     notify: function(notification) {
@@ -1023,6 +1032,8 @@ Source.prototype = {
         for (let i = this.notifications.length - 1; i >= 0; i--)
             if (!this.notifications[i].resident)
                 this.notifications[i].destroy();
+
+        this._updateCount();
     },
 
     // Default implementation is to destroy this source, but subclasses can override



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