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
This commit is contained in:
Giovanni Campagna 2013-01-19 18:49:55 +01:00
parent cdd354739a
commit 484ef5f2f6

View File

@ -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();
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();