[gnome-documents/wip/rishi/split-view: 2/11] mainWindow: Use a switch statement for consistency with similar code
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/rishi/split-view: 2/11] mainWindow: Use a switch statement for consistency with similar code
- Date: Thu, 19 Feb 2015 18:10:10 +0000 (UTC)
commit cd2d12e2fbd9286a5cc113be03adb651f18654fc
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]