notifications: Introduce MessageList.Source object
This object contains only the `title` and `icon` of a `MessageTray.Source` which allows using it for sources that aren't notification sources like mpris. The old `MessageTray.Source` isn't renamed to something less generic to not break API. Once we have a good reason we should rename it to something more specific. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3103>
This commit is contained in:

committed by
Marge Bot

parent
932ccac1c2
commit
ff76584937
@@ -306,6 +306,34 @@ const LabelExpanderLayout = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
export const Source = GObject.registerClass({
|
||||
Properties: {
|
||||
'title': GObject.ParamSpec.string(
|
||||
'title', 'title', 'title',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
null),
|
||||
'icon': GObject.ParamSpec.object(
|
||||
'icon', 'icon', 'icon',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
Gio.Icon),
|
||||
'icon-name': GObject.ParamSpec.string(
|
||||
'icon-name', 'icon-name', 'icon-name',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
null),
|
||||
},
|
||||
}, class Source extends GObject.Object {
|
||||
get iconName() {
|
||||
if (this.gicon instanceof Gio.ThemedIcon)
|
||||
return this.gicon.iconName;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
set iconName(iconName) {
|
||||
this.icon = new Gio.ThemedIcon({name: iconName});
|
||||
}
|
||||
});
|
||||
|
||||
const TimeLabel = GObject.registerClass(
|
||||
class TimeLabel extends St.Label {
|
||||
_init() {
|
||||
|
Reference in New Issue
Block a user