[gnome-shell/gbsneto/folders-as-dialogs: 5/6] iconGrid: Remove API to open space between icons
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/folders-as-dialogs: 5/6] iconGrid: Remove API to open space between icons
- Date: Thu, 12 Dec 2019 21:01:04 +0000 (UTC)
commit 66220859907349094da86706e69dbf8fd13afff1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 12 17:48:03 2019 -0300
iconGrid: Remove API to open space between icons
Since we moved to showing folders as dialogs now, there's no need
to keep this API. Remove it.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
js/ui/appDisplay.js | 34 ++-----------------
js/ui/iconGrid.js | 96 ++---------------------------------------------------
2 files changed, 5 insertions(+), 125 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index ceb1393e86..8f67fd9eae 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -293,9 +293,8 @@ var BaseAppView = GObject.registerClass({
}
});
-var AppDisplay = GObject.registerClass({
- Signals: { 'space-ready': {} },
-}, class AppDisplay extends BaseAppView {
+var AppDisplay = GObject.registerClass(
+class AppDisplay extends BaseAppView {
_init() {
super._init({
layout_manager: new Clutter.BinLayout(),
@@ -381,16 +380,6 @@ var AppDisplay = GObject.registerClass({
this._lastOvershootTimeoutId = 0;
Main.overview.connect('hidden', () => this.goToPage(0));
- this._grid.connect('space-opened', () => {
- let fadeEffect = this._scrollView.get_effect('fade');
- if (fadeEffect)
- fadeEffect.enabled = false;
-
- this.emit('space-ready');
- });
- this._grid.connect('space-closed', () => {
- this._displayingPopup = false;
- });
this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this));
@@ -651,22 +640,6 @@ var AppDisplay = GObject.registerClass({
return Math.abs(currentScrollPosition - this._grid.getPageY(pageNumber));
}
- openSpaceForPopup(item, side, nRows) {
- this._updateIconOpacities(true);
- this._displayingPopup = true;
- this._grid.openExtraSpace(item, side, nRows);
- }
-
- _closeSpaceForPopup() {
- this._updateIconOpacities(false);
-
- let fadeEffect = this._scrollView.get_effect('fade');
- if (fadeEffect)
- fadeEffect.enabled = true;
-
- this._grid.closeExtraSpace();
- }
-
_onScroll(actor, event) {
if (this._displayingPopup || !this._scrollView.reactive)
return Clutter.EVENT_STOP;
@@ -746,8 +719,7 @@ var AppDisplay = GObject.registerClass({
});
}
this._updateIconOpacities(isOpen);
- if (!isOpen)
- this._closeSpaceForPopup();
+ this._displayingPopup = isOpen;
});
}
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 6d6ff5cbe2..b9d0826d23 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -824,10 +824,8 @@ var IconGrid = GObject.registerClass({
}
});
-var PaginatedIconGrid = GObject.registerClass({
- Signals: { 'space-opened': {},
- 'space-closed': {} },
-}, class PaginatedIconGrid extends IconGrid {
+var PaginatedIconGrid = GObject.registerClass(
+class PaginatedIconGrid extends IconGrid {
_init(params) {
super._init(params);
this._nPages = 0;
@@ -955,94 +953,4 @@ var PaginatedIconGrid = GObject.registerClass({
throw new Error('Item not found.');
return Math.floor(index / this._childrenPerPage);
}
-
- /**
- * openExtraSpace:
- * @param {Clutter.Actor} sourceItem: item for which to create extra space
- * @param {St.Side} side: where @sourceItem should be located relative to
- * the created space
- * @param {number} nRows: the amount of space to create
- *
- * Pan view to create extra space for @nRows above or below @sourceItem.
- */
- openExtraSpace(sourceItem, side, nRows) {
- let children = this._getVisibleChildren();
- let index = children.indexOf(sourceItem);
- if (index == -1)
- throw new Error('Item not found.');
-
- let pageIndex = Math.floor(index / this._childrenPerPage);
- let pageOffset = pageIndex * this._childrenPerPage;
-
- let childrenPerRow = this._childrenPerPage / this._rowsPerPage;
- let sourceRow = Math.floor((index - pageOffset) / childrenPerRow);
-
- let nRowsAbove = side == St.Side.TOP ? sourceRow + 1 : sourceRow;
- let nRowsBelow = this._rowsPerPage - nRowsAbove;
-
- let nRowsUp, nRowsDown;
- if (side == St.Side.TOP) {
- nRowsDown = Math.min(nRowsBelow, nRows);
- nRowsUp = nRows - nRowsDown;
- } else {
- nRowsUp = Math.min(nRowsAbove, nRows);
- nRowsDown = nRows - nRowsUp;
- }
-
- let childrenDown = children.splice(pageOffset +
- nRowsAbove * childrenPerRow,
- nRowsBelow * childrenPerRow);
- let childrenUp = children.splice(pageOffset,
- nRowsAbove * childrenPerRow);
-
- // Special case: On the last row with no rows below the icon,
- // there's no need to move any rows either up or down
- if (childrenDown.length == 0 && nRowsUp == 0) {
- this._translatedChildren = [];
- this.emit('space-opened');
- } else {
- this._translateChildren(childrenUp, St.DirectionType.UP, nRowsUp);
- this._translateChildren(childrenDown, St.DirectionType.DOWN, nRowsDown);
- this._translatedChildren = childrenUp.concat(childrenDown);
- }
- }
-
- _translateChildren(children, direction, nRows) {
- let translationY = nRows * (this._getVItemSize() + this._getSpacing());
- if (translationY == 0)
- return;
-
- if (direction == St.DirectionType.UP)
- translationY *= -1;
-
- for (let i = 0; i < children.length; i++) {
- children[i].translation_y = 0;
- let params = {
- translation_y: translationY,
- duration: EXTRA_SPACE_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
- };
- if (i == (children.length - 1))
- params.onComplete = () => this.emit('space-opened');
- children[i].ease(params);
- }
- }
-
- closeExtraSpace() {
- if (!this._translatedChildren || !this._translatedChildren.length) {
- this.emit('space-closed');
- return;
- }
-
- for (let i = 0; i < this._translatedChildren.length; i++) {
- if (!this._translatedChildren[i].translation_y)
- continue;
- this._translatedChildren[i].ease({
- translation_y: 0,
- duration: EXTRA_SPACE_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
- onComplete: () => this.emit('space-closed'),
- });
- }
- }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]