[gnome-shell] MessageTray: destroy notifications manually when the source is destroyed



commit ed0e8809138980f0c5ccc023808598a14d8e07ed
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Oct 25 18:30:27 2012 +0200

    MessageTray: destroy notifications manually when the source is destroyed
    
    Using a signal handlers causes us to depend on connection order, but
    we need the message tray code to run last, so it can notice that
    notifications are destroyed when hiding the boxpointer and skip
    the broken animation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686855

 js/ui/messageTray.js |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 6b297b7..bf333ec 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -404,11 +404,6 @@ const Notification = new Lang.Class({
         this._soundFile = null;
         this._soundPlayed = false;
 
-        source.connect('destroy', Lang.bind(this,
-            function (source, reason) {
-                this.destroy(reason);
-            }));
-
         this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
         this.actor.add_style_class_name('notification-unexpanded');
         this.actor._delegate = this;
@@ -1337,6 +1332,13 @@ const Source = new Lang.Class({
 
     destroy: function(reason) {
         this.policy.destroy();
+
+        let notifications = this.notifications;
+        this.notifications = [];
+
+        for (let i = 0; i < notifications.length; i++)
+            notifications[i].destroy(reason);
+
         this.emit('destroy', reason);
     },
 


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