From 01a57206bc18f1045a829d92485fa04d3e9d67e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 23 Mar 2020 20:59:31 +0100 Subject: [PATCH] messageTray: Don't create notification policy on demand This was changed in commit 8f15193b4 as a work-around for an ES6 class limitation, but now that Sources are GObject subclasses, we no longer need to use that somewhat surprising pattern. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1131 --- js/ui/components/telepathyClient.js | 4 ++-- js/ui/messageTray.js | 4 +--- js/ui/notificationDaemon.js | 8 ++++---- js/ui/windowAttentionHandler.js | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 5a65e84e8..b4af4388e 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -292,12 +292,12 @@ class TelepathyClient extends Tp.BaseClient { var ChatSource = HAVE_TP ? GObject.registerClass( class ChatSource extends MessageTray.Source { _init(account, conn, channel, contact, client) { - super._init(contact.get_alias()); - this._account = account; this._contact = contact; this._client = client; + super._init(contact.get_alias()); + this.isChat = true; this._pendingMessages = []; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index f949345be..fffdc786d 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -762,12 +762,10 @@ var Source = GObject.registerClass({ this.notifications = []; - this._policy = null; + this._policy = this._createPolicy(); } get policy() { - if (!this._policy) - this._policy = this._createPolicy(); return this._policy; } diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 0133affd9..3331355ab 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -416,11 +416,11 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { var FdoNotificationDaemonSource = GObject.registerClass( class FdoNotificationDaemonSource extends MessageTray.Source { _init(title, pid, sender, appId) { - super._init(title); - this.pid = pid; this.app = this._getApp(appId); + super._init(title); + this.initialTitle = title; if (this.app) @@ -631,12 +631,12 @@ class GtkNotificationDaemonAppSource extends MessageTray.Source { if (!app) throw new InvalidAppError(); - super._init(app.get_name()); - this._appId = appId; this._app = app; this._objectPath = objectPath; + super._init(app.get_name()); + this._notifications = {}; this._notificationPending = false; } diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js index f95ce4bc7..346fad88d 100644 --- a/js/ui/windowAttentionHandler.js +++ b/js/ui/windowAttentionHandler.js @@ -57,11 +57,11 @@ var WindowAttentionHandler = class { var WindowAttentionSource = GObject.registerClass( class WindowAttentionSource extends MessageTray.Source { _init(app, window) { - super._init(app.get_name()); - this._window = window; this._app = app; + super._init(app.get_name()); + this.signalIDs = []; this.signalIDs.push(this._window.connect('notify::demands-attention', this._sync.bind(this)));