messageList: Make canClear public and notify on changes
The latest mockups contain a button to clear all sections at once. As some elements cannot be cleared, we need to provide that information to avoid offering an action that has no effect. https://bugzilla.gnome.org/show_bug.cgi?id=775763
This commit is contained in:
parent
0e0caee6ba
commit
239b67eff6
@ -563,6 +563,7 @@ const MessageListSection = new Lang.Class({
|
||||
this._messages = new Map();
|
||||
this._date = new Date();
|
||||
this.empty = true;
|
||||
this.canClear = false;
|
||||
this._sync();
|
||||
},
|
||||
|
||||
@ -719,7 +720,14 @@ const MessageListSection = new Lang.Class({
|
||||
if (changed)
|
||||
this.emit('empty-changed');
|
||||
|
||||
this._closeButton.visible = this._canClear();
|
||||
let canClear = this._canClear();
|
||||
changed = this.canClear !== canClear;
|
||||
this.canClear = canClear;
|
||||
|
||||
if (changed)
|
||||
this.emit('can-clear-changed');
|
||||
|
||||
this._closeButton.visible = this.canClear;
|
||||
this.actor.visible = this.allowed && this._shouldShow();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user