[gnome-maps] Use Place instead of Location in mapLocation



commit 838bcf9402bfd01295b58cd7fe4b2089d1156137
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Jan 29 13:53:32 2014 +0100

    Use Place instead of Location in mapLocation
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722865

 src/contextMenu.js |    2 +-
 src/mainWindow.js  |    4 ++--
 src/mapLocation.js |   11 ++++++-----
 src/mapView.js     |   14 +++++++++-----
 4 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 095e438..78c6797 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -66,7 +66,7 @@ const ContextMenu = new Lang.Class({
                                               accuracy: 0 });
 
         this._reverseGeocode(location, (function(place) {
-            this._mapView.showLocation(place.location);
+            this._mapView.showLocation(place);
         }).bind(this));
     },
 
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 742d543..97f6261 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -117,7 +117,7 @@ const MainWindow = new Lang.Class({
         this._searchCompletion.set_model(this._placeStore);
         this._searchCompletion.connect('match-selected', (function(c, m, iter) {
             let place = m.get_value(iter, PlaceStore.Columns.PLACE);
-            this.mapView.showNGotoLocation(place.location);
+            this.mapView.showNGotoLocation(place);
             this._placeStore.addRecent(place);
         }).bind(this));
 
@@ -258,7 +258,7 @@ const MainWindow = new Lang.Class({
         let model = this._searchPopup.getModel();
         let place = model.get_value(iter, SearchResults.COL_PLACE);
 
-        this.mapView.showNGotoLocation(place.location);
+        this.mapView.showNGotoLocation(place);
 
         this._placeStore.addRecent(place);
         this._searchPopup.hide();
diff --git a/src/mapLocation.js b/src/mapLocation.js
index 6907fd0..0fd169b 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -40,13 +40,14 @@ const _MAX_ANIMATION_DURATION = 5000; // msec
 const MapLocation = new Lang.Class({
     Name: 'MapLocation',
 
-    _init: function(geocodeLocation, mapView) {
+    _init: function(place, mapView) {
         this._mapView = mapView;
         this._view = mapView.view;
-        this.latitude = geocodeLocation.latitude;
-        this.longitude = geocodeLocation.longitude;
-        this.description = geocodeLocation.description;
-        this.accuracy = geocodeLocation.accuracy;
+        this.latitude = place.location.latitude;
+        this.longitude = place.location.longitude;
+        this.description = place.location.description;
+        this.accuracy = place.location.accuracy;
+        this.type = place.place_type;
     },
 
     // Go to this location from the current location on the map, optionally
diff --git a/src/mapView.js b/src/mapView.js
index aae8d7b..8c32d1e 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -162,22 +162,26 @@ const MapView = new Lang.Class({
         if (!this.geoclue.location)
             return;
 
-        this._userLocation = new UserLocation.UserLocation(this.geoclue.location, this);
+        let place = Geocode.Place.new_with_location(this.geoclue.location.description,
+                                                    Geocode.PlaceType.UNKNOWN,
+                                                    this.geoclue.location);
+
+        this._userLocation = new UserLocation.UserLocation(place, this);
         this._userLocation.show(this._userLocationLayer);
         this.emit('user-location-changed');
     },
 
-    showLocation: function(location) {
+    showLocation: function(place) {
         this._markerLayer.remove_all();
-        let mapLocation = new MapLocation.MapLocation(location, this);
+        let mapLocation = new MapLocation.MapLocation(place, this);
 
         mapLocation.show(this._markerLayer);
 
         return mapLocation;
     },
 
-    showNGotoLocation: function(location) {
-        let mapLocation = this.showLocation(location);
+    showNGotoLocation: function(place) {
+        let mapLocation = this.showLocation(place);
         mapLocation.goTo(true);
     },
 


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