[gnome-maps/wip/jonasdn/mapbubbles: 1/2] placeFormatter: Include less



commit 5484a8d3db15e8497c26e51c86ef67c3c87fd2b8
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sun Jan 31 10:42:24 2016 +0100

    placeFormatter: Include less
    
    Much is given by context.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741423

 src/placeFormatter.js |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/src/placeFormatter.js b/src/placeFormatter.js
index c9fe112..3910228 100644
--- a/src/placeFormatter.js
+++ b/src/placeFormatter.js
@@ -79,15 +79,11 @@ const PlaceFormatter = new Lang.Class({
         case Geocode.PlaceType.STATE:
             if (this._place.state)
                 this._titleProperty = 'state';
-
-            this._addRow(['country']);
             break;
 
         case Geocode.PlaceType.COUNTY:
             if (this._place.county)
                 this._titleProperty = 'county';
-
-            this._addRow(['state', 'country']);
             break;
 
         case Geocode.PlaceType.TOWN:
@@ -95,9 +91,13 @@ const PlaceFormatter = new Lang.Class({
                 this._titleProperty = 'town';
 
             this._addRow(['postal_code']);
-            if (this._place.county !== this._place.state)
+
+            if (this._place.county)
                 this._addRow(['county']);
-            this._addRow(['state', 'country']);
+            else if (this._place.state)
+                this._addRow(['state']);
+            else if (this._place.area)
+                this._addRow(['area']);
             break;
 
         default:
@@ -107,14 +107,10 @@ const PlaceFormatter = new Lang.Class({
                 this._addRow(['street']);
 
             if (this._place.town !== this._place[this._titleProperty])
-                this._addRow(['area', 'town']);
-            else
-                this._addRow(['area']);
+                this._addRow(['town']);
+
 
             this._addRow(['postal_code']);
-            if (this._place.county !== this._place.state)
-                this._addRow(['county']);
-            this._addRow(['state', 'country']);
             break;
         }
     },


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