summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2020-10-29 10:38:46 +0100
committerMarcus Lundblad <ml@update.uu.se>2020-11-11 22:50:30 +0100
commit32db4f1dae05020544b54ba223f061e7711395f8 (patch)
tree9f4c7f9010ddc7382080d8ad0fad5ff36fd854e3
parent020507047aae0adc9f4f865ec37167fb890923de (diff)
downloadgnome-maps-wip/mlundblad/simplify-place-init.tar.gz
storedRoute: Use place array directlywip/mlundblad/simplify-place-init
Store the passed-in array of sub-places directly instead of initializing a new Place instance from each object, as they are already the appropriate type.
-rw-r--r--src/storedRoute.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/storedRoute.js b/src/storedRoute.js
index b9e0bc85..784c6693 100644
--- a/src/storedRoute.js
+++ b/src/storedRoute.js
@@ -52,29 +52,26 @@ class StoredRoute extends Place.Place {
this._rtl = Gtk.get_locale_direction() === Gtk.TextDirection.RTL;
- let places = params.places;
+ this.places = params.places;
delete params.places;
let directionMarker = this._rtl ? _RLM : _LRM;
let arrow = this._rtl ? '←' : '→';
- params.name = directionMarker + places[0].name + directionMarker +
- arrow + directionMarker + places[places.length -1].name;
+ params.name = directionMarker + this.places[0].name + directionMarker +
+ arrow + directionMarker + this.places.last().name;
let geoclue = params.geoclue;
delete params.geoclue;
- this.places = [];
this._containsCurrentLocation = false;
let currentLocation = null;
if (geoclue)
currentLocation = geoclue.place;
- places.forEach((place) => {
+ this.places.forEach((place) => {
if (currentLocation && place === currentLocation)
this._containsCurrentLocation = true;
-
- this.places.push(new Place.Place({ place: place }));
});
super._init(params);