[gnome-documents] evinceview: move keybinding to exit fullscreen here



commit 4d3c8e223b96f1965bd21ff15b5ee7a02af8b75f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Oct 30 22:02:14 2016 -0700

    evinceview: move keybinding to exit fullscreen here
    
    Simplifies greatly the event handling code in mainWindow.js.
    This is also a slight behavior change; previously Escape did different
    things depending on the context. Now it reliably exits full screen mode.

 src/evinceview.js |    5 +++++
 src/mainWindow.js |   39 ---------------------------------------
 2 files changed, 5 insertions(+), 39 deletions(-)
---
diff --git a/src/evinceview.js b/src/evinceview.js
index 4621c42..d7f8b16 100644
--- a/src/evinceview.js
+++ b/src/evinceview.js
@@ -473,9 +473,14 @@ const EvinceView = new Lang.Class({
                 function() {
                     this.controlsVisible = true;
                 }));
+
+            Application.application.set_accels_for_action('view.fullscreen',
+                                                          ['F11', 'Escape']);
         } else {
             this._fsToolbar.destroy();
             this._fsToolbar = null;
+
+            Application.application.set_accels_for_action('view.fullscreen', ['F11']);
         }
 
         this._syncControlsVisible();
diff --git a/src/mainWindow.js b/src/mainWindow.js
index bf62a47..8109ec9 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -174,23 +174,6 @@ const MainWindow = new Lang.Class({
         if (toolbar.handleEvent(event))
             return true;
 
-        switch (Application.modeController.getWindowMode()) {
-        case WindowMode.WindowMode.NONE:
-            return false;
-        case WindowMode.WindowMode.PREVIEW_EV:
-        case WindowMode.WindowMode.PREVIEW_EPUB:
-        case WindowMode.WindowMode.PREVIEW_LOK:
-            return this._handleKeyPreview(event);
-        case WindowMode.WindowMode.COLLECTIONS:
-        case WindowMode.WindowMode.DOCUMENTS:
-        case WindowMode.WindowMode.SEARCH:
-        case WindowMode.WindowMode.EDIT:
-            return false;
-        default:
-            throw(new Error('Not handled'));
-            break;
-        }
-
         return false;
     },
 
@@ -215,28 +198,6 @@ const MainWindow = new Lang.Class({
         return this._goBack();
     },
 
-    _handleKeyPreview: function(event) {
-        let keyval = event.get_keyval()[1];
-        let preview = this._embed.getPreview();
-        let windowMode = Application.modeController.getWindowMode();
-
-        if (keyval == Gdk.KEY_Escape &&
-            windowMode == WindowMode.WindowMode.PREVIEW_EV) {
-            let model = preview.getModel();
-
-            if (preview.controlsVisible && (model != null)) {
-                preview.controlsVisible = false;
-            } else if (preview.fullscreen) {
-                Application.documentManager.setActiveItem(null);
-                Application.modeController.goBack();
-            }
-
-            return false;
-        }
-
-        return false;
-    },
-
     _quit: function() {
         // remove configure event handler if still there
         if (this._configureId != 0) {


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