aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-map-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/empathy-map-view.c')
-rw-r--r--src/empathy-map-view.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 11e0f0485..30c123b26 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -58,6 +58,7 @@ typedef struct {
guint timeout_id;
/* reffed (EmpathyContact *) => borrowed (ChamplainMarker *) */
GHashTable *markers;
+ gulong members_changed_id;
} EmpathyMapView;
static void
@@ -327,6 +328,7 @@ map_view_destroy_cb (GtkWidget *widget,
{
GHashTableIter iter;
gpointer contact;
+ EmpathyContactList *list_iface;
g_source_remove (window->timeout_id);
@@ -335,6 +337,9 @@ map_view_destroy_cb (GtkWidget *widget,
g_signal_handlers_disconnect_by_func (contact,
map_view_contact_location_notify, window);
+ list_iface = empathy_contact_list_store_get_list_iface (window->list_store);
+ g_signal_handler_disconnect (list_iface, window->members_changed_id);
+
g_hash_table_destroy (window->markers);
g_object_unref (window->list_store);
g_object_unref (window->layer);
@@ -369,6 +374,39 @@ map_view_tick (EmpathyMapView *window)
return TRUE;
}
+static void
+contact_removed (EmpathyMapView *self,
+ EmpathyContact *contact)
+{
+ ClutterActor *marker;
+
+ marker = g_hash_table_lookup (self->markers, contact);
+ if (marker == NULL)
+ return;
+
+ clutter_actor_destroy (marker);
+ g_hash_table_remove (self->markers, contact);
+}
+
+static void
+members_changed_cb (EmpathyContactList *list,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyMapView *self)
+{
+ if (is_member)
+ {
+ contact_added (self, contact);
+ }
+ else
+ {
+ contact_removed (self, contact);
+ }
+}
+
GtkWidget *
empathy_map_view_show (void)
{
@@ -420,6 +458,9 @@ empathy_map_view_show (void)
empathy_contact_list_store_set_show_avatars (list_store, TRUE);
g_object_unref (list_iface);
+ window->members_changed_id = g_signal_connect (list_iface, "members-changed",
+ G_CALLBACK (members_changed_cb), window);
+
window->throbber = ephy_spinner_new ();
ephy_spinner_set_size (EPHY_SPINNER (window->throbber),
GTK_ICON_SIZE_LARGE_TOOLBAR);