summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2019-06-21 00:00:46 +0200
committerMarcus Lundblad <ml@update.uu.se>2019-07-09 22:46:30 +0200
commit8e6baf636186da8be01690bf8534838d122a45e7 (patch)
tree348e87f384c25645131ea21e97237204be8d4218
parent18fbfebc3baef346356170ad3aa8eaef4d5173ce (diff)
downloadgnome-maps-8e6baf636186da8be01690bf8534838d122a45e7.tar.gz
placeEntry: Parse HTTP(s) URIs
Handle search strings starting with http:// or https:// parsing those directly as URLs.
-rw-r--r--src/placeEntry.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/placeEntry.js b/src/placeEntry.js
index d1a446aa..aba76d4e 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();