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
This commit is contained in:
Florian Müllner 2013-08-30 20:25:19 +02:00
parent a765dfc52e
commit 938628a05f

View File

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