summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2023-05-11 22:50:24 +0200
committerMarcus Lundblad <ml@dfupdate.se>2023-05-11 23:01:46 +0200
commit0a7c21b3b7ada0a3ed37a13d8d99404f9dd420de (patch)
tree7a01fcdad25703dcd9ea0230f914dec3dcfa2ea3
parent98048b41bb66eb60b3edd847045580f1808fe663 (diff)
downloadgnome-maps-0a7c21b3b7ada0a3ed37a13d8d99404f9dd420de.tar.gz
placeView: Use callback method to populate with Overpass
-rw-r--r--src/placeView.js29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/placeView.js b/src/placeView.js
index 84924e04..f4aad5c1 100644
--- a/src/placeView.js
+++ b/src/placeView.js
@@ -114,24 +114,18 @@ export class PlaceView extends Gtk.Box {
} else {
let overpass = new Overpass();
- /* use a property binding from the Overpass instance to avoid
- * accessing this object after the underlying GObject has
- * been finalized */
- overpass.bind_property('place', this, 'overpass-place',
- GObject.BindingFlags.DEFAULT);
- this.connect('notify::overpass-place', () => this._onInfoAdded());
-
if (Application.placeStore.exists(this.place, null)) {
// If the place is stale, update from Overpass.
if (Application.placeStore.isStale(this.place)) {
- overpass.addInfo(this.place);
+ overpass.populatePlace(this.place,
+ this._onOverpass.bind(this));
} else {
this._place = Application.placeStore.get(this.place);
this._populate(this.place);
}
} else if (this.place.store && !this.place.prefilled) {
- overpass.addInfo(this.place);
+ overpass.populatePlace(this.place, this._onOverpass.bind(this));
} else {
this._populate(this.place);
}
@@ -215,8 +209,12 @@ export class PlaceView extends Gtk.Box {
}
}
- _onInfoAdded() {
+ _onOverpass(success) {
+ if (!success)
+ return;
+
this._populate(this.place);
+
if (Application.placeStore.exists(this.place, null))
Application.placeStore.updatePlace(this.place);
else
@@ -655,13 +653,4 @@ export class PlaceView extends Gtk.Box {
}
}
-GObject.registerClass({
- Properties: {
- 'overpass-place': GObject.ParamSpec.object('overpass-place',
- 'Overpass Place',
- 'The place as filled in by Overpass',
- GObject.ParamFlags.READABLE |
- GObject.ParamFlags.WRITABLE,
- GeocodeGlib.Place)
- }
-}, PlaceView);
+GObject.registerClass(PlaceView);