messageList: Directly take an GioIcon as image for a message

There is pretty much no value gained by allowing to use any actor to display
an image, so just don't allow it since it simplifies the code and CSS.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:
Julian Sparber
2024-02-20 17:03:57 +01:00
committed by Florian Müllner
parent cb1b54b954
commit ffaec5615a
4 changed files with 37 additions and 54 deletions

View File

@ -774,7 +774,7 @@ class NotificationMessage extends MessageList.Message {
this.notification = notification;
this.datetime = notification.datetime;
this.setIcon(this._getIcon());
this.setIcon(notification.gicon);
this.connect('close', () => {
this._closed = true;
@ -798,20 +798,9 @@ class NotificationMessage extends MessageList.Message {
});
}
_getIcon() {
const {gicon} = this.notification;
if (gicon) {
const styleClass =
gicon instanceof Gio.ThemedIcon ? 'message-themed-icon' : '';
return new St.Icon({gicon, styleClass});
} else {
return null;
}
}
_onUpdated(n, _clear) {
this.datetime = n.datetime;
this.setIcon(this._getIcon());
this.setIcon(n.gicon);
this.setTitle(n.title);
this.setBody(n.body);
this.setUseBodyMarkup(n.useBodyMarkup);