windowManager: refactor WorkspaceSwitchAction callback into separate function

This will be used by the touchpad-specific "action" too, so put it in a
shared place.

https://bugzilla.gnome.org/show_bug.cgi?id=752250
This commit is contained in:
Carlos Garnacho 2015-07-01 15:51:15 +02:00
parent c3e5d983b9
commit 804563d5b2

View File

@ -866,15 +866,18 @@ const WindowManager = new Lang.Class({
false, -1, 1);
let gesture = new WorkspaceSwitchAction();
gesture.connect('activated', Lang.bind(this, function(action, direction) {
let newWs = global.screen.get_active_workspace().get_neighbor(direction);
this.actionMoveWorkspace(newWs);
}));
gesture.connect('activated', Lang.bind(this, this._actionSwitchWorkspace));
global.stage.add_action(gesture);
gesture = new AppSwitchAction();
gesture.connect('activated', Lang.bind(this, this._switchApp));
global.stage.add_action(gesture);
},
_actionSwitchWorkspace: function(action, direction) {
let newWs = global.screen.get_active_workspace().get_neighbor(direction);
this.actionMoveWorkspace(newWs);
},
_lookupIndex: function (windows, metaWindow) {