[gnome-maps] Do not store routes with coordinate members
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Do not store routes with coordinate members
- Date: Tue, 8 Sep 2015 11:21:21 +0000 (UTC)
commit ab14a536cbac5189dac51b227d8862dafba9ad00
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Tue Sep 8 13:20:43 2015 +0200
Do not store routes with coordinate members
src/sidebar.js | 7 ++++---
src/storedRoute.js | 12 ++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/sidebar.js b/src/sidebar.js
index 7496b22..79fb75f 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -213,9 +213,10 @@ const Sidebar = new Lang.Class({
places: places
});
- placeStore.addPlace(storedRoute,
- PlaceStore.PlaceType.RECENT_ROUTE);
-
+ if (!storedRoute.containsNull) {
+ placeStore.addPlace(storedRoute,
+ PlaceStore.PlaceType.RECENT_ROUTE);
+ }
this._storeRouteTimeoutId = 0;
}).bind(this));
diff --git a/src/storedRoute.js b/src/storedRoute.js
index 16f761d..05e56de 100644
--- a/src/storedRoute.js
+++ b/src/storedRoute.js
@@ -102,6 +102,18 @@ const StoredRoute = new Lang.Class({
return this._containsCurrentLocation;
},
+ get containsNull() {
+ let hasNull = false;
+
+ for (let p = 0; p < this.places.length; p++) {
+ if (!this.places[p].name) {
+ hasNull = true;
+ break;
+ }
+ }
+ return hasNull;
+ },
+
toJSON: function() {
let turnPoints = this.route.turnPoints.map(function(turnPoint) {
let coordinate = { latitude: turnPoint.coordinate.latitude,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]