[gnome-shell/wip/notif-d2: 17/18] nn



commit b7c39047cbb3783b8f69653fb5d174dcb580548a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 12 16:09:48 2014 -0400

    nn

 js/ui/messageTray.js |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index c8d6f28..8435e74 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -925,20 +925,30 @@ const OverlayNotificationController = new Lang.Class({
         this._notification = notification;
 
         this._notificationHoveredId = this._notification.actor.connect('notify::hover', Lang.bind(this, 
this._sync));
-        this._notification.connect('destroy', Lang.bind(this, this.destroy));
+        this._notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
         this._timeoutId = 0;
 
         this._idleMonitor = Meta.IdleMonitor.get_core();
     },
 
-    destroy: function() {
+    _done: function() {
         this._notification.actor.disconnect(this._notificationHoveredId);
+        this._notificationHoveredId = 0;
+    },
+
+    _onNotificationDestroy: function() {
+        this._done();
+    },
+
+    _onHideComplete: function() {
+        this._done();
+        this.emit('hidden');
     },
 
     _hide: function() {
         Tweener.addTween(this._notification.actor, { opacity: 0,
                                                      time: 1,
-                                                     onComplete: Lang.bind(this, this.destroy) });
+                                                     onComplete: Lang.bind(this, this._onHideComplete) });
     },
 
     _removeHideTimeout: function() {
@@ -975,6 +985,7 @@ const OverlayNotificationController = new Lang.Class({
         }
     },
 });
+Signals.addSignalMethods(OverlayNotificationController.prototype);
 
 const MessageTray = new Lang.Class({
     Name: 'MessageTray',
@@ -1064,6 +1075,10 @@ const MessageTray = new Lang.Class({
     _onNotify: function(source, notification) {
         this._overlayBox.add_child(notification.actor);
         let controller = new OverlayNotificationController(notification);
+        controller.connect('hidden', Lang.bind(this, function() {
+            this._overlayBox.remove_child(notification.actor);
+            // XXX: Put the notification in the sidebar.
+        }));
         controller.show();
     },
 });


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