[gnome-documents] windowMode: Go back from preview when launched from search provider



commit 20484812ea688f8655cadcd860f203df9afaee17
Author: Alessandro Bono <abono gnome org>
Date:   Mon Jan 4 20:29:58 2016 +0100

    windowMode: Go back from preview when launched from search provider
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760124

 src/windowMode.js |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/windowMode.js b/src/windowMode.js
index 7af3a77..88d3a56 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -49,13 +49,22 @@ const ModeController = new Lang.Class({
         if (!steps)
             steps = 1;
 
-        let oldMode;
+        if (this._history.length < steps)
+            return;
 
-        for (let i = 0; i < steps; i++) {
+        let oldMode;
+        for (let i = 0; i < steps; i++)
             oldMode = this._history.pop();
-            if (!oldMode || oldMode == WindowMode.NONE)
-                return;
-        }
+
+        /* Always go back to the documents view when activated from the search
+         * provider. It is easier to special case it here instead of all
+         * over the code.
+         */
+        if (this._mode == WindowMode.PREVIEW && oldMode == WindowMode.NONE && steps == 1)
+          oldMode = WindowMode.DOCUMENTS;
+
+        if (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]