[gnome-shell/wip/gtk-notification: 7/22] messageTray: Split out the	notification's destroy handler
- From: Jasper St. Pierre <jstpierre src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-shell/wip/gtk-notification: 7/22] messageTray: Split out the	notification's destroy handler
 
- Date: Mon, 14 Oct 2013 13:54:14 +0000 (UTC)
 
commit 8e1ce14ef02ad67c2183d9358043450987a63720
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Oct 13 21:52:44 2013 -0400
    messageTray: Split out the notification's destroy handler
    
    This is complex enough to split out.
 js/ui/messageTray.js |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 38b109e..0e23738 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1401,23 +1401,24 @@ const Source = new Lang.Class({
         return this._mainIcon.actor;
     },
 
+    _onNotificationDestroy: function(notification) {
+        let index = this.notifications.indexOf(notification);
+        if (index < 0)
+            return;
+
+        this.notifications.splice(index, 1);
+        if (this.notifications.length == 0)
+            this._lastNotificationRemoved();
+
+        this.countUpdated();
+    },
+
     pushNotification: function(notification) {
         if (this.notifications.indexOf(notification) >= 0)
             return;
 
         notification.connect('clicked', Lang.bind(this, this.open));
-        notification.connect('destroy', Lang.bind(this,
-            function () {
-                let index = this.notifications.indexOf(notification);
-                if (index < 0)
-                    return;
-
-                this.notifications.splice(index, 1);
-                if (this.notifications.length == 0)
-                    this._lastNotificationRemoved();
-
-                this.countUpdated();
-            }));
+        notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
 
         this.notifications.push(notification);
         this.emit('notification-added', notification);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]