messageTray: Introduce singleton Source for system notifications
This `Source` object should be used by all notifications created by GNOME Shell and eventually can also be used by extensions. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3156>
This commit is contained in:
parent
daa8ea5ab2
commit
3faf1caead
@ -1326,6 +1326,29 @@ export const MessageTray = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
let systemNotificationSource = null;
|
||||
|
||||
/**
|
||||
* The {Source} that should be used to send system notifications.
|
||||
*
|
||||
* @returns {Source}
|
||||
*/
|
||||
export function getSystemSource() {
|
||||
if (!systemNotificationSource) {
|
||||
systemNotificationSource = new Source({
|
||||
title: _('System'),
|
||||
iconName: 'emblem-system-symbolic',
|
||||
});
|
||||
|
||||
systemNotificationSource.connect('destroy', () => {
|
||||
systemNotificationSource = null;
|
||||
});
|
||||
Main.messageTray.add(systemNotificationSource);
|
||||
}
|
||||
|
||||
return systemNotificationSource;
|
||||
}
|
||||
|
||||
export const SystemNotificationSource = GObject.registerClass(
|
||||
class SystemNotificationSource extends Source {
|
||||
constructor() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user