[gnome-shell/wip/gtk-notification: 6/22] messageTray: Only connect to a notification's open/destroy once
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/gtk-notification: 6/22] messageTray: Only connect to a notification's open/destroy once
- Date: Mon, 14 Oct 2013 13:54:09 +0000 (UTC)
commit 4de93c1fb157be19d2cca1bf7c2ff6199cb0d6f4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Oct 13 21:51:30 2013 -0400
messageTray: Only connect to a notification's open/destroy once
If we pushNotification the same notification multiple times, we
won't append it to the array again, but we will attach multiple
handlers needlessly.
js/ui/messageTray.js | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 8661f85..38b109e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1402,10 +1402,8 @@ const Source = new Lang.Class({
},
pushNotification: function(notification) {
- if (this.notifications.indexOf(notification) < 0) {
- this.notifications.push(notification);
- this.emit('notification-added', notification);
- }
+ if (this.notifications.indexOf(notification) >= 0)
+ return;
notification.connect('clicked', Lang.bind(this, this.open));
notification.connect('destroy', Lang.bind(this,
@@ -1421,6 +1419,9 @@ const Source = new Lang.Class({
this.countUpdated();
}));
+ this.notifications.push(notification);
+ this.emit('notification-added', notification);
+
this.countUpdated();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]