[empathy] factor out create_marker
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] factor out create_marker
- Date: Tue, 30 Mar 2010 11:35:49 +0000 (UTC)
commit 2d93063b49b5a05272d37f7de10bd5970480a2cf
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Mar 26 15:25:50 2010 +0100
factor out create_marker
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 c504f9e..2770a5a 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]