[gnome-shell/wip/fmuellner/notification-redux: 126/128] messageTray: Handle secondary icons and updates



commit 4155ac50e5cd4ffdf30a6ac1f818ffac97236c45
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 17 05:01:48 2015 +0100

    messageTray: Handle secondary icons and updates

 js/ui/messageTray.js |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 2927b2d..b047baa 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -513,10 +513,8 @@ const NotificationBanner = new Lang.Class({
 
         this._buttonBox = null;
 
-        this.notification.actions.forEach(Lang.bind(this,
-            function(action) {
-                this.addAction(action.label, action.callback);
-            }));
+        this._addActions();
+        this._addSecondaryIcon();
 
         this._activatedId = this.notification.connect('activated',
             Lang.bind(this, function() {
@@ -532,6 +530,33 @@ const NotificationBanner = new Lang.Class({
         this.notification.disconnect(this._activatedId);
     },
 
+    _onUpdated: function(n, clear) {
+        this.parent(n, clear);
+
+        if (clear) {
+            this.setSecondaryActor(null);
+            this.setActionArea(null);
+            this._buttonBox = null;
+        }
+
+        this._addActions();
+        this._addSecondaryIcon();
+    },
+
+    _addActions: function() {
+        this.notification.actions.forEach(Lang.bind(this,
+            function(action) {
+                this.addAction(action.label, action.callback);
+            }));
+    },
+
+    _addSecondaryIcon: function() {
+        if (this.notification.secondaryGIcon) {
+            let icon = new St.Icon({ gicon: this.notification.secondaryGIcon });
+            this.setSecondaryActor(icon);
+        }
+    },
+
     addButton: function(button, callback) {
         if (!this._buttonBox) {
             this._buttonBox = new St.BoxLayout({ style_class: 'notification-actions',


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