[gnome-shell/overview-relayout: 5/15] linear-view: Remove NewWorkspaceArea



commit d9dcc4ad6c6ac41a063457d3ff7ad58145d3fef9
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 4 20:04:23 2010 +0200

    linear-view: Remove NewWorkspaceArea
    
    As the button to add workspaces will move to the same position as
    the new workspace drop area in drag mode, the latter is redundant
    and can be removed.

 js/ui/workspacesView.js |   80 +++++++++++++----------------------------------
 1 files changed, 22 insertions(+), 58 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 5a14279..da5db2b 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -636,12 +636,6 @@ SingleView.prototype = {
     __proto__: GenericWorkspacesView.prototype,
 
     _init: function(width, height, x, y, workspaces) {
-
-        this._newWorkspaceArea = new NewWorkspaceArea();
-        this._newWorkspaceArea.actor._delegate = {
-            acceptDrop: Lang.bind(this, this._acceptNewWorkspaceDrop)
-        };
-
         GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
 
         this._itemDragBeginId = Main.overview.connect('item-drag-begin',
@@ -655,8 +649,6 @@ SingleView.prototype = {
                                                                                Lang.bind(this, this._dragEnd));
         }
 
-        this.actor.add_actor(this._newWorkspaceArea.actor);
-
         this.actor.add_style_class_name('single');
         this.actor.set_clip(x, y, width, height);
         this._activeWorkspaceX = 0; // x offset of active ws while dragging
@@ -717,11 +709,6 @@ SingleView.prototype = {
 
             workspace.setSelected(false);
         }
-
-        this._newWorkspaceArea.scale = scale;
-        this._newWorkspaceArea.gridX = this._x + this._activeWorkspaceX
-                                       + (this._workspaces.length - active) * (_width + this._spacing);
-        this._newWorkspaceArea.gridY = this._y + this._activeWorkspaceY;
     },
 
     _transitionWorkspaces: function() {
@@ -905,19 +892,32 @@ SingleView.prototype = {
             workspace.gridX += dx;
 
             if (showAnimation) {
-                Tweener.addTween(workspace.actor,
-                    { x: workspace.gridX,
-                      y: workspace.gridY,
-                      scale_x: workspace.scale,
-                      scale_y: workspace.scale,
-                      opacity: workspace.opacity,
-                      time: WORKSPACE_SWITCH_TIME,
-                      transition: 'easeOutQuad'
-                    });
+                let params = { x: workspace.gridX,
+                               y: workspace.gridY,
+                               scale_x: workspace.scale,
+                               scale_y: workspace.scale,
+                               opacity: workspace.opacity,
+                               time: WORKSPACE_SWITCH_TIME,
+                               transition: 'easeOutQuad'
+                             };
+                // we have to call _updateVisibility() once before the
+                // animation and once afterwards - it does not really
+                // matter which tween we use, so we pick the first one ...
+                if (w == 0) {
+                    this._updateVisibility();
+                    params.onComplete = Lang.bind(this,
+                        function() {
+                            this._animating = false;
+                            this._updateVisibility();
+                        });
+                }
+                Tweener.addTween(workspace.actor, params);
             } else {
                 workspace.actor.set_scale(workspace.scale, workspace.scale);
                 workspace.actor.set_position(workspace.gridX, workspace.gridY);
                 workspace.actor.opacity = workspace.opacity;
+                if (w == 0)
+                    this._updateVisibility();
             }
         }
 
@@ -942,35 +942,6 @@ SingleView.prototype = {
                 this._cleanWorkspaces();
             }
         }
-
-        Tweener.removeTweens(this._newWorkspaceArea.actor);
-
-        this._newWorkspaceArea.gridX += dx;
-        if (showAnimation) {
-            // we have to call _updateVisibility() once before the
-            // animation and once afterwards - it does not really
-            // matter which tween we use, as long as it's not inside
-            // a loop ...
-            this._updateVisibility();
-            Tweener.addTween(this._newWorkspaceArea.actor,
-                             { x: this._newWorkspaceArea.gridX,
-                               y: this._newWorkspaceArea.gridY,
-                               scale_x: this._newWorkspaceArea.scale,
-                               scale_y: this._newWorkspaceArea.scale,
-                               time: WORKSPACE_SWITCH_TIME,
-                               transition: 'easeOutQuad',
-                               onComplete: Lang.bind(this, function() {
-                                   this._animating = false;
-                                   this._updateVisibility();
-                               })
-                             });
-        } else {
-            this._newWorkspaceArea.actor.set_scale(this._newWorkspaceArea.scale,
-                                                   this._newWorkspaceArea.scale);
-            this._newWorkspaceArea.actor.set_position(this._newWorkspaceArea.gridX,
-                                                      this._newWorkspaceArea.gridY);
-            this._updateVisibility();
-        }
     },
 
     _updateVisibility: function() {
@@ -1152,13 +1123,6 @@ SingleView.prototype = {
             } else {
                 rightWorkspace.opacity = rightWorkspace.actor.opacity = 200;
             }
-        } else {
-            let targetParent = dragEvent.targetActor.get_parent();
-            if (targetParent == this._newWorkspaceArea.actor) {
-                this._newWorkspaceArea.setStyle(true);
-                result = this._handleDragOverNewWorkspace(dragEvent.source, dragEvent.dragActor);
-            } else
-                this._newWorkspaceArea.setStyle(false);
         }
 
         // handle delayed workspace switches



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