[gnome-shell/wip/fmuellner/notification-redux+sass: 121/145] messageTray: Notify when notifications are acknowledged



commit 6f876f8a89512343d5fb67e55209ee9eab09c906
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 14 02:33:54 2015 +0100

    messageTray: Notify when notifications are acknowledged
    
    Source::count-updated is emitted as notifications are added or removed,
    which is correct for the primary notification count. However it is not
    for the unseen count, which will also change when a notification is
    acknowledged without being removed. At the moment this does not matter,
    as the unseen count is only used on the screen shield and notifications
    are never acknowledged while the screen is locked. However we will soon
    use the unseen count in the normal session as well, so emit the signal
    in this case too.

 js/ui/messageTray.js |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f94a46a..0646b32 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -480,7 +480,7 @@ const Notification = new Lang.Class({
         this.forFeedback = false;
         this.expanded = false;
         this.focused = false;
-        this.acknowledged = false;
+        this._acknowledged = false;
         this._destroyed = false;
         this._customContent = false;
         this.bannerBodyText = null;
@@ -821,6 +821,17 @@ const Notification = new Lang.Class({
         return this.addButton(button, callback);
     },
 
+    get acknowledged() {
+        return this._acknowledged;
+    },
+
+    set acknowledged(v) {
+        if (this._acknowledged == v)
+            return;
+        this._acknowledged = v;
+        this.emit('acknowledged-changed');
+    },
+
     setUrgency: function(urgency) {
         this.urgency = urgency;
     },
@@ -1291,6 +1302,7 @@ const Source = new Lang.Class({
             return;
 
         notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
+        notification.connect('acknowledged-changed', Lang.bind(this, this.countUpdated));
         this.notifications.push(notification);
         this.emit('notification-added', notification);
 


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