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:
parent
fe7ee1edc3
commit
155f9dc1b1
@ -611,6 +611,8 @@ const Notification = new Lang.Class({
|
|||||||
setImage: function(image) {
|
setImage: function(image) {
|
||||||
if (this._imageBin)
|
if (this._imageBin)
|
||||||
this.unsetImage();
|
this.unsetImage();
|
||||||
|
if (!image)
|
||||||
|
return;
|
||||||
this._imageBin = new St.Bin();
|
this._imageBin = new St.Bin();
|
||||||
this._imageBin.child = image;
|
this._imageBin.child = image;
|
||||||
this._imageBin.opacity = 230;
|
this._imageBin.opacity = 230;
|
||||||
|
@ -388,8 +388,8 @@ const NotificationDaemon = new Lang.Class({
|
|||||||
clear: true });
|
clear: true });
|
||||||
|
|
||||||
// We only display a large image if an icon is also specified.
|
// We only display a large image if an icon is also specified.
|
||||||
|
let image = null;
|
||||||
if (icon && (hints['image-data'] || hints['image-path'])) {
|
if (icon && (hints['image-data'] || hints['image-path'])) {
|
||||||
let image = null;
|
|
||||||
if (hints['image-data']) {
|
if (hints['image-data']) {
|
||||||
let [width, height, rowStride, hasAlpha,
|
let [width, height, rowStride, hasAlpha,
|
||||||
bitsPerSample, nChannels, data] = hints['image-data'];
|
bitsPerSample, nChannels, data] = hints['image-data'];
|
||||||
@ -400,10 +400,8 @@ const NotificationDaemon = new Lang.Class({
|
|||||||
notification.IMAGE_SIZE,
|
notification.IMAGE_SIZE,
|
||||||
notification.IMAGE_SIZE);
|
notification.IMAGE_SIZE);
|
||||||
}
|
}
|
||||||
notification.setImage(image);
|
|
||||||
} else {
|
|
||||||
notification.unsetImage();
|
|
||||||
}
|
}
|
||||||
|
notification.setImage(image);
|
||||||
|
|
||||||
if (actions.length) {
|
if (actions.length) {
|
||||||
notification.setUseActionIcons(hints['action-icons'] == true);
|
notification.setUseActionIcons(hints['action-icons'] == true);
|
||||||
|
Loading…
Reference in New Issue
Block a user