Commit 12d1745c authored by Marcus Lundblad's avatar Marcus Lundblad

mapView: Add a function to got an HTTP URL

Adds a function to go to a place represented
by an HTTP URL and select it.
parent 8e6baf63
...@@ -24,6 +24,7 @@ const Clutter = imports.gi.Clutter; ...@@ -24,6 +24,7 @@ const Clutter = imports.gi.Clutter;
const GObject = imports.gi.GObject; const GObject = imports.gi.GObject;
const Geocode = imports.gi.GeocodeGlib; const Geocode = imports.gi.GeocodeGlib;
const Gio = imports.gi.Gio; const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const GtkChamplain = imports.gi.GtkChamplain; const GtkChamplain = imports.gi.GtkChamplain;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
...@@ -404,6 +405,20 @@ var MapView = GObject.registerClass({ ...@@ -404,6 +405,20 @@ var MapView = GObject.registerClass({
} }
} }
goToHttpURL(url) {
Place.parseHttpURL(url, (place, error) => {
if (place) {
let marker = new PlaceMarker.PlaceMarker({ place: place,
mapView: this });
this._placeLayer.add_marker(marker);
marker.goToAndSelect(true);
} else {
Utils.showDialog(error, Gtk.MessageType.ERROR, this._mainWindow);
}
});
}
gotoUserLocation(animate) { gotoUserLocation(animate) {
if (!this._userLocation) if (!this._userLocation)
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment