[gnome-shell] appDisplay: Show label when frequent app view is empty.



commit a765dfc52e32aadcc062f2ab4927b76088749e1b
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Fri May 3 18:20:21 2013 +0200

    appDisplay: Show label when frequent app view is empty.
    
    Currently we show a empty view, that seems broken, so we add a label
    showing that there's not enough frequent applications to show.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694710

 data/theme/gnome-shell.css |    5 +++++
 js/ui/appDisplay.js        |   20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 8e8b755..8afa98b 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -957,6 +957,11 @@ StScrollBar StButton#vhandle:active {
     padding: 0px 30px;
 }
 
+.no-frequent-applications-label {
+    font-size: 18pt;
+    color: #999999;
+}
+
 .app-folder-icon {
     padding: 5px;
 }
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index b685dc2..e19ad13 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -37,6 +37,8 @@ const INACTIVE_GRID_OPACITY = 77;
 const INACTIVE_GRID_OPACITY_ANIMATION_TIME = 0.40;
 const FOLDER_SUBICON_FRACTION = .4;
 
+const MIN_FREQUENT_APPS_COUNT = 3;
+
 const INDICATORS_ANIMATION_TIME = 0.5;
 // 100% means indicators wait for be animated until the previous one
 // is animated completely. 0% means all animators are animated
@@ -570,14 +572,32 @@ const FrequentView = new Lang.Class({
     _init: function() {
         this.parent(null, { fillParent: true });
         this.actor = new St.Widget({ style_class: 'frequent-apps',
+                                     layout_manager: new Clutter.BinLayout(),
                                      x_expand: true, y_expand: true });
+
+        this._noFrequentAppsLabel = new St.Label({ text: _("Frequently used applications will appear here"),
+                                                   style_class: 'no-frequent-applications-label',
+                                                   x_align: Clutter.ActorAlign.CENTER,
+                                                   x_expand: true,
+                                                   y_align: Clutter.ActorAlign.CENTER,
+                                                   y_expand: true });
+
+        this._grid.actor.y_expand = true;
+
         this.actor.add_actor(this._grid.actor);
+        this.actor.add_actor(this._noFrequentAppsLabel);
+        this._noFrequentAppsLabel.hide();
 
         this._usage = Shell.AppUsage.get_default();
     },
 
     loadApps: function() {
         let mostUsed = this._usage.get_most_used ("");
+        let hasUsefulData = mostUsed.length >= MIN_FREQUENT_APPS_COUNT;
+        this._noFrequentAppsLabel.visible = !hasUsefulData;
+        if(!hasUsefulData)
+            return;
+
         for (let i = 0; i < mostUsed.length; i++) {
             if (!mostUsed[i].get_app_info().should_show())
                 continue;


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