From 9c6a6ec047261aab6b0e4b9ac4f3206aebc0d192 Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Tue, 24 Jul 2012 13:56:51 +0200 Subject: tubes: keep contacts dialog updated on contacts' presence changes - make the dialog - TubeContacts static pointer, so there is only one Change-Id: I12f256bebc27ba31a82082d7107066de8079893c --- tubes/source/contact-list.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tubes/source') diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx index 0d4680358fd3..78f84b534417 100644 --- a/tubes/source/contact-list.cxx +++ b/tubes/source/contact-list.cxx @@ -92,6 +92,15 @@ tb_contact_is_online (TpContact *contact) } } +static void presence_changed_cb( TpContact* /* contact */, + guint /* type */, + gchar* /* status */, + gchar* /* message */, + gpointer pContactList ) +{ + reinterpret_cast (pContactList)->sigContactListChanged(); +} + AccountContactPairV ContactList::getContacts() { GList *accounts; @@ -121,6 +130,12 @@ AccountContactPairV ContactList::getContacts() { TpContact *contact = reinterpret_cast(g_ptr_array_index (contacts, i)); + if (maRegistered.find (contact) == maRegistered.end()) + { + maRegistered.insert (contact); + g_signal_connect (contact, "presence-changed", + G_CALLBACK (presence_changed_cb), this ); + } if (contact != self && tb_contact_is_online (contact)) -- cgit