diff options
author | Chandni Verma <chandniverma2112@gmail.com> | 2011-01-16 22:49:49 +0800 |
---|---|---|
committer | Chandni Verma <chandniverma2112@gmail.com> | 2011-01-18 18:23:48 +0800 |
commit | 1acf8998707505a367ef27e04730907b56408b3d (patch) | |
tree | 1fad8c8e0872c26405c7279ff39f980fda915eec /libempathy-gtk | |
parent | 9e70e42316ad1970c4508404baa86c69c81575b0 (diff) | |
download | gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar.gz gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar.bz2 gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar.lz gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar.xz gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.tar.zst gsoc2013-empathy-1acf8998707505a367ef27e04730907b56408b3d.zip |
Display typing icon in MUC contact-list
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=609419
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-list-store.c | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index d87461eeb..a8dbe6cbc 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -34,12 +34,14 @@ #include <telepathy-glib/util.h> #include <libempathy/empathy-utils.h> +#include <libempathy/empathy-tp-chat.h> #include <libempathy/empathy-enum-types.h> #include <libempathy/empathy-contact-manager.h> #include "empathy-contact-list-store.h" #include "empathy-ui-utils.h" #include "empathy-gtk-enum-types.h" +#include "empathy-images.h" #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT #include <libempathy/empathy-debug.h> @@ -181,6 +183,32 @@ enum { G_DEFINE_TYPE (EmpathyContactListStore, empathy_contact_list_store, GTK_TYPE_TREE_STORE); +static void +contact_list_store_chat_state_changed_cb (TpChannel *self, + guint contact_handle, + guint state, + gpointer store) +{ + EmpathyContactListStorePriv *priv = GET_PRIV (store); + GList *contacts, *l; + + contacts = empathy_contact_list_get_members (priv->list); + + /* Find the contact in the list. After that l is the list elem or NULL */ + for (l = contacts; l != NULL; l = l->next) { + if (empathy_contact_get_handle (EMPATHY_CONTACT (l->data)) == + contact_handle) { + break; + } + } + + if (l != NULL) + contact_list_store_contact_update (store, l->data); + + g_list_foreach (contacts, (GFunc) g_object_unref, NULL); + g_list_free (contacts); +} + static gboolean contact_list_store_iface_setup (gpointer user_data) { @@ -206,6 +234,20 @@ contact_list_store_iface_setup (gpointer user_data) G_CALLBACK (contact_list_store_groups_changed_cb), store); + if (EMPATHY_IS_TP_CHAT (priv->list)) { + TpChannel *channel; + + channel = empathy_tp_chat_get_channel (EMPATHY_TP_CHAT (priv->list)); + if (!tp_proxy_is_prepared (channel, TP_CHANNEL_FEATURE_CHAT_STATES)) { + DEBUG ("Chat state feature not prepared"); + } else { + g_signal_connect (channel, + "chat-state-changed", + G_CALLBACK (contact_list_store_chat_state_changed_cb), + store); + } + } + /* Add contacts already created. */ contacts = empathy_contact_list_get_members (priv->list); for (l = contacts; l; l = l->next) { @@ -1835,9 +1877,25 @@ contact_list_store_get_contact_status_icon (EmpathyContactListStore *store, EmpathyContact *contact) { GdkPixbuf *pixbuf_status = NULL; + EmpathyContactListStorePriv *priv; const gchar *status_icon_name = NULL; + gboolean composing = FALSE; + + priv = GET_PRIV (store); + + if (EMPATHY_IS_TP_CHAT (priv->list)) { + if (empathy_tp_chat_get_chat_state (EMPATHY_TP_CHAT (priv->list), + contact) == + TP_CHANNEL_CHAT_STATE_COMPOSING) + composing = TRUE; + } + + if (composing) { + status_icon_name = EMPATHY_IMAGE_TYPING; + } else { + status_icon_name = empathy_icon_name_for_contact (contact); + } - status_icon_name = empathy_icon_name_for_contact (contact); if (status_icon_name == NULL) return NULL; |