diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-27 06:12:09 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-28 00:52:10 +0800 |
commit | d4d2036320d77e9f079b7dc13921e027c93a4e98 (patch) | |
tree | 6398e147cd30e29e3316f3d4b339a6f027ea0ffb | |
parent | cc7656ce36f0a531cc21585de63d1c2e493bc993 (diff) | |
download | gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar.gz gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar.bz2 gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar.lz gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar.xz gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.tar.zst gsoc2013-empathy-d4d2036320d77e9f079b7dc13921e027c93a4e98.zip |
Disconnect from notify::location
Since the list of EmpathyContact can change at anytime, it can't
be iterated to disconnect the handlers. Instead, a ref is
added to the markers.
-rw-r--r-- | src/empathy-map-view.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 4173128cc..83ad3924b 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -55,6 +55,7 @@ typedef struct { GtkWidget *zoom_out; ChamplainView *map_view; ChamplainLayer *layer; + GSList *notify_handles; } EmpathyMapView; static void map_view_destroy_cb (GtkWidget *widget, @@ -148,7 +149,21 @@ static void map_view_destroy_cb (GtkWidget *widget, EmpathyMapView *window) { - GtkTreeModel *model; + GSList *item; + + item = window->notify_handles; + while (item != NULL) + { + EmpathyContact *contact; + ChamplainMarker *marker; + + marker = CHAMPLAIN_MARKER (item->data); + contact = g_object_get_data (G_OBJECT (marker), "contact"); + g_signal_handlers_disconnect_by_func (contact, map_view_contact_location_notify, marker); + g_object_unref (marker); + + item = g_slist_next (item); + } g_object_unref (window->list_store); g_object_unref (window->layer); @@ -374,7 +389,9 @@ map_view_contacts_foreach (GtkTreeModel *model, g_signal_connect (contact, "notify::location", G_CALLBACK (map_view_contact_location_notify), marker); - + g_object_set_data_full (G_OBJECT (marker), "contact", g_object_ref (contact), g_object_unref); + window->notify_handles = g_slist_append (window->notify_handles, + g_object_ref (marker)); map_view_marker_update_position (CHAMPLAIN_MARKER (marker), contact); |