aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-26 22:53:55 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-30 19:35:23 +0800
commit7dc3996067e1b97aaf49a478dcb7a72265fecba3 (patch)
tree90e33ce021cea3d818cd306920ec0bca4b426dd6 /src
parent2d93063b49b5a05272d37f7de10bd5970480a2cf (diff)
downloadgsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar.gz
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar.bz2
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar.lz
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar.xz
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.tar.zst
gsoc2013-empathy-7dc3996067e1b97aaf49a478dcb7a72265fecba3.zip
factor out contact_has_location
Diffstat (limited to 'src')
-rw-r--r--src/empathy-map-view.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 2770a5a3f..cf89e2a29 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -74,6 +74,19 @@ map_view_state_changed (ChamplainView *view,
ephy_spinner_stop (EPHY_SPINNER (window->throbber));
}
+static gboolean
+contact_has_location (EmpathyContact *contact)
+{
+ GHashTable *location;
+
+ location = empathy_contact_get_location (contact);
+
+ if (location == NULL || g_hash_table_size (location) == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
static void
map_view_update_contact_position (EmpathyMapView *self,
EmpathyContact *contact)
@@ -88,12 +101,11 @@ map_view_update_contact_position (EmpathyMapView *self,
location = empathy_contact_get_location (contact);
- if (location == NULL ||
- g_hash_table_size (location) == 0)
- {
- champlain_base_marker_animate_out (CHAMPLAIN_BASE_MARKER (marker));
- return;
- }
+ if (!contact_has_location (contact))
+ {
+ champlain_base_marker_animate_out (CHAMPLAIN_BASE_MARKER (marker));
+ return;
+ }
value = g_hash_table_lookup (location, EMPATHY_LOCATION_LAT);
if (value == NULL)
@@ -275,7 +287,6 @@ map_view_contacts_foreach (GtkTreeModel *model,
{
EmpathyMapView *window = (EmpathyMapView *) user_data;
EmpathyContact *contact;
- GHashTable *location;
gtk_tree_model_get (model, iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT,
&contact, -1);
@@ -283,9 +294,7 @@ map_view_contacts_foreach (GtkTreeModel *model,
if (contact == NULL)
return FALSE;
- location = empathy_contact_get_location (contact);
-
- if (location == NULL || g_hash_table_size (location) == 0)
+ if (!contact_has_location (contact))
return FALSE;
g_signal_connect (contact, "notify::location",