[gnome-shell] Remove now unnecessary workspace controls



commit f038ce1c694d85454daf560908a3d5a02b22c101
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Jan 25 16:45:58 2011 -0500

    Remove now unnecessary workspace controls
    
    With automatic workspace management, explicit controls to add and
    remove workspaces are no longer necessary. We also can remove the
    use of addWorkspace for middle-button-click on a launcher since
    launching on the last empty workspace will do the right thing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640996

 data/Makefile.am                |    2 -
 data/theme/add-workspace.svg    |   98 ---------------------------------------
 data/theme/gnome-shell.css      |   15 ------
 data/theme/remove-workspace.svg |   92 ------------------------------------
 js/ui/appDisplay.js             |   13 ++---
 js/ui/workspacesView.js         |   76 ------------------------------
 6 files changed, 6 insertions(+), 290 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 2de2ff9..4235d50 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -24,7 +24,6 @@ dist_images_DATA =				\
 
 themedir = $(pkgdatadir)/theme
 dist_theme_DATA =				\
-	theme/add-workspace.svg			\
 	theme/calendar-arrow-left.svg		\
 	theme/calendar-arrow-right.svg		\
 	theme/close-window.svg			\
@@ -37,7 +36,6 @@ dist_theme_DATA =				\
 	theme/mosaic-view.svg			\
 	theme/move-window-on-new.svg		\
 	theme/process-working.png		\
-	theme/remove-workspace.svg		\
 	theme/running-indicator.svg		\
 	theme/scroll-button-down-hover.png	\
 	theme/scroll-button-down.png		\
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index bbe76a7..df481d8 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -279,21 +279,6 @@ StTooltip StLabel {
     outline: 2px solid white;
 }
 
-.add-workspace {
-}
-
-.add-workspace:hover {
-    background-color: rgba(128, 128, 128, 0.2);
-}
-
-.remove-workspace {
-    height: 48px;
-}
-
-.remove-workspace:hover {
-    background-color: rgba(128, 128, 128, 0.2);
-}
-
 .window-caption {
     background: rgba(0,0,0,0.8);
     border: 1px solid rgba(128,128,128,0.40);
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index caec10f..4372030 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -397,13 +397,12 @@ AppWellIcon.prototype = {
         if (button == 1) {
             this._onActivate(Clutter.get_current_event());
         } else if (button == 2) {
-            let newWorkspace = Main.overview.workspaces.addWorkspace();
-            if (newWorkspace != null) {
-                newWorkspace.activate(global.get_current_time());
-                this.emit('launching');
-                this.app.open_new_window();
-                Main.overview.hide();
-            }
+            // Last workspace is always empty
+            let launchWorkspace = global.screen.get_workspace_by_index(global.screen.n_workspaces - 1);
+            launchWorkspace.activate(global.get_current_time());
+            this.emit('launching');
+            this.app.open_new_window();
+            Main.overview.hide();
         }
         return false;
     },
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 5e05108..3ab93bb 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -209,12 +209,6 @@ WorkspacesView.prototype = {
             this._workspaces[i].syncStacking(stackIndices);
     },
 
-    // Handles a drop onto the (+) button; assumes the new workspace
-    // has already been added
-    acceptNewWorkspaceDrop: function(source, dropActor, x, y, time) {
-        return this._workspaces[this._workspaces.length - 1].acceptDrop(source, dropActor, x, y, time);
-    },
-
     // Get the grid position of the active workspace.
     getActiveWorkspacePosition: function() {
         let activeWorkspaceIndex = global.screen.get_active_workspace_index();
@@ -223,37 +217,6 @@ WorkspacesView.prototype = {
         return [activeWorkspace.x, activeWorkspace.y];
     },
 
-    canAddWorkspace: function() {
-        return global.screen.n_workspaces < MAX_WORKSPACES;
-    },
-
-    addWorkspace: function() {
-        let ws = null;
-        if (!this.canAddWorkspace()) {
-            Main.overview.shellInfo.setMessage(_("Can't add a new workspace because maximum workspaces limit has been reached."));
-        } else {
-            let currentTime = global.get_current_time();
-            ws = global.screen.append_new_workspace(false, currentTime);
-        }
-
-        return ws;
-    },
-
-    canRemoveWorkspace: function() {
-        return this._getWorkspaceIndexToRemove() > 0;
-    },
-
-    removeWorkspace: function() {
-        if (!this.canRemoveWorkspace()) {
-            Main.overview.shellInfo.setMessage(_("Can't remove the first workspace."));
-            return;
-        }
-        let index = this._getWorkspaceIndexToRemove();
-        let metaWorkspace = this._workspaces[index].metaWorkspace;
-        global.screen.remove_workspace(metaWorkspace,
-                                       global.get_current_time());
-    },
-
     zoomOut: function() {
         if (this._zoomOut)
             return;
@@ -272,21 +235,6 @@ WorkspacesView.prototype = {
         this._updateWorkspaceActors(true);
     },
 
-    _handleDragOverNewWorkspace: function(source, dropActor, x, y, time) {
-        if (source.realWindow)
-            return DND.DragMotionResult.MOVE_DROP;
-        if (source.shellWorkspaceLaunch)
-            return DND.DragMotionResult.COPY_DROP;
-        return DND.DragMotionResult.CONTINUE;
-    },
-
-    _acceptNewWorkspaceDrop: function(source, dropActor, x, y, time) {
-        let ws = this.addWorkspace();
-        if (ws == null)
-            return false;
-        return this.acceptNewWorkspaceDrop(source, dropActor, x, y, time);
-    },
-
     // Compute the position, scale and opacity of the workspaces, but don't
     // actually change the actors to match
     _computeWorkspacePositions: function() {
@@ -717,14 +665,6 @@ WorkspacesDisplay.prototype = {
         controls.connect('notify::hover',
                          Lang.bind(this, this._onControlsHoverChanged));
 
-        // Add/remove workspace buttons
-        this._removeButton = new St.Button({ label: '&#8211;', // n-dash
-                                             style_class: 'remove-workspace' });
-        this._removeButton.connect('clicked', Lang.bind(this, function() {
-            this.workspacesView.removeWorkspace();
-        }));
-        controls.add(this._removeButton);
-
         this._thumbnailsBox = new St.BoxLayout({ vertical: true,
                                                  style_class: 'workspace-thumbnails' });
         controls.add(this._thumbnailsBox, { expand: false });
@@ -744,22 +684,6 @@ WorkspacesDisplay.prototype = {
                                                         indicator.add_constraint(constraint);
                                                     });
 
-        this._addButton = new St.Button({ label: '+',
-                                          style_class: 'add-workspace' });
-        this._addButton.connect('clicked', Lang.bind(this, function() {
-            this.workspacesView.addWorkspace();
-        }));
-        this._addButton._delegate = this._addButton;
-        this._addButton._delegate.acceptDrop = Lang.bind(this,
-            function(source, actor, x, y, time) {
-                return this.workspacesView._acceptNewWorkspaceDrop(source, actor, x, y, time);
-            });
-        this._addButton._delegate.handleDragOver = Lang.bind(this,
-            function(source, actor, x, y, time) {
-                return this.workspacesView._handleDragOverNewWorkspace(source, actor, x, y, time);
-            });
-        controls.add(this._addButton, { expand: true });
-
         this.workspacesView = null;
 
         this._inDrag = false;



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