[gnome-maps/wip/places-api] MapView: Adapt to new geocode-glib's geocoding API



commit fc3adf0a9e3d8d5b226c6ab9ccfff9cac801dabb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 7 02:47:58 2013 +0300

    MapView: Adapt to new geocode-glib's geocoding API
    
    The geocoding API now returns Place objects with possibly a lot more
    details, rather than simple Location objects.
    
    For now we just take the Location out of the Place object and use it
    like we have been doing so far but later we'll want to actually utilize
    the information provided by Place.

 src/mapView.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 01028d6..22858df 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -91,11 +91,15 @@ const MapView = new Lang.Class({
         forward.search_async (null, Lang.bind(this,
             function(forward, res) {
                 try {
-                    let locations = forward.search_finish(res);
-                    log (locations.length + " locations found");
+                    let places = forward.search_finish(res);
+                    log (places.length + " places found");
                     let mapLocations = new Array();
-                    locations.forEach(Lang.bind(this,
-                        function(location) {
+                    places.forEach(Lang.bind(this,
+                        function(place) {
+                            let location = place.get_location();
+                            if (location == null)
+                                return;
+
                             let mapLocation = new MapLocation.MapLocation(location, this);
                             mapLocations.push(mapLocation);
                         }));


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