[gnome-maps/wip/mlundblad/maps-uri: 4/5] placeEntry: Allow pasting maps: URIs into the search entry




commit 21f3b99a950e1a6a5e8eb3dcfd814277f44b932d
Author: Marcus Lundblad <ml update uu se>
Date:   Wed Nov 3 09:20:46 2021 +0100

    placeEntry: Allow pasting maps: URIs into the search entry

 src/placeEntry.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/placeEntry.js b/src/placeEntry.js
index 5bbfd348..c39823cd 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -34,6 +34,7 @@ const Location = imports.location;
 const Place = imports.place;
 const PlaceStore = imports.placeStore;
 const PlacePopover = imports.placePopover;
+const URIS = imports.uris;
 const Utils = imports.utils;
 
 // minimum number of characters to start completion
@@ -225,6 +226,19 @@ var PlaceEntry = GObject.registerClass({
             parsed = true;
         }
 
+        if (this.text.startsWith('maps:')) {
+            let query = URIS.parseMapsURI(this.text);
+
+            if (query) {
+                this.text = query;
+            } else {
+                let msg = _("Failed to parse Maps URI");
+                Utils.showDialog(msg, Gtk.MessageType.ERROR, this.get_toplevel());
+            }
+
+            parsed = true;
+        }
+
         let parsedLocation = Place.Place.parseCoordinates(this.text);
         if (parsedLocation) {
             /* if the place was a parsed OSM coordinate URL, it will have


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