[gnome-documents/wip/rishi/split-view: 1/9] mainWindow: Use a switch statement for consistency with similar code



commit 91d842ff6743655b8fefd87666fe6e0f055b6c94
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 10 17:34:15 2015 +0100

    mainWindow: Use a switch statement for consistency with similar code
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686461

 src/mainWindow.js |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 2a404c2..e1ac236 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -152,14 +152,22 @@ const MainWindow = new Lang.Class({
         let activeCollection = Application.documentManager.getActiveCollection();
         let handled = true;
 
-        if (windowMode == WindowMode.WindowMode.PREVIEW ||
-            windowMode == WindowMode.WindowMode.EDIT) {
+        switch (windowMode) {
+        case WindowMode.WindowMode.NONE:
+            handled = false;
+            break;
+        case WindowMode.WindowMode.EDIT:
+        case WindowMode.WindowMode.PREVIEW:
             Application.documentManager.setActiveItem(null);
             Application.modeController.goBack();
-        } else if (windowMode == WindowMode.WindowMode.OVERVIEW && activeCollection) {
-            Application.documentManager.activatePreviousCollection();
-        } else {
-            handled = false;
+            break;
+        case WindowMode.WindowMode.OVERVIEW:
+            if (activeCollection)
+                Application.documentManager.activatePreviousCollection();
+            break;
+        default:
+            throw(new Error('Not handled'));
+            break;
         }
 
         return handled;


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