[gnome-maps] searchResultBubble: Refresh place if stale



commit 3759214aabc72f3cb7214cdf94c659f5c0a94358
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Mon Jan 5 07:36:54 2015 -0500

    searchResultBubble: Refresh place if stale
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742374

 src/searchResultBubble.js |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/searchResultBubble.js b/src/searchResultBubble.js
index 0addcf9..1dcceac 100644
--- a/src/searchResultBubble.js
+++ b/src/searchResultBubble.js
@@ -54,11 +54,20 @@ const SearchResultBubble = new Lang.Class({
         this._title = ui.labelTitle;
         this._boxContent = ui.boxContent;
 
+        let overpass = new Overpass.Overpass();
         if (Application.placeStore.exists(this.place, null)) {
-            let place = Application.placeStore.get(this.place);
-            this._populate(place);
+
+            // If the place is stale, update from Overpass.
+            if (Application.placeStore.isStale(this.place)) {
+                overpass.addInfo(this.place, (function(status, code) {
+                    this._populate(this.place);
+                    Application.placeStore.updatePlace(this.place);
+                }).bind(this));
+            } else {
+                let place = Application.placeStore.get(this.place);
+                this._populate(place);
+            }
         } else {
-            let overpass = new Overpass.Overpass();
             overpass.addInfo(this.place, (function(status, code) {
                 this._populate(this.place);
                 Application.placeStore.addPlace(this.place,


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