[gnome-shell/app-picker-refresh: 11/16] appDisplay: Separate app loading from filling the grid



commit 65f96494f801daa5474b5f25bfda22893e00400f
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 19 21:31:05 2013 +0100

    appDisplay: Separate app loading from filling the grid
    
    At the moment when loading the applications, each app is inserted
    at its correct (alphabetical) position. Avoid this overhead by
    loading all apps first, then sort them once and fill the grid with
    the sorted actors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694192

 js/ui/appDisplay.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index cc4a665..e45c166 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -89,12 +89,21 @@ const AlphabeticalView = new Lang.Class({
             return null;
 
         let itemIcon = this._createItemIcon(item);
-        let pos = Util.insertSorted(this._allItems, item, this._compareItems);
-        this._grid.addItem(itemIcon.actor, pos);
-
+        this._allItems.push(item);
         this._items[id] = itemIcon;
 
         return itemIcon;
+    },
+
+    loadGrid: function() {
+        this._allItems.sort(this._compareItems);
+
+        for (let i = 0; i < this._allItems.length; i++) {
+            let id = this._getItemId(this._allItems[i]);
+            if (!id)
+                continue;
+            this._grid.addItem(this._items[id].actor);
+        }
     }
 });
 
@@ -276,6 +285,7 @@ const AppDisplay = new Lang.Class({
                 _loadCategory(dir, this._view);
             }
         }
+        this._view.loadGrid();
 
         if (this._focusDummy) {
             let focused = this._focusDummy.has_key_focus();
@@ -367,6 +377,7 @@ const FolderIcon = new Lang.Class({
         this.view = new FolderView();
         this.view.actor.reactive = false;
         _loadCategory(dir, this.view);
+        this.view.loadGrid();
 
         this.actor.connect('clicked', Lang.bind(this,
             function() {


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