[gnome-documents/wip/lokdocview-rebase: 25/27] Fix whether Copy is available



commit 51f98b6e127a8313a6fdf7a4e031457f3bea2b76
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Dec 14 15:40:59 2015 +0100

    Fix whether Copy is available
    
    Now that
    https://bugs.documentfoundation.org/show_bug.cgi?id=96384
    is fixed.

 src/lokview.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/lokview.js b/src/lokview.js
index 5b54bf1..309b709 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -184,8 +184,6 @@ const LOKView = new Lang.Class({
         this._progressBar.hide();
         this.set_visible_child_name('view');
         this.view.set_edit(false);
-        // FIXME https://bugs.documentfoundation.org/show_bug.cgi?id=96384
-        this._copy.enabled = true;
     },
 
     reset: function () {
@@ -193,6 +191,7 @@ const LOKView = new Lang.Class({
             return;
         this.view.reset_view();
         this.set_visible_child_full('view', Gtk.StackTransitionType.NONE);
+        this._copy.enabled = false;
     },
 
     _createView: function() {
@@ -201,6 +200,7 @@ const LOKView = new Lang.Class({
             this._sw.add(this.view);
             this.view.show();
             this.view.connect('load-changed', Lang.bind(this, this._onProgressChanged));
+            this.view.connect('text-selection', Lang.bind(this, this._onTextSelection));
         }
 
         this._navControls = new LOKViewNavControls(this, this._overlay);
@@ -211,6 +211,10 @@ const LOKView = new Lang.Class({
         this._progressBar.fraction = this.view.load_progress;
     },
 
+    _onTextSelection: function(hasSelection) {
+        this._copy.enabled = hasSelection;
+    },
+
     _setError: function(primary, secondary) {
         this._errorBox.update(primary, secondary);
         this.set_visible_child_name('error');


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