diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-26 23:14:56 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-30 19:35:23 +0800 |
commit | 0513f2521e2bed5451053d8dcf2fbe89f97f41c5 (patch) | |
tree | d6fa11cf0dfdb39c04d4ed42b78471df7781bd29 /src/empathy-map-view.c | |
parent | 02ee7fc17b51f8ee5be937f09f8ab01d21735548 (diff) | |
download | gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar.gz gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar.bz2 gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar.lz gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar.xz gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.tar.zst gsoc2013-empathy-0513f2521e2bed5451053d8dcf2fbe89f97f41c5.zip |
map-view: display position of contacts added after the map has been created (#614012)
Diffstat (limited to 'src/empathy-map-view.c')
-rw-r--r-- | 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 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); |