[sushi] Remove toolbar autohide timeout when button is clicked



commit 7da70001dc323318afbbceb5a581bcd522e9246b
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jun 22 15:20:39 2019 -0700

    Remove toolbar autohide timeout when button is clicked
    
    This is particularly visible in the PDF renderer, where clicking
    on the next page will make the toolbar disappear after the timeout.

 src/ui/utils.js       | 9 ++++++---
 src/viewers/evince.js | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/ui/utils.js b/src/ui/utils.js
index e203c05..293dd9a 100644
--- a/src/ui/utils.js
+++ b/src/ui/utils.js
@@ -58,16 +58,19 @@ function getScaledSize(baseSize, allocSize, upscale) {
     return [ Math.floor(width), Math.floor(height) ];
 }
 
-function createToolButton(iconName, callback) {
+function createToolButton(renderer, iconName, callback) {
     let button = Gtk.Button.new_from_icon_name(iconName, Gtk.IconSize.MENU);
     button.set_relief(Gtk.ReliefStyle.NONE);
-    button.connect('clicked', callback);
+    button.connect('clicked', () => {
+        renderer.resetToolbarTimeout();
+        callback(button);
+    });
 
     return button;
 }
 
 function createFullscreenButton(renderer) {
-    return createToolButton('view-fullscreen-symbolic', function(button) {
+    return createToolButton(renderer, 'view-fullscreen-symbolic', (button) => {
         renderer.toggleFullscreen();
         if (renderer.fullscreen)
             button.icon_name = 'view-restore-symbolic';
diff --git a/src/viewers/evince.js b/src/viewers/evince.js
index cd62bb1..103213e 100644
--- a/src/viewers/evince.js
+++ b/src/viewers/evince.js
@@ -110,7 +110,7 @@ var Klass = GObject.registerClass({
     }
 
     populateToolbar(toolbar) {
-        this._toolbarBack = Utils.createToolButton('go-previous-symbolic', () => {
+        this._toolbarBack = Utils.createToolButton(this, 'go-previous-symbolic', () => {
             this._view.previous_page();
         });
         toolbar.add(this._toolbarBack);
@@ -120,7 +120,7 @@ var Klass = GObject.registerClass({
                                           margin_end: 10 });
         toolbar.add(this._pageLabel);
 
-        this._toolbarForward = Utils.createToolButton('go-next-symbolic', () => {
+        this._toolbarForward = Utils.createToolButton(this, 'go-next-symbolic', () => {
             this._view.next_page();
         });
         toolbar.add(this._toolbarForward);


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