[gnome-maps] Use custom Location class everywhere in the code



commit baf0017e052bfb822060f40cd540df43f6691fc4
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jun 3 12:22:53 2015 +0100

    Use custom Location class everywhere in the code

 src/contextMenu.js     |    8 ++++----
 src/geoclue.js         |   10 +++++-----
 src/mapView.js         |    5 +++--
 src/mapWalker.js       |    5 +++--
 src/place.js           |    3 ++-
 src/placeEntry.js      |    7 ++++---
 src/socialPlace.js     |    5 +++--
 src/turnPointMarker.js |    8 ++++----
 8 files changed, 28 insertions(+), 23 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 2708e93..6e8f3b5 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -20,12 +20,12 @@
  */
 
 const Clutter = imports.gi.Clutter;
-const Geocode = imports.gi.GeocodeGlib;
 const Gtk = imports.gi.Gtk;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
 const Lang = imports.lang;
+const Location = imports.location;
 const Utils = imports.utils;
 
 const ContextMenu = new Lang.Class({
@@ -62,9 +62,9 @@ const ContextMenu = new Lang.Class({
     },
 
     _onWhatsHereActivated: function() {
-        let location = new Geocode.Location({ latitude: this._latitude,
-                                              longitude: this._longitude,
-                                              accuracy: 0 });
+        let location = new Location.Location({ latitude: this._latitude,
+                                               longitude: this._longitude,
+                                               accuracy: 0 });
 
         Application.geocodeService.reverse(location, null, (function(place) {
             this._mapView.showSearchResult(place);
diff --git a/src/geoclue.js b/src/geoclue.js
index 35af3bc..d714cb9 100644
--- a/src/geoclue.js
+++ b/src/geoclue.js
@@ -20,13 +20,13 @@
  */
 
 const GObject = imports.gi.GObject;
-const Geocode = imports.gi.GeocodeGlib;
 const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
 const Place = imports.place;
+const Location = imports.location;
 const Settings = imports.settings;
 const Utils = imports.utils;
 
@@ -190,10 +190,10 @@ const Geoclue = new Lang.Class({
         let geoclueLocation = new LocationProxy(Gio.DBus.system,
                                                 "org.freedesktop.GeoClue2",
                                                 newPath);
-        let location = new Geocode.Location({ latitude: geoclueLocation.Latitude,
-                                              longitude: geoclueLocation.Longitude,
-                                              accuracy: geoclueLocation.Accuracy,
-                                              description: geoclueLocation.Description });
+        let location = new Location.Location({ latitude: geoclueLocation.Latitude,
+                                               longitude: geoclueLocation.Longitude,
+                                               accuracy: geoclueLocation.Accuracy,
+                                               description: geoclueLocation.Description });
         this._updateLocation(location);
         if (this._timeoutId !== 0) {
             Mainloop.source_remove(this._timeoutId);
diff --git a/src/mapView.js b/src/mapView.js
index 36c2b7c..9718255 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -29,6 +29,7 @@ const Lang = imports.lang;
 const Application = imports.application;
 const ContactPlace = imports.contactPlace;
 const Geoclue = imports.geoclue;
+const Location = imports.location;
 const MapWalker = imports.mapWalker;
 const Place = imports.place;
 const PlaceMarker = imports.placeMarker;
@@ -196,8 +197,8 @@ const MapView = new Lang.Class({
     _gotoBBox: function(bbox) {
         let [lat, lon] = bbox.get_center();
         let place = new Place.Place({
-            location: new Geocode.Location({ latitude  : lat,
-                                             longitude : lon }),
+            location: new Location.Location({ latitude  : lat,
+                                              longitude : lon }),
             bounding_box: new Geocode.BoundingBox({ top    : bbox.top,
                                                     bottom : bbox.bottom,
                                                     left   : bbox.left,
diff --git a/src/mapWalker.js b/src/mapWalker.js
index 9486574..8bf4776 100644
--- a/src/mapWalker.js
+++ b/src/mapWalker.js
@@ -26,6 +26,7 @@ const Clutter = imports.gi.Clutter;
 const Geocode = imports.gi.GeocodeGlib;
 const Lang = imports.lang;
 
+const Location = imports.location;
 const Utils = imports.utils;
 
 const _MAX_DISTANCE = 19850; // half of Earth's circumference (km)
@@ -117,8 +118,8 @@ const MapWalker = new Lang.Class({
 
         this._view.goto_animation_mode = Clutter.AnimationMode.EASE_IN_CUBIC;
 
-        let fromLocation = new Geocode.Location({ latitude: this._view.get_center_latitude(),
-                                                  longitude: this._view.get_center_longitude() });
+        let fromLocation = new Location.Location({ latitude: this._view.get_center_latitude(),
+                                                   longitude: this._view.get_center_longitude() });
         this._updateGoToDuration(fromLocation);
 
         Utils.once(this._view, 'animation-completed', (function() {
diff --git a/src/place.js b/src/place.js
index 91dd178..c125b44 100644
--- a/src/place.js
+++ b/src/place.js
@@ -22,6 +22,7 @@
 const Geocode = imports.gi.GeocodeGlib;
 const GLib = imports.gi.GLib;
 const Lang = imports.lang;
+const Location = imports.location;
 const Translations = imports.translations;
 
 const Place = new Lang.Class({
@@ -212,7 +213,7 @@ Place.fromJSON = function(obj) {
                 break;
 
             case 'location':
-                props.location = new Geocode.Location(prop);
+                props.location = new Location.Location(prop);
                 break;
 
             case 'bounding_box':
diff --git a/src/placeEntry.js b/src/placeEntry.js
index 995cc59..bf954a2 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -28,12 +28,13 @@ const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 
 const Application = imports.application;
+const Location = imports.location;
 const Place = imports.place;
 const PlaceStore = imports.placeStore;
 const SearchPopup = imports.searchPopup;
 const Utils = imports.utils;
 
-Geocode.Location.prototype.equals = function(location) {
+Location.Location.prototype.equals = function(location) {
     return (location.latitude === this.latitude &&
             location.longitude === this.longitude);
 };
@@ -180,8 +181,8 @@ const PlaceEntry = new Lang.Class({
             let longitude = parseFloat(match[2]);
 
             if (this._validateCoordinates(latitude, longitude)) {
-                return new Geocode.Location({ latitude: latitude,
-                                              longitude: longitude });
+                return new Location.Location({ latitude: latitude,
+                                               longitude: longitude });
             } else
                 return null;
         } else
diff --git a/src/socialPlace.js b/src/socialPlace.js
index 0c4572c..f58da4e 100644
--- a/src/socialPlace.js
+++ b/src/socialPlace.js
@@ -22,6 +22,7 @@
 const Geocode = imports.gi.GeocodeGlib;
 const GObject = imports.gi.GObject;
 const Lang = imports.lang;
+const Location = imports.location;
 
 const SocialPlace = new Lang.Class({
     Name: 'SocialServiceSocialPlace',
@@ -40,7 +41,7 @@ const SocialPlace = new Lang.Class({
     },
 
     get location() {
-        return new Geocode.Location({ latitude: parseFloat(this.latitude),
-                                      longitude: parseFloat(this.longitude) });
+        return new Location.Location({ latitude: parseFloat(this.latitude),
+                                       longitude: parseFloat(this.longitude) });
     }
 });
diff --git a/src/turnPointMarker.js b/src/turnPointMarker.js
index 6ef119e..077bb62 100644
--- a/src/turnPointMarker.js
+++ b/src/turnPointMarker.js
@@ -21,11 +21,11 @@
 
 const Clutter = imports.gi.Clutter;
 const Gdk = imports.gi.Gdk;
-const Geocode = imports.gi.GeocodeGlib;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
+const Location = imports.location;
 const MapMarker = imports.mapMarker;
 const Place = imports.place;
 const Utils = imports.utils;
@@ -42,7 +42,7 @@ const TurnPointMarker = new Lang.Class({
         delete params.turnPoint;
 
         params.place = new Place.Place({
-            location: new Geocode.Location({
+            location: new Location.Location({
                 latitude: this._turnPoint.coordinate.get_latitude(),
                 longitude: this._turnPoint.coordinate.get_longitude()
             })
@@ -93,8 +93,8 @@ const TurnPointMarker = new Lang.Class({
     _onMarkerDrag: function() {
         let query = Application.routeService.query;
         let place = new Place.Place({
-            location: new Geocode.Location({ latitude: this.latitude.toFixed(5),
-                                             longitude: this.longitude.toFixed(5) }) });
+            location: new Location.Location({ latitude: this.latitude.toFixed(5),
+                                              longitude: this.longitude.toFixed(5) }) });
 
         this._queryPoint.place = place;
     }


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