From 42e12e5ad7fde4a1776b3910a3ffa1b1219e80b3 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Mon, 25 May 2009 14:53:42 -0400 Subject: Don't create a marker if the user has no location --- src/empathy-map-view.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 11e0eb471..da5837e43 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -293,14 +293,21 @@ map_view_contacts_foreach (GtkTreeModel *model, EmpathyContact *contact; ClutterActor *marker; ClutterActor *texture; + GHashTable *location; GdkPixbuf *avatar; const gchar *name; gtk_tree_model_get (model, iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact, -1); + if (contact == NULL) return FALSE; + location = empathy_contact_get_location (contact); + + if (location == NULL) + return FALSE; + marker = champlain_marker_new (); avatar = empathy_pixbuf_avatar_from_contact_scaled (contact, 32, 32); @@ -316,20 +323,17 @@ map_view_contacts_foreach (GtkTreeModel *model, name = empathy_contact_get_name (contact); champlain_marker_set_text (CHAMPLAIN_MARKER (marker), name); - map_view_marker_update_position (CHAMPLAIN_MARKER (marker), contact); - clutter_container_add (CLUTTER_CONTAINER (window->layer), marker, NULL); g_signal_connect (contact, "notify::location", G_CALLBACK (map_view_contact_location_notify), marker); + #if HAVE_GEOCLUE gchar *str; GHashTable *address; - GHashTable *location; GValue *value; - location = empathy_contact_get_location (contact); value = g_hash_table_lookup (location, EMPATHY_LOCATION_LON); if (value == NULL) { @@ -361,6 +365,8 @@ map_view_contacts_foreach (GtkTreeModel *model, } #endif + map_view_marker_update_position (CHAMPLAIN_MARKER (marker), contact); + g_object_unref (contact); return FALSE; } -- cgit v1.2.3