messageTray: Split out the notification's destroy handler
This is complex enough to split out. https://bugzilla.gnome.org/show_bug.cgi?id=710115
This commit is contained in:
parent
99cf4e5787
commit
25fd23e703
@ -1406,13 +1406,7 @@ const Source = new Lang.Class({
|
|||||||
return this._mainIcon.actor;
|
return this._mainIcon.actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
pushNotification: function(notification) {
|
_onNotificationDestroy: function(notification) {
|
||||||
if (this.notifications.indexOf(notification) >= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
notification.connect('clicked', Lang.bind(this, this.open));
|
|
||||||
notification.connect('destroy', Lang.bind(this,
|
|
||||||
function () {
|
|
||||||
let index = this.notifications.indexOf(notification);
|
let index = this.notifications.indexOf(notification);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
@ -1422,7 +1416,14 @@ const Source = new Lang.Class({
|
|||||||
this._lastNotificationRemoved();
|
this._lastNotificationRemoved();
|
||||||
|
|
||||||
this.countUpdated();
|
this.countUpdated();
|
||||||
}));
|
},
|
||||||
|
|
||||||
|
pushNotification: function(notification) {
|
||||||
|
if (this.notifications.indexOf(notification) >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
notification.connect('clicked', Lang.bind(this, this.open));
|
||||||
|
notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
|
||||||
|
|
||||||
this.notifications.push(notification);
|
this.notifications.push(notification);
|
||||||
this.emit('notification-added', notification);
|
this.emit('notification-added', notification);
|
||||||
|
Loading…
Reference in New Issue
Block a user