[empathy] Show typing icon against composing members of a MUC
- From: Chandni Verma <vchandni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Show typing icon against composing members of a MUC
- Date: Wed, 14 Aug 2013 12:05:08 +0000 (UTC)
commit b7bfb4d892c8dfc59c2a017d1227c9cc5ca16549
Author: Chandni Verma <chandniverma2112 gmail com>
Date: Tue Jul 30 23:51:38 2013 +0530
Show typing icon against composing members of a MUC
https://bugzilla.gnome.org/show_bug.cgi?id=703487
libempathy-gtk/empathy-individual-store-channel.c | 67 +++++++++++++++++++++
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 16134a6..a1a1161 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]