[gnome-maps/wip/mlundblad/handle-osm-urls: 4/5] mapView: Add a function to got an HTTP URL



commit 27699cfa38c8de92c8e41500c4900fe02948264b
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Jul 8 19:19:24 2019 +0200

    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.

 src/mapView.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/mapView.js b/src/mapView.js
index 57ec994..703ee5b 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -24,6 +24,7 @@ const Clutter = imports.gi.Clutter;
 const GObject = imports.gi.GObject;
 const Geocode = imports.gi.GeocodeGlib;
 const Gio = imports.gi.Gio;
+const Gtk = imports.gi.Gtk;
 const GtkChamplain = imports.gi.GtkChamplain;
 const Mainloop = imports.mainloop;
 
@@ -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) {
         if (!this._userLocation)
             return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]