[gnome-maps] Improve showing of contact



commit 268627936e0fa0bd1bba94ab193c61133544c5e8
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Fri Oct 9 21:07:14 2015 +0200

    Improve showing of contact
    
    Do not travel to a contacts bounding box if the
    contact only has one address.

 lib/maps-contact-store.c |    2 +-
 src/application.js       |    4 ++++
 src/mapView.js           |    5 ++++-
 3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/lib/maps-contact-store.c b/lib/maps-contact-store.c
index 036d8bc..168d175 100644
--- a/lib/maps-contact-store.c
+++ b/lib/maps-contact-store.c
@@ -173,7 +173,7 @@ get_contact (FolksIndividual *individual)
       name = g_strdup_printf ("%s (%s)",
                               folks_individual_get_display_name (individual),
                               type);
-      place = geocode_place_new (name, GEOCODE_PLACE_TYPE_UNKNOWN);
+      place = geocode_place_new (name, GEOCODE_PLACE_TYPE_STREET);
       g_free (name);
 
       geocode_place_set_country (place,
diff --git a/src/application.js b/src/application.js
index 0f583b2..2a6ca2c 100644
--- a/src/application.js
+++ b/src/application.js
@@ -114,6 +114,10 @@ const Application = new Lang.Class({
     _showContact: function(id) {
         contactStore.lookup(id, (function(contact) {
             this._mainWindow.markBusy();
+            if (!contact) {
+                this._mainWindow.unmarkBusy();
+                return;
+            }
             contact.geocode((function() {
                 this._mainWindow.unmarkBusy();
                 this._mainWindow.mapView.showContact(contact);
diff --git a/src/mapView.js b/src/mapView.js
index c37023e..185db2f 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -261,7 +261,10 @@ const MapView = new Lang.Class({
             this._placeLayer.add_marker(marker);
         }).bind(this));
 
-        this._gotoBBox(contact.bounding_box);
+        if (places.length > 1)
+            this._gotoBBox(contact.bounding_box);
+        else
+            new MapWalker.MapWalker(places[0], this).goTo(true);
     },
 
     _showStoredRoute: function(stored) {


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