[gnome-maps] mapView: Only show userLocation when enabled



commit 0f1d986cb9fecdc8f7d65a8d8705b538d9663d9b
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Dec 3 20:25:09 2014 +0100

    mapView: Only show userLocation when enabled
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740379

 src/mapView.js |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index a5be3eb..39b201d 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -28,6 +28,7 @@ const GtkChamplain = imports.gi.GtkChamplain;
 const Lang = imports.lang;
 
 const Application = imports.application;
+const Geoclue = imports.geoclue;
 const MapWalker = imports.mapWalker;
 const Place = imports.place;
 const SearchResultMarker = imports.searchResultMarker;
@@ -78,7 +79,9 @@ const MapView = new Lang.Class({
         this.setMapType(MapType.STREET);
 
         this._updateUserLocation();
-        Application.geoclue.connect("location-changed",
+        Application.geoclue.connect('location-changed',
+                                    this._updateUserLocation.bind(this));
+        Application.geoclue.connect('notify::state',
                                     this._updateUserLocation.bind(this));
 
         this._connectRouteSignals();
@@ -164,8 +167,15 @@ const MapView = new Lang.Class({
     },
 
     _updateUserLocation: function() {
-        if (!Application.geoclue || !Application.geoclue.place)
+        if (!Application.geoclue.place)
+            return;
+
+        if (Application.geoclue.state !== Geoclue.State.ON) {
+            if (this._userLocation)
+                this._userLocation.destroy();
+            this._userLocation = null;
             return;
+        }
 
         let place = Application.geoclue.place;
 


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