Add 'No Messages' label when message tray is empty
To avoid confusion in new users, a 'No Messages' label is shown when messages tray is empty. https://bugzilla.gnome.org/show_bug.cgi?id=686738
This commit is contained in:
parent
938bc07e3c
commit
a327c10c60
@ -1222,6 +1222,12 @@ StScrollBar StButton#vhandle:active {
|
||||
outline: 1px solid rgba(128, 128, 128, 0.3);
|
||||
}
|
||||
|
||||
.no-messages-label {
|
||||
font-family: cantarell, sans-serif;
|
||||
font-size: 11pt;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.notification {
|
||||
border-radius: 10px 10px 0px 0px;
|
||||
background: rgba(0,0,0,0.8);
|
||||
|
@ -1543,6 +1543,22 @@ const MessageTray = new Lang.Class({
|
||||
this._trayDwellUserTime = 0;
|
||||
|
||||
this._sessionUpdated();
|
||||
this._updateNoMessagesLabel();
|
||||
},
|
||||
|
||||
_updateNoMessagesLabel: function() {
|
||||
if (this._summaryItems.length == 0 && !this._noMessages) {
|
||||
this._noMessages = new St.Label({ text: _("No Messages"),
|
||||
style_class: 'no-messages-label',
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
x_expand: true,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
y_expand: true });
|
||||
this.actor.add_actor(this._noMessages);
|
||||
} else if (this._summaryItems.length > 0 && this._noMessages) {
|
||||
this._noMessages.destroy();
|
||||
this._noMessages = null;
|
||||
}
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
@ -1687,6 +1703,8 @@ const MessageTray = new Lang.Class({
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._updateState(); return false; }));
|
||||
|
||||
this.emit('summary-item-added', summaryItem);
|
||||
|
||||
this._updateNoMessagesLabel();
|
||||
},
|
||||
|
||||
getSummaryItems: function() {
|
||||
@ -1719,6 +1737,8 @@ const MessageTray = new Lang.Class({
|
||||
|
||||
summaryItemToRemove.actor.destroy();
|
||||
|
||||
this._updateNoMessagesLabel();
|
||||
|
||||
if (needUpdate)
|
||||
this._updateState();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user