[gnome-shell] sessionMode: Add hasWorkspaces property
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-shell] sessionMode: Add hasWorkspaces property
- Date: Tue, 22 May 2012 17:47:00 +0000 (UTC)
commit ed174181010f2bde6da06a3509aaa69c47887638
Author: Florian MÃllner <fmuellner gnome org>
Date:   Thu May 17 15:32:32 2012 +0200
    sessionMode: Add hasWorkspaces property
    
    Add a sessionMode.hasWorkspaces property, which determines whether
    the concept of workspaces should be exposed in the interface or not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676156
 js/ui/main.js        |   22 ++++++++++++++++------
 js/ui/sessionMode.js |    2 ++
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 04f0445..f4150c5 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -133,8 +133,6 @@ function _initRecorder() {
 
 function _initUserSession() {
     _initRecorder();
-
-    global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT, false, -1, 1);
 }
 
 function start() {
@@ -222,6 +220,10 @@ function start() {
     if (sessionMode.sessionType == Shell.SessionType.USER)
         _initUserSession();
 
+    if (sessionMode.hasWorkspaces)
+        global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
+                                                false, -1, 1);
+
     if (sessionMode.allowExtensions) {
         ExtensionSystem.init();
         ExtensionSystem.loadExtensions();
@@ -590,24 +592,32 @@ function _globalKeyPressHandler(actor, event) {
         return true;
     }
 
-    // None of the other bindings are relevant outside of the user's session
-    if (sessionMode.sessionType != Shell.SessionType.USER)
-        return false;
-
     switch (action) {
         // left/right would effectively act as synonyms for up/down if we enabled them;
         // but that could be considered confusing; we also disable them in the main view.
         //
         // case Meta.KeyBindingAction.WORKSPACE_LEFT:
+        //  if (!sessionMode.hasWorkspaces)
+        //      return false;
+        //
         //     wm.actionMoveWorkspaceLeft();
         //     return true;
         // case Meta.KeyBindingAction.WORKSPACE_RIGHT:
+        //  if (!sessionMode.hasWorkspaces)
+        //      return false;
+        //
         //     wm.actionMoveWorkspaceRight();
         //     return true;
         case Meta.KeyBindingAction.WORKSPACE_UP:
+            if (!sessionMode.hasWorkspaces)
+                return false;
+
             wm.actionMoveWorkspaceUp();
             return true;
         case Meta.KeyBindingAction.WORKSPACE_DOWN:
+            if (!sessionMode.hasWorkspaces)
+                return false;
+
             wm.actionMoveWorkspaceDown();
             return true;
         case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index a3edec5..88d33c7 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -15,6 +15,7 @@ const _modes = {
              allowExtensions: false,
              allowKeybindingsWhenModal: true,
              hasRunDialog: false,
+             hasWorkspaces: false,
              sessionType: Shell.SessionType.GDM },
 
     'user': { hasOverview: true,
@@ -24,6 +25,7 @@ const _modes = {
               allowExtensions: true,
               allowKeybindingsWhenModal: false,
               hasRunDialog: true,
+              hasWorkspaces: true,
               sessionType: Shell.SessionType.USER }
 };
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]