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
This commit is contained in:
Jasper St. Pierre 2012-12-30 11:36:48 -05:00
parent fe7ee1edc3
commit 155f9dc1b1
2 changed files with 4 additions and 4 deletions

View File

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

View File

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