[gnome-books/wip/hadess/fix-preview-warnings: 3/3] preview: use action_name for prev/next buttons



commit 855c492cf829bba90b21512adec3a9dc132de8dd
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 | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index 4dbcf57a..dbbc3a52 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -588,10 +588,11 @@ var PreviewNavControls = new Lang.Class({
         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', Lang.bind(this, this._onPrevClicked));
         prevButton.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
         prevButton.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
 
@@ -603,10 +604,11 @@ var PreviewNavControls = new Lang.Class({
         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', Lang.bind(this, this._onNextClicked));
         nextButton.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
         nextButton.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
 
@@ -676,14 +678,6 @@ var PreviewNavControls = new Lang.Class({
         this._tapGesture.set_state(Gtk.EventSequenceState.DENIED);
     },
 
-    _onPrevClicked: function() {
-        this.preview.goPrev();
-    },
-
-    _onNextClicked: function() {
-        this.preview.goNext();
-    },
-
     _autoHide: function() {
         this._autoHideId = 0;
         this._visibleInternal = false;


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