[gnome-shell] appDisplay: Default to All view when not enough usage data is available



commit 938628a05f5df838351e538ae53894ed76ec516d
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 30 20:25:19 2013 +0200

    appDisplay: Default to All view when not enough usage data is available
    
    The frequent view is not useful when it doesn't contain any applications
    yet. While the previously added label makes this state appear less like
    an error (OMG, my apps are gone!), it doesn't address the issue of
    usefulness - default to the more helpful All view in this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694710

 js/ui/appDisplay.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index e19ad13..c1e44dc 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -591,9 +591,13 @@ const FrequentView = new Lang.Class({
         this._usage = Shell.AppUsage.get_default();
     },
 
+    hasUsefulData: function() {
+        return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
+    },
+
     loadApps: function() {
         let mostUsed = this._usage.get_most_used ("");
-        let hasUsefulData = mostUsed.length >= MIN_FREQUENT_APPS_COUNT;
+        let hasUsefulData = this.hasUsefulData();
         this._noFrequentAppsLabel.visible = !hasUsefulData;
         if(!hasUsefulData)
             return;
@@ -724,7 +728,8 @@ const AppDisplay = new Lang.Class({
                     this._showView(viewIndex);
                 }));
         }
-        this._showView(Views.FREQUENT);
+        let frequentUseful = this._views[Views.FREQUENT].view.hasUsefulData();
+        this._showView(frequentUseful ? Views.FREQUENT : Views.ALL);
         this._updateFrequentVisibility();
 
         // We need a dummy actor to catch the keyboard focus if the


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