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
This commit is contained in:
Carlos Soriano 2013-05-03 18:20:21 +02:00 committed by Florian Müllner
parent d58f0646cf
commit a765dfc52e
2 changed files with 25 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;