From 484ef5f2f66edea92e831b0dcde31dd3fb07bf99 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sat, 19 Jan 2013 18:49:55 +0100 Subject: [PATCH] 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 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index bc9bb78f0..d33b80c45 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();