[gnome-shell/wip/fmuellner/notification-redux: 114/128] calendar: Clean up NotificationMessage a bit



commit ede006cb1f70c3942408ba951d479a7451525abf
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 17 02:52:59 2015 +0100

    calendar: Clean up NotificationMessage a bit

 js/ui/calendar.js |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 7509e1f..04b347d 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -1299,33 +1299,32 @@ const NotificationMessage = new Lang.Class({
     Extends: Message,
 
     _init: function(notification) {
+        this.notification = notification;
+
         this.setUseBodyMarkup(notification.bannerBodyMarkup);
         this.parent(notification.title, notification.bannerBodyText);
 
-        let gicon = null;
-        if (notification._iconBin.child)
-            gicon = notification._iconBin.child.gicon;
         let icon;
-        if (gicon)
-            icon = new St.Icon({ gicon: gicon, icon_size: 48 });
+        if (notification.gicon)
+            icon = new St.Icon({ gicon: notification.gicon, icon_size: 48 });
         else
-            icon = source.createIcon(48);
+            icon = notification.source.createIcon(48);
 
         this.setIcon(icon);
 
-        this.notification = notification;
-
         this.actor.connect('clicked', Lang.bind(this,
             function() {
-                notification._onClicked();
+                this.notification.activate();
             }));
         this.connect('close', Lang.bind(this,
             function() {
+                this._closed = true;
                 this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
             }));
         this.notification.connect('destroy', Lang.bind(this,
             function() {
-                this.emit('close');
+                if (!this._closed)
+                    this.emit('close');
             }));
     },
 


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