[gnome-shell/app-picker-refresh: 4/16] appDisplay: Merge AppDisplay and ViewByCategories



commit 1364b64778d2cd7f1e5032e03fade61ca42ddd65
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jan 31 00:15:39 2013 +0100

    appDisplay: Merge AppDisplay and ViewByCategories

 data/theme/gnome-shell.css |    4 +-
 js/ui/appDisplay.js        |   49 +++++++++++++++++--------------------------
 2 files changed, 21 insertions(+), 32 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index a701134..f69ea95 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -847,12 +847,12 @@ StScrollBar StButton#vhandle:active {
     icon-size: 96px;
 }
 
-.all-app {
+.app-display {
     padding: 0px 16px 32px 32px;
     spacing: 20px;
 }
 
-.all-app:rtl {
+.app-display:rtl {
     padding-left: 16px;
     padding-right: 32px;
 }
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index cd6c17b..0c55d61 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -108,22 +108,34 @@ const AlphabeticalView = new Lang.Class({
     }
 });
 
-const ViewByCategories = new Lang.Class({
-    Name: 'ViewByCategories',
+
+/* This class represents a display containing a collection of application items.
+ * The applications are sorted based on their name.
+ */
+const AppDisplay = new Lang.Class({
+    Name: 'AppDisplay',
 
     _init: function() {
         this._appSystem = Shell.AppSystem.get_default();
-        this.actor = new St.BoxLayout({ style_class: 'all-app' });
-        this.actor._delegate = this;
+        this._appSystem.connect('installed-changed', Lang.bind(this, function() {
+            Main.queueDeferredWork(this._workId);
+        }));
+
+        let box = new St.BoxLayout();
+        this.actor = new St.Bin({ child: box,
+                                  style_class: 'app-display',
+                                  x_fill: true, y_fill: true });
 
         this._view = new AlphabeticalView();
-        this.actor.add(this._view.actor, { expand: true, x_fill: true, y_fill: true });
+        box.add(this._view.actor);
 
         // We need a dummy actor to catch the keyboard focus if the
         // user Ctrl-Alt-Tabs here before the deferred work creates
         // our real contents
         this._focusDummy = new St.Bin({ can_focus: true });
-        this.actor.add(this._focusDummy);
+        box.add(this._focusDummy);
+
+        this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
     },
 
     // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
@@ -148,7 +160,7 @@ const ViewByCategories = new Lang.Class({
         this._view.removeAll();
     },
 
-    refresh: function() {
+    _redisplay: function() {
         this._removeAll();
 
         var tree = this._appSystem.get_tree();
@@ -176,29 +188,6 @@ const ViewByCategories = new Lang.Class({
     }
 });
 
-/* This class represents a display containing a collection of application items.
- * The applications are sorted based on their name.
- */
-const AppDisplay = new Lang.Class({
-    Name: 'AppDisplay',
-
-    _init: function() {
-        this._appSystem = Shell.AppSystem.get_default();
-        this._appSystem.connect('installed-changed', Lang.bind(this, function() {
-            Main.queueDeferredWork(this._workId);
-        }));
-
-        this._appView = new ViewByCategories();
-        this.actor = new St.Bin({ child: this._appView.actor, x_fill: true, y_fill: true });
-
-        this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
-    },
-
-    _redisplay: function() {
-        this._appView.refresh();
-    }
-});
-
 const AppSearchProvider = new Lang.Class({
     Name: 'AppSearchProvider',
 


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