From a327c10c605194aef2b98ac3fc1c19325ec51fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victoria=20Mart=C3=ADnez=20de=20la=20Cruz?= Date: Mon, 12 Nov 2012 22:44:01 -0300 Subject: [PATCH] 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 --- data/theme/gnome-shell.css | 6 ++++++ js/ui/messageTray.js | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 54b83ac1b..86b447d56 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -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); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 8fbc0b232..12895f9b2 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -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(); },