[gnome-maps] placeEntry: Add support for geo URI input



commit 66a033d98c3a7329f25c89dbf9d8f50c064981c6
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sun Aug 16 12:54:09 2015 +0200

    placeEntry: Add support for geo URI input
    
    Add support for entering Geo URIs (RFC 5870) in the search bar.
    
    Example:
        geo:37.7869,-122.3997

 src/placeEntry.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/placeEntry.js b/src/placeEntry.js
index 5018a3f..6e3dbdd 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -195,6 +195,20 @@ const PlaceEntry = new Lang.Class({
             return true;
         }
 
+        if (this.text.startsWith('geo:')) {
+            let location = new Geocode.Location();
+
+            try {
+                location.set_from_uri(this.text);
+                this.place = new Place.Place({ location: location });
+            } catch(e) {
+                let msg = _("Failed to parse Geo URI");
+                Application.notificationManager.showMessage(msg);
+            }
+
+            return true;
+        }
+
         let parsedLocation = this._parseCoordinates(this.text);
         if (parsedLocation) {
             this.place = new Place.Place({ location: parsedLocation });


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