[evolution] Bug #603469 - Crash in contacts-map with no Home address filled



commit 84d1cc73e2b9765b02b361a45c50b8bab25d4436
Author: Cedric Bosdonnat <cedricbosdo openoffice org>
Date:   Thu Jan 7 16:01:19 2010 +0100

    Bug #603469 - Crash in contacts-map with no Home address filled
    
    There was some confusion between the query using E_CONTACT_ADDRESS and
    the address used. Now the first of the following is shown in the map:
    Home, Work, Other.

 plugins/contacts-map/contacts-map.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/plugins/contacts-map/contacts-map.c b/plugins/contacts-map/contacts-map.c
index afde8e2..be3f9b1 100644
--- a/plugins/contacts-map/contacts-map.c
+++ b/plugins/contacts-map/contacts-map.c
@@ -142,11 +142,23 @@ show_map_general (ESourceSelector *selector)
 			EContact *contact;
 			EContactAddress *addr;
 			GHashTable *details;
+			gint i;
+			const gint addr_fields[] = {
+				E_CONTACT_ADDRESS_HOME,
+				E_CONTACT_ADDRESS_WORK,
+				E_CONTACT_ADDRESS_OTHER
+			};
 
 			contact = tmp->data;
 
 			/* Get the lat & lng and add the marker asynchronously */
-			addr = e_contact_get (contact, E_CONTACT_ADDRESS_HOME);
+			i = 0;
+			addr = NULL;
+			while (!addr && i<G_N_ELEMENTS(addr_fields)) {
+				addr = e_contact_get(contact, addr_fields[i]);
+				i++;
+			}
+
 			details = (GHashTable*) get_geoclue_from_address (addr);
 			fields = geoclue_geocode_address_to_position (geocoder, details,
 					&lat, &lng, NULL, &accuracy, &error);



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