[empathy] map-view: add a mapping from EmpathyContact to ChamplainMarker



commit 00d66d902bbec612e612275191f917ac9f56b028
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Mar 26 14:40:16 2010 +0100

    map-view: add a mapping from EmpathyContact to ChamplainMarker

 src/empathy-map-view.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 287d9b6..17e3897 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -56,6 +56,8 @@ typedef struct {
   ChamplainView *map_view;
   ChamplainLayer *layer;
   guint timeout_id;
+  /* reffed (EmpathyContact *) => borrowed (ChamplainMarker *) */
+  GHashTable *markers;
 } EmpathyMapView;
 
 static void
@@ -264,6 +266,8 @@ map_view_contacts_foreach (GtkTreeModel *model,
   g_object_set_data_full (G_OBJECT (marker), "contact",
       g_object_ref (contact), g_object_unref);
 
+  g_hash_table_insert (window->markers, g_object_ref (contact), marker);
+
   map_view_contacts_update_label (CHAMPLAIN_MARKER (marker));
 
   clutter_actor_set_reactive (CLUTTER_ACTOR (marker), TRUE);
@@ -303,6 +307,7 @@ map_view_destroy_cb (GtkWidget *widget,
     item = g_list_next (item);
   }
 
+  g_hash_table_destroy (window->markers);
   g_object_unref (window->list_store);
   g_object_unref (window->layer);
   g_slice_free (EmpathyMapView, window);
@@ -412,6 +417,9 @@ empathy_map_view_show (void)
       G_CALLBACK (map_view_state_changed), window);
 
   /* Set up contact list. */
+  window->markers = g_hash_table_new_full (NULL, NULL,
+      (GDestroyNotify) g_object_unref, NULL);
+
   model = GTK_TREE_MODEL (window->list_store);
   gtk_tree_model_foreach (model, map_view_contacts_foreach, window);
 



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