[gnome-shell] appDisplay: Improve icons of folders with few apps



commit 30fb2b0d99fb0d315410334d94306830eceee15d
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 14 15:50:18 2014 +0100

    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

 js/ui/appDisplay.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index d9947b5..2d8fc38 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -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));
         }
 


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