[gnome-documents] preview: use action_name for prev/next buttons



commit f709af348e85a40463548017aa9b1f6d2d0867c2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Aug 3 18:38:10 2019 +0200

    preview: use action_name for prev/next buttons
    
    Instead of connecting to the 'clicked' signal manually, just specify
    the action name.

 src/preview.js | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index d7c2456b..424de791 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -565,10 +565,10 @@ var PreviewNavControls = class PreviewNavControls {
         this._overlay.add_overlay(this._prevRevealer);
 
         let prevButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'go-previous-symbolic',
-                                                                  pixel_size: 16 }), });
+                                                                  pixel_size: 16 }),
+                                          action_name: 'view.prev-page' });
         prevButton.get_style_context().add_class('osd');
         this._prevRevealer.add(prevButton);
-        prevButton.connect('clicked', this._onPrevClicked.bind(this));
         prevButton.connect('enter-notify-event', this._onEnterNotify.bind(this));
         prevButton.connect('leave-notify-event', this._onLeaveNotify.bind(this));
 
@@ -580,10 +580,10 @@ var PreviewNavControls = class PreviewNavControls {
         this._overlay.add_overlay(this._nextRevealer);
 
         let nextButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'go-next-symbolic',
-                                                                  pixel_size: 16 }) });
+                                                                  pixel_size: 16 }),
+                                          action_name: 'view.next-page' });
         nextButton.get_style_context().add_class('osd');
         this._nextRevealer.add(nextButton);
-        nextButton.connect('clicked', this._onNextClicked.bind(this));
         nextButton.connect('enter-notify-event', this._onEnterNotify.bind(this));
         nextButton.connect('leave-notify-event', this._onLeaveNotify.bind(this));
 
@@ -653,14 +653,6 @@ var PreviewNavControls = class PreviewNavControls {
         this._tapGesture.set_state(Gtk.EventSequenceState.DENIED);
     }
 
-    _onPrevClicked() {
-        this.preview.goPrev();
-    }
-
-    _onNextClicked() {
-        this.preview.goNext();
-    }
-
     _autoHide() {
         this._autoHideId = 0;
         this._visibleInternal = false;


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