summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-10-13 10:51:23 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2010-10-13 11:01:16 +0100
commit29c76ba3085e2bc30f816160c2e0562eaeffb590 (patch)
tree16a5ab10c8099ced0fd9ca0565d766f3e977dfbe
parentc2168e05f0396eafd8ce9b63d134f94553341219 (diff)
downloadtelepathy-logger-29c76ba3085e2bc30f816160c2e0562eaeffb590.tar.gz
Clean up connecting to text channel signals.
There's really no point in logging which signal we failed to connect to, because the reason will always be the same: the object is invalidated, or the interface in question isn't implemented. Plus, there's no point in trying to carry on if we'll ultimately bail out if any errors occurred. So, let's just bail out as soon as we encounter an error connecting to a signal.
-rw-r--r--telepathy-logger/channel-text.c77
1 files changed, 25 insertions, 52 deletions
diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c
index ff84eea..930d849 100644
--- a/telepathy-logger/channel-text.c
+++ b/telepathy-logger/channel-text.c
@@ -922,69 +922,42 @@ pendingproc_connect_message_signals (TplActionChain *ctx,
gpointer user_data)
{
TplChannelText *tpl_text = _tpl_action_chain_get_object (ctx);
- GError *error = NULL;
- gboolean is_error = FALSE;
TpChannel *channel = TP_CHANNEL (tpl_text);
+ GError *error = NULL;
- tp_cli_channel_type_text_connect_to_received (channel,
- on_received_signal_cb, NULL, NULL, NULL, &error);
- if (error != NULL)
- {
- PATH_DEBUG (tpl_text, "'received' signal connect: %s", error->message);
- g_clear_error (&error);
- is_error = TRUE;
- }
+ tp_g_signal_connect_object (channel, "invalidated",
+ G_CALLBACK (on_channel_invalidated_cb), tpl_text, 0);
- tp_cli_channel_type_text_connect_to_sent (channel,
- on_sent_signal_cb, tpl_text, NULL, NULL, &error);
- if (error != NULL)
- {
- PATH_DEBUG (tpl_text, "'sent' signal connect: %s", error->message);
- g_clear_error (&error);
- is_error = TRUE;
- }
+ if (tp_cli_channel_type_text_connect_to_received (channel,
+ on_received_signal_cb, NULL, NULL, NULL, &error) == NULL)
+ goto disaster;
- tp_cli_channel_type_text_connect_to_send_error (channel,
- on_send_error_cb, tpl_text, NULL, NULL, &error);
- if (error != NULL)
- {
- PATH_DEBUG (tpl_text, "'send error' signal connect: %s", error->message);
- g_clear_error (&error);
- is_error = TRUE;
- }
+ if (tp_cli_channel_type_text_connect_to_sent (channel,
+ on_sent_signal_cb, tpl_text, NULL, NULL, &error) == NULL)
+ goto disaster;
- tp_cli_channel_type_text_connect_to_lost_message (channel,
- on_lost_message_cb, tpl_text, NULL, NULL, &error);
- if (error != NULL)
- {
- PATH_DEBUG (tpl_text, "'lost message' signal connect: %s",
- error->message);
- g_clear_error (&error);
- is_error = TRUE;
- }
+ if (tp_cli_channel_type_text_connect_to_send_error (channel,
+ on_send_error_cb, tpl_text, NULL, NULL, &error) == NULL)
+ goto disaster;
- tp_g_signal_connect_object (channel, "invalidated",
- G_CALLBACK (on_channel_invalidated_cb), tpl_text, 0);
+ if (tp_cli_channel_type_text_connect_to_lost_message (channel,
+ on_lost_message_cb, tpl_text, NULL, NULL, &error) == NULL)
+ goto disaster;
if (tp_proxy_has_interface_by_id (tpl_text,
- TP_IFACE_QUARK_CHANNEL_INTERFACE_MESSAGES))
- {
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_MESSAGES) &&
tp_cli_channel_interface_messages_connect_to_pending_messages_removed (
channel, on_pending_messages_removed_cb, NULL, NULL,
- G_OBJECT (tpl_text), &error);
- if (error != NULL)
- {
- PATH_DEBUG (tpl_text, "'PendingMessagesRemoved' signal connect: %s",
- error->message);
- g_clear_error (&error);
- is_error = TRUE;
- }
- }
+ G_OBJECT (tpl_text), &error) == NULL)
+ goto disaster;
- if (is_error)
- _tpl_action_chain_terminate (ctx);
- else
- _tpl_action_chain_continue (ctx);
+ _tpl_action_chain_continue (ctx);
+ return;
+
+disaster:
+ DEBUG ("couldn't connect to signals: %s", error->message);
+ g_clear_error (&error);
+ _tpl_action_chain_terminate (ctx);
}