[gnome-maps] placeStore: Make exists method public



commit bf0b5058127c9def4b32af967aa8f42a6ce7fb70
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Wed Nov 12 03:16:15 2014 -0500

    placeStore: Make exists method public
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726625

 src/placeStore.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/placeStore.js b/src/placeStore.js
index 3d5d944..fbe5081 100644
--- a/src/placeStore.js
+++ b/src/placeStore.js
@@ -90,10 +90,10 @@ const PlaceStore = new Lang.Class({
     },
 
     addFavorite: function(place) {
-        if (this._exists(place, PlaceType.FAVORITE))
+        if (this.exists(place.osm_id, PlaceType.FAVORITE))
             return;
 
-        if (this._exists(place, PlaceType.RECENT)) {
+        if (this.exists(place.osm_id, PlaceType.RECENT)) {
             this._removeIf((function(model, iter) {
                 let p = model.get_value(iter, Columns.PLACE);
                 return p.osm_id === place.osm_id;
@@ -103,7 +103,7 @@ const PlaceStore = new Lang.Class({
     },
 
     addRecent: function(place) {
-        if (this._exists(place, PlaceType.RECENT)) {
+        if (this.exists(place.osm_id, PlaceType.RECENT)) {
             this._updatePlace(place);
             return;
         }
@@ -192,8 +192,11 @@ const PlaceStore = new Lang.Class({
         this._typeTable[place.osm_id] = type;
     },
 
-    _exists: function(place, type) {
-        return this._typeTable[place.osm_id] === type;
+    exists: function(osmId, type) {
+        if (type)
+            return this._typeTable[osmId] === type;
+        else
+            return this._typeTable[osmId] !== undefined;
     },
 
     _removeIf: function(evalFunc, stop) {


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