diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-26 22:25:50 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-30 19:35:23 +0800 |
commit | 2d93063b49b5a05272d37f7de10bd5970480a2cf (patch) | |
tree | 132225932ca57e821cd54c67052602b30dbc8dc6 | |
parent | 2c8bdd816922be9da7db6f57ac87ed027aad1266 (diff) | |
download | gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar.gz gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar.bz2 gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar.lz gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar.xz gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.tar.zst gsoc2013-empathy-2d93063b49b5a05272d37f7de10bd5970480a2cf.zip |
factor out create_marker
-rw-r--r-- | src/empathy-map-view.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index c504f9e22..2770a5a3f 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -229,30 +229,14 @@ map_view_contacts_update_label (ChamplainMarker *marker) g_free (label); } -static gboolean -map_view_contacts_foreach (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) +static ChamplainMarker * +create_marker (EmpathyMapView *window, + EmpathyContact *contact) { - EmpathyMapView *window = (EmpathyMapView *) user_data; - EmpathyContact *contact; ClutterActor *marker; ClutterActor *texture; - GHashTable *location; GdkPixbuf *avatar; - 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 || g_hash_table_size (location) == 0) - return FALSE; - marker = champlain_marker_new (); avatar = empathy_pixbuf_avatar_from_contact_scaled (contact, 32, 32); @@ -280,9 +264,34 @@ map_view_contacts_foreach (GtkTreeModel *model, clutter_container_add (CLUTTER_CONTAINER (window->layer), marker, NULL); + return CHAMPLAIN_MARKER (marker); +} + +static gboolean +map_view_contacts_foreach (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) +{ + EmpathyMapView *window = (EmpathyMapView *) user_data; + EmpathyContact *contact; + GHashTable *location; + + 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 || g_hash_table_size (location) == 0) + return FALSE; + g_signal_connect (contact, "notify::location", G_CALLBACK (map_view_contact_location_notify), window); + create_marker (window, contact); map_view_update_contact_position (window, contact); g_object_unref (contact); |