[gnome-shell] Add 'No Messages' label when message tray is empty



commit a327c10c605194aef2b98ac3fc1c19325ec51fbc
Author: Victoria MartÃnez de la Cruz <vickymsee gmail com>
Date:   Mon Nov 12 22:44:01 2012 -0300

    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(+), 0 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 54b83ac..86b447d 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 8fbc0b2..12895f9 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();
     },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]