messageTray: Support setting notification icon by name

Since we now display the source icon and an image for the notification,
it's quite common to set an icon from a name. Therefore add a
convenience property to do so.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3156>
This commit is contained in:
Julian Sparber 2024-01-27 14:18:41 +01:00 committed by Marge Bot
parent 4c5cb191d8
commit daa8ea5ab2

View File

@ -431,6 +431,17 @@ export const Notification = GObject.registerClass({
this.emit('updated', params.clear);
}
get iconName() {
if (this.gicon instanceof Gio.ThemedIcon)
return this.gicon.iconName;
else
return null;
}
set iconName(iconName) {
this.gicon = new Gio.ThemedIcon({name: iconName});
}
// addAction:
// @label: the label for the action's button
// @callback: the callback for the action