[gnome-documents] preview: move scroll-up/scroll-down to actions



commit 632edd16cc3df81437d8956692fa64b01e07f5bd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Oct 30 21:55:49 2016 -0700

    preview: move scroll-up/scroll-down to actions
    
    We can avoid specifying keybindings manually this way.

 src/evinceview.js |   20 +++++++++++++++-----
 src/mainWindow.js |   16 ----------------
 src/preview.js    |    4 ----
 3 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/src/evinceview.js b/src/evinceview.js
index 2730c57..4621c42 100644
--- a/src/evinceview.js
+++ b/src/evinceview.js
@@ -157,6 +157,14 @@ const EvinceView = new Lang.Class({
             doc.print(this.mainWindow);
     },
 
+    _scrollUp: function() {
+        this._evView.scroll(Gtk.ScrollType.PAGE_BACKWARD, false);
+    },
+
+    _scrollDown: function() {
+        this._evView.scroll(Gtk.ScrollType.PAGE_FORWARD, false);
+    },
+
     createActions: function() {
         let actions = [
             { name: 'zoom-in',
@@ -197,7 +205,13 @@ const EvinceView = new Lang.Class({
               callback: Lang.bind(this, this._edit) },
             { name: 'print-current',
               callback: Lang.bind(this, this._print),
-              accels: ['<Primary>p'] }
+              accels: ['<Primary>p'] },
+            { name: 'scroll-up',
+              callback: Lang.bind(this, this._scrollUp),
+              accels: ['Page_Up'] },
+            { name: 'scroll-down',
+              callback: Lang.bind(this, this._scrollDown),
+              accels: ['Page_Down'] }
         ];
 
         if (!Application.application.isBooks)
@@ -629,10 +643,6 @@ const EvinceView = new Lang.Class({
         return this._model ? this._model.document.get_n_pages() : 0;
     },
 
-    scroll: function(direction) {
-        this._evView.scroll(direction, false);
-    },
-
     get evView() {
         return this._evView;
     },
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 90db648..bf62a47 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -234,22 +234,6 @@ const MainWindow = new Lang.Class({
             return false;
         }
 
-        if (keyval == Gdk.KEY_Page_Up) {
-            try {
-                preview.scroll(Gtk.ScrollType.PAGE_BACKWARD);
-                return true;
-            } catch (e) {
-            }
-        }
-
-        if (keyval == Gdk.KEY_Page_Down) {
-            try {
-                preview.scroll(Gtk.ScrollType.PAGE_FORWARD);
-                return true;
-            } catch (e) {
-            }
-        }
-
         return false;
     },
 
diff --git a/src/preview.js b/src/preview.js
index 08e7fe1..3a1fa8c 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -246,10 +246,6 @@ const Preview = new Lang.Class({
 
     findNext: function() {
         throw (new Error('Not implemented'));
-    },
-
-    scroll: function(direction) {
-        throw (new Error('Not implemented'));
     }
 });
 


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