[gnome-maps] mapMarker: Enable use without mapView



commit 62604dba3c67acae2a88afad2211cd5000360cba
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Feb 24 09:08:15 2016 +0100

    mapMarker: Enable use without mapView
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762303

 src/mapMarker.js |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/src/mapMarker.js b/src/mapMarker.js
index ce70716..7ad9516 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -51,8 +51,6 @@ const MapMarker = new Lang.Class({
         this._mapView = params.mapView;
         delete params.mapView;
 
-        this._view = this._mapView.view;
-
         params.latitude = this.place.location.latitude;
         params.longitude = this.place.location.longitude;
         params.selectable = true;
@@ -60,18 +58,21 @@ const MapMarker = new Lang.Class({
         this.parent(params);
 
         this.connect('notify::size', this._translateMarkerPosition.bind(this));
-        this.connect('notify::selected', this._onMarkerSelected.bind(this));
-        this.connect('button-press', this._onButtonPress.bind(this));
-
-        // Some markers are draggable, we want to sync the marker location and
-        // the location saved in the GeocodePlace
-        this.bind_property('latitude',
-                           this.place.location, 'latitude',
-                           GObject.BindingFlags.DEFAULT);
-
-        this.bind_property('longitude',
-                           this.place.location, 'longitude',
-                           GObject.BindingFlags.DEFAULT);
+        if (this._mapView) {
+            this._view = this._mapView.view;
+            this.connect('notify::selected', this._onMarkerSelected.bind(this));
+            this.connect('button-press', this._onButtonPress.bind(this));
+
+            // Some markers are draggable, we want to sync the marker location and
+            // the location saved in the GeocodePlace
+            this.bind_property('latitude',
+                               this.place.location, 'latitude',
+                               GObject.BindingFlags.DEFAULT);
+
+            this.bind_property('longitude',
+                               this.place.location, 'longitude',
+                               GObject.BindingFlags.DEFAULT);
+        }
     },
 
     get surface() {


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