summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2023-04-01 12:41:24 +0200
committerMarcus Lundblad <ml@dfupdate.se>2023-04-27 22:03:38 +0200
commit84e4babbb2e067568a41b5e58e0b75ddfb250704 (patch)
tree8ccf5b5a8df8a4f7718ca7fd9f81871bfd7c359a
parent9215b57d13322c5c50e255413c1ae59401865ac1 (diff)
downloadgnome-maps-84e4babbb2e067568a41b5e58e0b75ddfb250704.tar.gz
placePopover: Show distance POI search results
-rw-r--r--data/ui/place-popover.ui3
-rw-r--r--src/placePopover.js16
2 files changed, 18 insertions, 1 deletions
diff --git a/data/ui/place-popover.ui b/data/ui/place-popover.ui
index 16b8c094..21bb1a99 100644
--- a/data/ui/place-popover.ui
+++ b/data/ui/place-popover.ui
@@ -75,4 +75,7 @@
</object>
</property>
</template>
+ <object class="GtkSizeGroup" id="distanceLabelSizeGroup">
+ <property name="mode">horizontal</property>
+ </object>
</interface>
diff --git a/src/placePopover.js b/src/placePopover.js
index a73e8383..82dd1004 100644
--- a/src/placePopover.js
+++ b/src/placePopover.js
@@ -60,6 +60,17 @@ export class PlacePopover extends SearchPopover {
this._stack.visible_child === this._poiSubCategories;
}
+ _updateDistances() {
+ let viewport = this._entry.mapView.map.viewport;
+ let location = new Geocode.Location({ latitude: viewport.latitude,
+ longitude: viewport.longitude,
+ accuracy: 0 });
+
+ for (let row of this.list) {
+ row.setDistanceFrom(location);
+ }
+ }
+
_createPoiCategories() {
let categoryStructure = PoiCategories.getCategoryStructure();
@@ -153,6 +164,7 @@ export class PlacePopover extends SearchPopover {
let completedPlaces = placeStore.getCompletedPlaces(results);
this.updateResult(completedPlaces, '');
+ this._updateDistances();
this.showResult();
this._entry.grab_focus();
}
@@ -270,6 +282,7 @@ export class PlacePopover extends SearchPopover {
let row = new PlaceListRow({ place: place,
searchString: searchString,
type: type,
+ sizeGroup: this._distanceLabelSizeGroup,
can_focus: true });
this.list.insert(row, -1);
}
@@ -287,5 +300,6 @@ GObject.registerClass({
'noResultsLabel',
'errorLabel',
'poiMainCategories',
- 'poiSubCategories'],
+ 'poiSubCategories',
+ 'distanceLabelSizeGroup' ],
}, PlacePopover);