message-tray: Really close notifications when the close button is clicked

When the user eclipictly closes a notification, we should really destroy
it not just move it to the tray.

https://bugzilla.gnome.org/show_bug.cgi?id=687016
This commit is contained in:
Adel Gadllah 2013-07-22 17:09:27 +02:00
parent 1a0415a100
commit f4100ac507

View File

@ -1424,6 +1424,10 @@ const SummaryItem = new Lang.Class({
this.notificationStackWidget.add_actor(this.notificationStackView); this.notificationStackWidget.add_actor(this.notificationStackView);
this.closeButton = Util.makeCloseButton(); this.closeButton = Util.makeCloseButton();
this.closeButton.connect('clicked', Lang.bind(this, function() {
source.destroy();
source.emit('done-displaying-content');
}));
this.notificationStackWidget.add_actor(this.closeButton); this.notificationStackWidget.add_actor(this.closeButton);
this._stackedNotifications = []; this._stackedNotifications = [];
@ -1915,9 +1919,8 @@ const MessageTray = new Lang.Class({
_closeNotification: function() { _closeNotification: function() {
if (this._notificationState == State.SHOWN) { if (this._notificationState == State.SHOWN) {
this._closeButton.hide(); this._closeButton.hide();
this._notificationClosed = true; this._notification.emit('done-displaying');
this._updateState(); this._notification.destroy();
this._notificationClosed = false;
} }
}, },
@ -2698,11 +2701,9 @@ const MessageTray = new Lang.Class({
let closeButton = summaryItem.closeButton; let closeButton = summaryItem.closeButton;
closeButton.show(); closeButton.show();
this._summaryBoxPointerCloseClickedId = closeButton.connect('clicked', Lang.bind(this, this._hideSummaryBoxPointer));
summaryItem.prepareNotificationStackForShowing(); summaryItem.prepareNotificationStackForShowing();
} else if (this._clickedSummaryItemMouseButton == 3) { } else if (this._clickedSummaryItemMouseButton == 3) {
child = summaryItem.rightClickMenu; child = summaryItem.rightClickMenu;
this._summaryBoxPointerCloseClickedId = 0;
} }
// If the user clicked the middle mouse button, or the item // If the user clicked the middle mouse button, or the item
@ -2796,10 +2797,7 @@ const MessageTray = new Lang.Class({
this._summaryBoxPointerItem.disconnect(this._summaryBoxPointerContentUpdatedId); this._summaryBoxPointerItem.disconnect(this._summaryBoxPointerContentUpdatedId);
this._summaryBoxPointerContentUpdatedId = 0; this._summaryBoxPointerContentUpdatedId = 0;
} }
if (this._summaryBoxPointerCloseClickedId != 0) {
this._summaryBoxPointerItem.closeButton.disconnect(this._summaryBoxPointerCloseClickedId);
this._summaryBoxPointerCloseClickedId = 0;
}
if (this._sourceDoneDisplayingId) { if (this._sourceDoneDisplayingId) {
this._summaryBoxPointerItem.source.disconnect(this._sourceDoneDisplayingId); this._summaryBoxPointerItem.source.disconnect(this._sourceDoneDisplayingId);
this._sourceDoneDisplayingId = 0; this._sourceDoneDisplayingId = 0;