[gnome-maps/wip/mlundblad/simplify-place-init] storedRoute: Initiate Place directly




commit 2a1891684b6cf339cb17d8213bd858dfac317274
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Oct 29 10:38:46 2020 +0100

    storedRoute: Initiate Place directly

 src/storedRoute.js | 11 ++++-------
 1 file 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);


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