appDisplay: Improve icons of folders with few apps

Folders use a 2x2 grid of the first 4 app icons as icon - if a folder
contains less apps, we currently skip the corresponding grid positions.
As a result, the overall size request may be smaller than the one for
other icons, making the folder icon look out of place.
Fix this by always using a full grid as folder icon, using dummy actors
as necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=726322
This commit is contained in:
Florian Müllner 2014-03-14 15:50:18 +01:00
parent 5cdefc324d
commit 30fb2b0d99

View File

@ -936,9 +936,15 @@ const FolderView = new Lang.Class({
layout.hookup_style(icon);
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
for (let i = 0; i < Math.min(this._allItems.length, 4); i++) {
let texture = this._allItems[i].app.create_icon_texture(subSize);
let bin = new St.Bin({ child: texture });
let numItems = this._allItems.length;
for (let i = 0; i < 4; i++) {
let bin;
if (i < numItems) {
let texture = this._allItems[i].app.create_icon_texture(subSize);
bin = new St.Bin({ child: texture });
} else {
bin = new St.Bin({ width: subSize, height: subSize });
}
layout.pack(bin, i % 2, Math.floor(i / 2));
}