diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-10 17:59:17 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-05-10 21:58:29 +0800 |
commit | 2d4e2fbb72426b3e9c542e67da8fb0bba0d31435 (patch) | |
tree | 54aad6116a108feb27a971bf576ea39d4cb56f43 | |
parent | d6cf60f939a2d40eb5eeb0aba65588f9e444b838 (diff) | |
download | gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar.gz gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar.bz2 gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar.lz gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar.xz gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.tar.zst gsoc2013-empathy-2d4e2fbb72426b3e9c542e67da8fb0bba0d31435.zip |
chat: use contact-chat-state-changed signal
Now that we have a signal giving us a prepared TpContact there is no need to
use the empathy variant as we can easily create the EmpathyContact directly.
https://bugzilla.gnome.org/show_bug.cgi?id=675807
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index b2224c2db..65dd47650 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1344,19 +1344,22 @@ chat_input_text_view_send (EmpathyChat *chat) static void chat_state_changed_cb (EmpathyTpChat *tp_chat, - EmpathyContact *contact, + TpContact *tp_contact, TpChannelChatState state, EmpathyChat *chat) { EmpathyChatPriv *priv; GList *l; gboolean was_composing; + EmpathyContact *contact; priv = GET_PRIV (chat); + contact = empathy_contact_dup_from_tp_contact (tp_contact); + if (empathy_contact_is_user (contact)) { /* We don't care about our own chat state */ - return; + goto out; } was_composing = (priv->compositors != NULL); @@ -1401,6 +1404,9 @@ chat_state_changed_cb (EmpathyTpChat *tp_chat, g_signal_emit (chat, signals[COMPOSING], 0, priv->compositors != NULL); } + +out: + g_object_unref (contact); } static GRegex * @@ -1524,7 +1530,7 @@ chat_message_received (EmpathyChat *chat, /* We received a message so the contact is no longer * composing */ - chat_state_changed_cb (priv->tp_chat, sender, + chat_state_changed_cb (priv->tp_chat, empathy_contact_get_tp_contact (sender), TP_CHANNEL_CHAT_STATE_ACTIVE, chat); } @@ -4025,7 +4031,7 @@ empathy_chat_set_tp_chat (EmpathyChat *chat, g_signal_connect (tp_chat, "send-error", G_CALLBACK (chat_send_error_cb), chat); - g_signal_connect (tp_chat, "chat-state-changed-empathy", + g_signal_connect (tp_chat, "contact-chat-state-changed", G_CALLBACK (chat_state_changed_cb), chat); g_signal_connect (tp_chat, "members-changed", |