[gnome-shell] MessageTray: simplify image handling



commit 484ef5f2f66edea92e831b0dcde31dd3fb07bf99
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jan 19 18:49:55 2013 +0100

    MessageTray: simplify image handling
    
    Remove duplicate checks before calling unsetImage, and set properties
    directly in the constructor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692091

 js/ui/messageTray.js |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index bc9bb78..d33b80c 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -429,7 +429,7 @@ const Notification = new Lang.Class({
             this._actionArea = null;
             this._buttonBox = null;
         }
-        if (this._imageBin && params.clear)
+        if (params.clear)
             this.unsetImage();
 
         if (!this._scrollArea && !this._actionArea && !this._imageBin)
@@ -609,13 +609,14 @@ const Notification = new Lang.Class({
     },
 
     setImage: function(image) {
-        if (this._imageBin)
-            this.unsetImage();
+        this.unsetImage();
+
         if (!image)
             return;
-        this._imageBin = new St.Bin();
-        this._imageBin.child = image;
-        this._imageBin.opacity = 230;
+
+        this._imageBin = new St.Bin({ opacity: 230,
+                                      child: image });
+
         this._table.add_style_class_name('multi-line-notification');
         this._table.add_style_class_name('notification-with-image');
         this._addBannerBody();



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