diff options
author | Senko Rasic <senko.rasic@collabora.co.uk> | 2010-04-12 16:10:11 +0200 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-15 19:16:12 +0100 |
commit | 03dd5dfa13cc79b60c91c72cc16acd8b1e0ba12e (patch) | |
tree | 7eeaa8218ffabc2e4d00841a883c509024d19154 | |
parent | 72e342133acdf97dc6e62a1568de0e312bbbf78d (diff) | |
download | telepathy-mission-control-03dd5dfa13cc79b60c91c72cc16acd8b1e0ba12e.tar.gz |
McdDispatcher: listen to McdClient's need-recovery signal
-rw-r--r-- | src/mcd-dispatcher.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index 03a0b6e2..ed967b3e 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -805,6 +805,9 @@ mcd_dispatcher_client_capabilities_changed_cb (McdClientProxy *client, static void mcd_dispatcher_client_gone_cb (McdClientProxy *client, McdDispatcher *self); +static void mcd_dispatcher_client_needs_recovery_cb (McdClientProxy *client, + McdDispatcher *self); + static void mcd_dispatcher_discard_client (McdDispatcher *self, McdClientProxy *client) @@ -818,6 +821,9 @@ mcd_dispatcher_discard_client (McdDispatcher *self, g_signal_handlers_disconnect_by_func (client, mcd_dispatcher_client_gone_cb, self); + + g_signal_handlers_disconnect_by_func (client, + mcd_dispatcher_client_needs_recovery_cb, self); } static void @@ -828,6 +834,40 @@ mcd_dispatcher_client_gone_cb (McdClientProxy *client, } static void +mcd_dispatcher_client_needs_recovery_cb (McdClientProxy *client, + McdDispatcher *self) +{ + GList *channels = + _mcd_handler_map_get_handled_channels (self->priv->handler_map); + GHashTable *accounts = + _mcd_handler_map_get_channel_accounts (self->priv->handler_map); + const GList *observer_filters; + GList *list; + + DEBUG ("called"); + + observer_filters = _mcd_client_proxy_get_observer_filters (client); + + for (list = channels; list; list = list->next) + { + TpChannel *channel = list->data; + GHashTable *properties; + + properties = tp_channel_borrow_immutable_properties (channel); + + if (_mcd_client_match_filters (properties, observer_filters, + FALSE)) + { + const gchar *account_path = + g_hash_table_lookup (accounts, tp_proxy_get_object_path (channel)); + + _mcd_client_recover_observer (client, channel, account_path); + } + + } +} + +static void mcd_dispatcher_client_added_cb (McdClientRegistry *clients, McdClientProxy *client, McdDispatcher *self) @@ -843,6 +883,11 @@ mcd_dispatcher_client_added_cb (McdClientRegistry *clients, g_signal_connect (client, "handler-capabilities-changed", G_CALLBACK (mcd_dispatcher_client_capabilities_changed_cb), self); + + g_signal_connect (client, "need-recovery", + G_CALLBACK (mcd_dispatcher_client_needs_recovery_cb), + self); + } static void |