[gnome-maps/wip/mlundblad/handle-osm-urls: 11/11] 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: 11/11] WIP: placeEntry: Parse OSM URLs
- Date: Sat, 6 Jul 2019 12:28:02 +0000 (UTC)
commit 6f8e75fa1fe2a8caad5c14e3e859d6cd85c0242a
Author: Marcus Lundblad <ml update uu se>
Date: Fri Jun 21 00:00:46 2019 +0200
WIP: placeEntry: Parse OSM URLs
src/placeEntry.js | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/src/placeEntry.js b/src/placeEntry.js
index d1a446a..aba76d4 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,25 @@ var PlaceEntry = GObject.registerClass({
parsed = true;
}
+ if (this.text.startsWith('http://') ||
+ this.text.startsWith('https://')) {
+ if (this._cancellable)
+ this._cancellable.cancel();
+ this._cancellable = null;
+ Place.parseHttpURL(this.text, (place, error) => {
+ if (place)
+ this.place = place;
+ else
+ Utils.showDialog(error,
+ 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]