[gnome-maps/wip/jonasdn/mapbubbles: 4/5] placeFormatter: Include less



commit b4dd340a97ad418530bf65a134407ed6e65c6546
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 |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/src/placeFormatter.js b/src/placeFormatter.js
index c9fe112..30b08ae 100644
--- a/src/placeFormatter.js
+++ b/src/placeFormatter.js
@@ -79,25 +79,23 @@ 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:
             if (this._place.town)
                 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 +105,7 @@ 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(['postal_code']);
-            if (this._place.county !== this._place.state)
-                this._addRow(['county']);
-            this._addRow(['state', 'country']);
+                this._addRow(['postal_code', 'town']);
             break;
         }
     },


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