[empathy] Don't create a marker if the user has no location



commit 42e12e5ad7fde4a1776b3910a3ffa1b1219e80b3
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Mon May 25 14:53:42 2009 -0400

    Don't create a marker if the user has no location
---
 src/empathy-map-view.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 11e0eb4..da5837e 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;
 }



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