calendar: Only show close button on messages that can be cleared

Currently closing all messages is subtly different from clearing
a section, which is confusing. Start making the behavior more
predictable by only showing a close button in the message when
the section's clear button would remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=746027
This commit is contained in:
Florian Müllner 2015-03-11 22:33:20 +01:00
parent d9211b8e20
commit e72450f5d8

View File

@ -1137,13 +1137,13 @@ const Message = new Lang.Class({
} }
}, },
canClear: function() { canClose: function() {
return true; return true;
}, },
_sync: function() { _sync: function() {
let hovered = this.actor.hover; let hovered = this.actor.hover;
this._closeButton.visible = hovered; this._closeButton.visible = hovered && this.canClose();
this._secondaryBin.visible = !hovered; this._secondaryBin.visible = !hovered;
}, },
@ -1206,7 +1206,7 @@ const NotificationMessage = new Lang.Class({
this.setUseBodyMarkup(n.bannerBodyMarkup); this.setUseBodyMarkup(n.bannerBodyMarkup);
}, },
canClear: function() { canClose: function() {
return !this.notification.resident; return !this.notification.resident;
}, },
@ -1376,7 +1376,7 @@ const MessageListSection = new Lang.Class({
clear: function() { clear: function() {
let messages = [...this._messages.keys()].filter(function(message) { let messages = [...this._messages.keys()].filter(function(message) {
return message.canClear(); return message.canClose();
}); });
// If there are few messages, letting them all zoom out looks OK // If there are few messages, letting them all zoom out looks OK
@ -1405,7 +1405,7 @@ const MessageListSection = new Lang.Class({
_canClear: function() { _canClear: function() {
for (let message of this._messages.keys()) for (let message of this._messages.keys())
if (message.canClear()) if (message.canClose())
return true; return true;
return false; return false;
}, },