aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandni Verma <chandniverma2112@gmail.com>2013-07-31 02:21:38 +0800
committerChandni Verma <chandniverma2112@gmail.com>2013-08-14 20:03:39 +0800
commitb7bfb4d892c8dfc59c2a017d1227c9cc5ca16549 (patch)
tree6b83f1f9c19cf45977a2024b68b108e2fd8e4834
parent2088b62035060aa42cc52bca7c3b1f6609751c32 (diff)
downloadgsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar.gz
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar.bz2
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar.lz
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar.xz
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.tar.zst
gsoc2013-empathy-b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549.zip
Show typing icon against composing members of a MUC
https://bugzilla.gnome.org/show_bug.cgi?id=703487
-rw-r--r--libempathy-gtk/empathy-individual-store-channel.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-individual-store-channel.c b/libempathy-gtk/empathy-individual-store-channel.c
index 16134a61c..a1a1161f9 100644
--- a/libempathy-gtk/empathy-individual-store-channel.c
+++ b/libempathy-gtk/empathy-individual-store-channel.c
@@ -27,6 +27,8 @@
#include "empathy-individual-store-channel.h"
#include "empathy-utils.h"
+#include "empathy-ui-utils.h"
+#include "empathy-images.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
@@ -124,6 +126,67 @@ group_contacts_changed_cb (TpChannel *channel,
}
static void
+individual_store_channel_contact_chat_state_changed (TpTextChannel *channel,
+ TpContact *tp_contact,
+ TpChannelChatState state,
+ EmpathyIndividualStoreChannel *self)
+{
+ FolksIndividual *individual;
+ EmpathyContact *contact = NULL;
+ GList *iters, *l;
+ GdkPixbuf *pixbuf;
+
+ contact = empathy_contact_dup_from_tp_contact (tp_contact);
+ if (empathy_contact_is_user (contact))
+ {
+ /* We don't care about our own chat composing states */
+ goto finally;
+ }
+
+ DEBUG ("Contact %s entered chat state %d",
+ tp_contact_get_identifier (tp_contact), state);
+
+ individual = g_hash_table_lookup (self->priv->individuals, tp_contact);
+ if (individual == NULL)
+ {
+ g_warning ("individual is NULL");
+ goto finally;
+ }
+
+ iters = empathy_individual_store_find_contact (
+ EMPATHY_INDIVIDUAL_STORE (self), individual);
+
+ if (state == TP_CHANNEL_CHAT_STATE_COMPOSING)
+ {
+ gchar *icon_filename =
+ empathy_filename_from_icon_name (EMPATHY_IMAGE_TYPING,
+ GTK_ICON_SIZE_MENU);
+
+ pixbuf = gdk_pixbuf_new_from_file (icon_filename, NULL);
+ g_free (icon_filename);
+ }
+ else
+ {
+ pixbuf = empathy_individual_store_get_individual_status_icon (
+ EMPATHY_INDIVIDUAL_STORE (self), individual);
+ }
+
+ for (l = iters; l != NULL; l = l->next)
+ {
+ gtk_tree_store_set (GTK_TREE_STORE (self), l->data,
+ EMPATHY_INDIVIDUAL_STORE_COL_ICON_STATUS, pixbuf,
+ -1);
+ }
+ /* Store takes it's own ref */
+ g_object_unref (pixbuf);
+
+ empathy_individual_store_free_iters (iters);
+
+ finally:
+ g_object_unref (contact);
+}
+
+static void
individual_store_channel_set_individual_channel (
EmpathyIndividualStoreChannel *self,
TpChannel *channel)
@@ -143,6 +206,10 @@ individual_store_channel_set_individual_channel (
tp_g_signal_connect_object (channel, "group-contacts-changed",
G_CALLBACK (group_contacts_changed_cb), self, 0);
+
+ tp_g_signal_connect_object (channel, "contact-chat-state-changed",
+ G_CALLBACK (individual_store_channel_contact_chat_state_changed),
+ self, 0);
}
static void