[gnome-maps/wip/mlundblad/handle-osm-urls: 8/8] WIP: placeEntry: Parse OSM URLs
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/handle-osm-urls: 8/8] WIP: placeEntry: Parse OSM URLs
- Date: Thu, 27 Jun 2019 21:08:30 +0000 (UTC)
commit 547274c74f68fe397a710a2f89d2fd6df6613fd9
Author: Marcus Lundblad <ml update uu se>
Date: Fri Jun 21 00:00:46 2019 +0200
WIP: placeEntry: Parse OSM URLs
src/placeEntry.js | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/src/placeEntry.js b/src/placeEntry.js
index d1a446a..2614dd3 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -20,6 +20,8 @@
* Mattias Bengtsson <mattias jc bengtsson gmail com>
*/
+const _ = imports.gettext.gettext;
+
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Geocode = imports.gi.GeocodeGlib;
@@ -213,6 +215,24 @@ var PlaceEntry = GObject.registerClass({
parsed = true;
}
+ if (Place.matchOSMURL(this.text)) {
+ if (this._cancellable)
+ this._cancellable.cancel();
+ this._cancellable = null;
+ Place.parseOSMURL(this.text, (place) => {
+ if (place)
+ this.place = place;
+ else
+ Utils.showDialog(_("Object not found in OpenStreetMap"),
+ Gtk.MessageType.ERROR, this.get_toplevel());
+ });
+
+ /* don't cancel ongoing search, as we have started an async
+ * operation looking up the OSM object
+ */
+ return true;
+ }
+
if (parsed && this._cancellable)
this._cancellable.cancel();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]