[gnome-maps] Add tag toilets to map bubbles



commit a7116e299672f0c8c6ac09fad4e865e8b013a15c
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue May 30 11:31:36 2017 +1200

    Add tag toilets to map bubbles
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783225

 src/overpass.js     |    2 ++
 src/place.js        |   18 +++++++++++++++++-
 src/placeBubble.js  |    5 +++++
 src/translations.js |    8 ++++++++
 4 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/overpass.js b/src/overpass.js
index a12a628..705e1e9 100644
--- a/src/overpass.js
+++ b/src/overpass.js
@@ -110,6 +110,8 @@ const Overpass = new Lang.Class({
             place.location.altitude = parseFloat(element.tags.ele);
         if (element.tags.religion)
             place.religion = element.tags.religion
+        if (element.tags.toilets)
+            place.toilets = element.tags.toilets;
     },
 
     _getQueryUrl: function(place) {
diff --git a/src/place.js b/src/place.js
index 931f074..a8938f7 100644
--- a/src/place.js
+++ b/src/place.js
@@ -55,6 +55,9 @@ const Place = new Lang.Class({
         this._religion = params.religion;
         delete params.religion;
 
+        this._toilets = params.toilets;
+        delete params.toilets;
+
         /* Determines if the place should be added to the place store */
         if (typeof(params.store) === 'undefined') {
             this._store = true;
@@ -173,6 +176,18 @@ const Place = new Lang.Class({
         return Translations.translateReligion(this._religion);
     },
 
+    set toilets(v) {
+        this._toilets = v;
+    },
+
+    get toilets() {
+        return this._toilets;
+    },
+
+    get toiletsTranslated() {
+        return Translations.translateYesNo(this._toilets);
+    },
+
     set wheelchair(v) {
         this._wheelchair = v;
     },
@@ -257,7 +272,8 @@ const Place = new Lang.Class({
                  wheelchair: this.wheelchair,
                  openingHours: this.openingHours,
                  internetAccess: this.internetAccess,
-                 religion: this.religion };
+                 religion: this.religion,
+                 toilets: this.toilets };
     },
 
     match: function(searchString) {
diff --git a/src/placeBubble.js b/src/placeBubble.js
index decf0d4..783c51d 100644
--- a/src/placeBubble.js
+++ b/src/placeBubble.js
@@ -144,6 +144,11 @@ const PlaceBubble = new Lang.Class({
                                    info: place.religionTranslated });
         }
 
+        if (place.toilets) {
+            expandedContent.push({ label: _("Toilets:"),
+                                   info: place.toiletsTranslated });
+        }
+
         if (place.wheelchair) {
             expandedContent.push({ label: _("Wheelchair access:"),
                                    info: place.wheelchairTranslated });
diff --git a/src/translations.js b/src/translations.js
index e9a2307..73c0c7c 100644
--- a/src/translations.js
+++ b/src/translations.js
@@ -385,3 +385,11 @@ function translateReligion(string) {
     default: return null;
     }
 }
+
+function translateYesNo(string) {
+    switch(string) {
+    case 'yes': return _("yes");
+    case 'no': return _("no");
+    default: return null;
+    }
+}


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