From 938628a05f5df838351e538ae53894ed76ec516d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 30 Aug 2013 20:25:19 +0200 Subject: [PATCH] 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 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index e19ad13a7..c1e44dc47 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