[gnome-documents/wip/rishi/split-view: 4/16] windowMode: Support going back multiple steps



commit 0a839e7ddf28f7278e714ce0f022c98d52e1e20c
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 19 11:12:33 2015 +0100

    windowMode: Support going back multiple steps
    
    This is for going back directly to OVERVIEW from EDIT, skipping
    PREVIEW.
    
    Fallout from cf1a4173a75fafd73933a48b23cd64c8040cd8b4
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686461

 src/edit.js       |    1 +
 src/windowMode.js |   15 +++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/edit.js b/src/edit.js
index 0a061f7..88039eb 100644
--- a/src/edit.js
+++ b/src/edit.js
@@ -170,6 +170,7 @@ const EditToolbar = new Lang.Class({
         backButton.connect('clicked', Lang.bind(this,
             function() {
                 Application.documentManager.setActiveItem(null);
+                Application.modeController.goBack(2);
             }));
 
         let viewButton = new Gtk.Button({ label: _("View"),
diff --git a/src/windowMode.js b/src/windowMode.js
index 23f76e6..6959386 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -42,10 +42,17 @@ const ModeController = new Lang.Class({
         this._history = [];
     },
 
-    goBack: function() {
-        let oldMode = this._history.pop();
-        if (!oldMode || oldMode == WindowMode.NONE)
-            return;
+    goBack: function(steps) {
+        if (!steps)
+            steps = 1;
+
+        let oldMode;
+
+        for (let i = 0; i < steps; i++) {
+            oldMode = this._history.pop();
+            if (!oldMode || oldMode == WindowMode.NONE)
+                return;
+        }
 
         // Swap the old and current modes.
         let tmp = oldMode;


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