[gnome-documents] lokview: Only connect to signals when LOKDocView is available



commit 99b3072d9e8f55bedc4cbcadf9746ff16ca4bd16
Author: Pranav Kant <pranavk gnome org>
Date:   Thu Jan 21 14:34:35 2016 +0530

    lokview: Only connect to signals when LOKDocView is available
    
    Otherwise, it would crash during startup trying to connect to signals
    on an undefined LOKDocView instance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753686

 src/lokview.js |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/lokview.js b/src/lokview.js
index bab72f4..f04dfa1 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -137,8 +137,6 @@ const LOKView = new Lang.Class({
         this.show_all();
 
         this._zoomIn = Application.application.lookup_action('zoom-in');
-        this.view.connect('notify::can-zoom-in', Lang.bind(this,
-            this._onCanZoomInChanged));
         let zoomInId = this._zoomIn.connect('activate', Lang.bind(this,
             function() {
                 let zoomLevel = this.view.get_zoom() * ZOOM_IN_FACTOR;
@@ -146,8 +144,6 @@ const LOKView = new Lang.Class({
             }));
 
         this._zoomOut = Application.application.lookup_action('zoom-out');
-        this.view.connect('notify::can-zoom-out', Lang.bind(this,
-            this._onCanZoomOutChanged));
         let zoomOutId = this._zoomOut.connect('activate', Lang.bind(this,
             function() {
                 let zoomLevel = this.view.get_zoom() * ZOOM_OUT_FACTOR;
@@ -237,6 +233,8 @@ const LOKView = new Lang.Class({
             this.view.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent));
             this.view.connect('load-changed', Lang.bind(this, this._onProgressChanged));
             this.view.connect('text-selection', Lang.bind(this, this._onTextSelection));
+            this.view.connect('notify::can-zoom-in', Lang.bind(this, this._onCanZoomInChanged));
+            this.view.connect('notify::can-zoom-out', Lang.bind(this, this._onCanZoomOutChanged));
         }
 
         this._navControls = new LOKViewNavControls(this, this._overlay);


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