[empathy] map-view: display position of contacts added after the map has been created (#614012)
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] map-view: display position of contacts added after the map has been created (#614012)
- Date: Tue, 30 Mar 2010 11:36:24 +0000 (UTC)
commit 0513f2521e2bed5451053d8dcf2fbe89f97f41c5
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Mar 26 16:14:56 2010 +0100
map-view: display position of contacts added after the map has been created (#614012)
src/empathy-map-view.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 11e0f04..30c123b 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]