aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-26 01:03:00 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-27 23:24:59 +0800
commitb01de2f8b4e0ba170e1194615290e3d80865083f (patch)
tree01a9eeec2a79dbdbc2ffd9a428d4c07e9e2fe3aa /libempathy-gtk/empathy-chat.c
parent8b5eb07207e7aa74a0e9081a73502f71d1be58c1 (diff)
downloadgsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar.gz
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar.bz2
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar.lz
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar.xz
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.tar.zst
gsoc2013-empathy-b01de2f8b4e0ba170e1194615290e3d80865083f.zip
empathy-chat: keep count of the number of unread messages
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 372e90cf0..d9a72d3e9 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -93,6 +93,8 @@ typedef struct {
GtkWidget *label_topic;
GtkWidget *contact_list_view;
GtkWidget *info_bar_vbox;
+
+ guint unread_messages;
} EmpathyChatPriv;
typedef struct {
@@ -1074,6 +1076,7 @@ chat_message_received (EmpathyChat *chat, EmpathyMessage *message)
TP_CHANNEL_CHAT_STATE_ACTIVE,
chat);
+ priv->unread_messages++;
g_signal_emit (chat, signals[NEW_MESSAGE], 0, message);
}
@@ -2801,3 +2804,23 @@ empathy_chat_is_room (EmpathyChat *chat)
return (priv->handle_type == TP_HANDLE_TYPE_ROOM);
}
+guint
+empathy_chat_get_nb_unread_messages (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ g_return_val_if_fail (EMPATHY_IS_CHAT (self), FALSE);
+
+ return priv->unread_messages;
+}
+
+/* called when the messages have been read by user */
+void
+empathy_chat_messages_read (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ g_return_if_fail (EMPATHY_IS_CHAT (self));
+
+ priv->unread_messages = 0;
+}