[gnome-documents] preview: fix showing of fullscreen toolbar



commit f4d2fa2815210196875ddccd5bedda42f7b0192a
Author: Cosimo Cecchi <cosimo endlesm com>
Date:   Tue Dec 23 22:28:53 2014 +0800

    preview: fix showing of fullscreen toolbar
    
    Since a recent change in libevinceview, the selection-changed signal is
    now emitted on the EvinceView also when the selection hasn't actually
    changed. This caused our logic to interpret every ckick in fullscreen as
    "selection has changed", and we would never activate the fullscreen
    toolbar, which is supposed to show on click when nothing else is
    selected.
    Cache the selection state in the view to work this around.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725372

 src/preview.js |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index f1e49cd..fde4c95 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -54,6 +54,7 @@ const PreviewView = new Lang.Class({
         this._controlsFlipId = 0;
         this._controlsVisible = false;
         this._pageChanged = false;
+        this._hasSelection = false;
         this._viewSelectionChanged = false;
         this._fsToolbar = null;
         this._overlay = overlay;
@@ -248,10 +249,18 @@ const PreviewView = new Lang.Class({
     },
 
     _onViewSelectionChanged: function() {
+        let hasSelection = this.view.get_has_selection();
+        this._copy.enabled = hasSelection;
+
+        if (!hasSelection &&
+            hasSelection == this._hasSelection) {
+            this._viewSelectionChanged = false;
+            return;
+        }
+
+        this._hasSelection = hasSelection;
         this._viewSelectionChanged = true;
-        let has_selection = this.view.get_has_selection();
-        this._copy.enabled = has_selection;
-        if (!has_selection)
+        if (!hasSelection)
             this._cancelControlsFlip();
     },
 


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