[gnome-shell/app-picker-refresh: 6/16] appDisplay: Make _loadCategory() a utility function
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/app-picker-refresh: 6/16] appDisplay: Make _loadCategory() a utility function
- Date: Tue, 19 Feb 2013 23:22:31 +0000 (UTC)
commit 9758029c1132fac9254c66178fd05e761ade45ff
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jan 31 15:16:25 2013 +0100
appDisplay: Make _loadCategory() a utility function
When we bring back categories as folders, this method will be
useful outside of AppDisplay.
https://bugzilla.gnome.org/show_bug.cgi?id=694192
js/ui/appDisplay.js | 39 ++++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index b968fab..456feb5 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -28,6 +28,25 @@ const MAX_APPLICATION_WORK_MILLIS = 75;
const MENU_POPUP_TIMEOUT = 600;
const SCROLL_TIME = 0.1;
+// Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
+function _loadCategory(dir, view) {
+ let iter = dir.iter();
+ let appSystem = Shell.AppSystem.get_default();
+ let nextType;
+ while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
+ if (nextType == GMenu.TreeItemType.ENTRY) {
+ let entry = iter.get_entry();
+ let app = appSystem.lookup_app_by_tree_entry(entry);
+ if (!entry.get_app_info().get_nodisplay())
+ view.addApp(app);
+ } else if (nextType == GMenu.TreeItemType.DIRECTORY) {
+ let itemDir = iter.get_directory();
+ if (!itemDir.get_is_nodisplay())
+ _loadCategory(itemDir, view);
+ }
+ }
+};
+
const AlphabeticalView = new Lang.Class({
Name: 'AlphabeticalView',
@@ -132,24 +151,6 @@ const AppDisplay = new Lang.Class({
this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
},
- // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
- _loadCategory: function(dir) {
- var iter = dir.iter();
- var nextType;
- while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
- if (nextType == GMenu.TreeItemType.ENTRY) {
- var entry = iter.get_entry();
- var app = this._appSystem.lookup_app_by_tree_entry(entry);
- if (!entry.get_app_info().get_nodisplay())
- this._view.addApp(app);
- } else if (nextType == GMenu.TreeItemType.DIRECTORY) {
- var itemDir = iter.get_directory();
- if (!itemDir.get_is_nodisplay())
- this._loadCategory(itemDir);
- }
- }
- },
-
_removeAll: function() {
this._view.removeAll();
},
@@ -168,7 +169,7 @@ const AppDisplay = new Lang.Class({
if (dir.get_is_nodisplay())
continue;
- this._loadCategory(dir);
+ _loadCategory(dir, this._view);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]