[gnome-shell/wip/paging-release: 3/85] AppFolders working as we have before, but, without proper visibility.
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/paging-release: 3/85] AppFolders working as we have before, but, without proper visibility.
- Date: Mon, 12 Aug 2013 16:42:40 +0000 (UTC)
commit 5dcf0efdfa2d20a61830855e9d397fc289004be9
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Thu Jun 20 22:37:46 2013 +0200
AppFolders working as we have before, but, without proper visibility.
js/ui/appDisplay.js | 118 +++++++++++++++++++++++++++++++++++++-------------
js/ui/iconGrid.js | 2 +-
2 files changed, 88 insertions(+), 32 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 6c519eb..21955ba 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -114,11 +114,16 @@ const AlphabeticalView = new Lang.Class({
const FolderView = new Lang.Class({
Name: 'FolderView',
- Extends: AlphabeticalView,
_init: function() {
- this.parent();
+ this._grid = new IconGrid.IconGrid({ xAlign: St.Align.MIDDLE,
+ columnLimit: MAX_COLUMNS });
+ // Standard hack for ClutterBinLayout
this.actor = this._grid.actor;
+ this._grid.actor.x_expand = true;
+
+ this._items = {};
+ this._allItems = [];
},
_getItemId: function(item) {
@@ -154,6 +159,35 @@ const FolderView = new Lang.Class({
}
return icon;
+ },
+
+ removeAll: function() {
+ this._grid.removeAll();
+ this._items = {};
+ this._allItems = [];
+ },
+
+ _addItem: function(item) {
+ let id = this._getItemId(item);
+ if (this._items[id] !== undefined)
+ return null;
+
+ let itemIcon = this._createItemIcon(item);
+ 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);
+ }
}
});
@@ -161,9 +195,10 @@ const AppPages = new Lang.Class({
Name: 'AppPages',
Extends: AlphabeticalView,
- _init: function() {
+ _init: function(parent) {
this.parent();
this.actor = this._grid.actor;
+ this._parent = parent;
},
_getItemId: function(item) {
@@ -218,17 +253,28 @@ const AppPages = new Lang.Class({
setGridParentSize: function(size) {
this._grid._parentSize = size;
+ },
+
+ addFolderPopup: function(popup) {
+ this._parent.addFolderPopup(popup);
}
});
-const PaginationScrollActor = new Lang.Class({
- Name: 'PaginationScrollActor',
+const PaginationScrollView = new Lang.Class({
+ Name: 'PaginationScrollView',
Extends: St.ScrollView,
_init: function() {
this.parent();
+
+ this._stack = new St.Widget({layout_manager: new Clutter.BinLayout()});
this._box = new St.BoxLayout({vertical: true});
- this._pages = new AppPages();
- this._box.add_actor(this._pages.actor);
+ this._pages = new AppPages(this);
+
+ this._stack.add_actor(this._pages.actor);
+ this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
+ this._stack.add_actor(this._eventBlocker, {x_align:St.Align.MIDDLE});
+
+ this._box.add_actor(this._stack);
this.add_actor(this._box);
this.connect('scroll-event', Lang.bind(this, this._onScroll));
@@ -283,6 +329,30 @@ const PaginationScrollActor = new Lang.Class({
this.goToPreviousPage();
if (direction == Clutter.ScrollDirection.DOWN)
this.goToNextPage();
+ },
+
+ addFolderPopup: function(popup) {
+ this._stack.add_actor(popup.actor);
+ popup.connect('open-state-changed', Lang.bind(this,
+ function(popup, isOpen) {
+ this._eventBlocker.reactive = isOpen;
+ this._currentPopup = isOpen ? popup : null;
+ this._updateIconOpacities(isOpen);
+ if (isOpen) {
+ this._pages._grid.actor.y = popup.parentOffset;
+ } else {
+ this._pages._grid.actor.y = 0;
+ }
+ }));
+ },
+
+ _updateIconOpacities: function(folderOpen) {
+ for (let id in this._items) {
+ if (folderOpen && !this._items[id].actor.checked)
+ this._items[id].actor.opacity = INACTIVE_GRID_OPACITY;
+ else
+ this._items[id].actor.opacity = 255;
+ }
}
});
@@ -290,7 +360,15 @@ const AllView = new Lang.Class({
Name: 'AllView',
_init: function() {
- this.actor = new PaginationScrollActor();
+ this.actor = new PaginationScrollView();
+ /*
+ let box = new St.BoxLayout({ vertical: true });
+ this._stack = new St.Widget({ layout_manager: new AllViewLayout() });
+ this._stack.add_actor(this._grid.actor);
+ this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
+ this._stack.add_actor(this._eventBlocker);
+ box.add(this._stack, { y_align: St.Align.START, expand: true });
+ */
this._pageControl = new St.Widget();
},
@@ -331,29 +409,7 @@ const AllView = new Lang.Class({
},
addFolderPopup: function(popup) {
- /*
- this._stack.add_actor(popup.actor);
- popup.connect('open-state-changed', Lang.bind(this,
- function(popup, isOpen) {
- this._eventBlocker.reactive = isOpen;
- this._currentPopup = isOpen ? popup : null;
- this._updateIconOpacities(isOpen);
- if (isOpen) {
- this._ensureIconVisible(popup.actor);
- this._grid.actor.y = popup.parentOffset;
- } else {
- this._grid.actor.y = 0;
- }
- }));*/
- },
-
- _updateIconOpacities: function(folderOpen) {
- for (let id in this._items) {
- if (folderOpen && !this._items[id].actor.checked)
- this._items[id].actor.opacity = INACTIVE_GRID_OPACITY;
- else
- this._items[id].actor.opacity = 255;
- }
+ this.actor.addFolderPopup(popup);
},
removeAll: function() {
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 5936a0c..5dc481e 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -282,7 +282,7 @@ const IconGrid = new Lang.Class({
let gridBox = this.actor.get_theme_node().get_content_box(parentBox);
box = this._grid.get_theme_node().get_content_box(gridBox);
}
-
+
let children = this._getVisibleChildren();
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]