[gnome-shell/gbsneto/folders-as-dialogs: 6/12] iconGrid: Remove API to open space between icons



commit b613feed020fd14f841fee22c13e34dcf7a362ff
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 | 30 +---------------
 js/ui/iconGrid.js   | 98 ++---------------------------------------------------
 2 files changed, 3 insertions(+), 125 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index fd8e66b37f..c508335d49 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -298,7 +298,6 @@ var BaseAppView = GObject.registerClass({
 });
 
 var AllView = GObject.registerClass({
-    Signals: { 'space-ready': {} },
 }, class AllView extends BaseAppView {
     _init() {
         super._init({
@@ -388,16 +387,6 @@ var AllView = 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));
 
@@ -630,22 +619,6 @@ var AllView = 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;
@@ -739,8 +712,7 @@ var AllView = 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 11ea0a7f92..ea330d71bc 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -9,8 +9,6 @@ const Main = imports.ui.main;
 var ICON_SIZE = 96;
 var MIN_ICON_SIZE = 16;
 
-var EXTRA_SPACE_ANIMATION_TIME = 250;
-
 var ANIMATION_TIME_IN = 350;
 var ANIMATION_TIME_OUT = 1 / 2 * ANIMATION_TIME_IN;
 var ANIMATION_MAX_DELAY_FOR_ITEM = 2 / 3 * ANIMATION_TIME_IN;
@@ -824,10 +822,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 +951,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]