[gnome-shell] messageTray: Support setImage(null) to mean unsetImage()



commit 155f9dc1b1b716436e03f09a6e100f812166c3b4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Dec 30 11:36:48 2012 -0500

    messageTray: Support setImage(null) to mean unsetImage()
    
    This is a quick API change that should clean up some conditionals.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680414

 js/ui/messageTray.js        |    2 ++
 js/ui/notificationDaemon.js |    6 ++----
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index ec93ce8..517e7a9 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -611,6 +611,8 @@ const Notification = new Lang.Class({
     setImage: function(image) {
         if (this._imageBin)
             this.unsetImage();
+        if (!image)
+            return;
         this._imageBin = new St.Bin();
         this._imageBin.child = image;
         this._imageBin.opacity = 230;
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 3aa8668..1b24883 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -388,8 +388,8 @@ const NotificationDaemon = new Lang.Class({
                                              clear: true });
 
         // We only display a large image if an icon is also specified.
+        let image = null;
         if (icon && (hints['image-data'] || hints['image-path'])) {
-            let image = null;
             if (hints['image-data']) {
                 let [width, height, rowStride, hasAlpha,
                  bitsPerSample, nChannels, data] = hints['image-data'];
@@ -400,10 +400,8 @@ const NotificationDaemon = new Lang.Class({
                                                                      notification.IMAGE_SIZE,
                                                                      notification.IMAGE_SIZE);
             }
-            notification.setImage(image);
-        } else {
-            notification.unsetImage();
         }
+        notification.setImage(image);
 
         if (actions.length) {
             notification.setUseActionIcons(hints['action-icons'] == true);



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