[empathy] empathy-chat: keep count of the number of unread messages
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] empathy-chat: keep count of the number of unread messages
- Date: Fri, 27 Nov 2009 15:31:23 +0000 (UTC)
commit b01de2f8b4e0ba170e1194615290e3d80865083f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Nov 25 17:03:00 2009 +0000
empathy-chat: keep count of the number of unread messages
libempathy-gtk/empathy-chat.c | 23 +++++++++++++++++++++++
libempathy-gtk/empathy-chat.h | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 372e90c..d9a72d3 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;
+}
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 9123d11..9e09850 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -84,6 +84,9 @@ void empathy_chat_correct_word (EmpathyChat *chat,
gboolean empathy_chat_is_room (EmpathyChat *chat);
void empathy_chat_set_show_contacts (EmpathyChat *chat,
gboolean show);
+guint empathy_chat_get_nb_unread_messages (EmpathyChat *chat);
+
+void empathy_chat_messages_read (EmpathyChat *self);
G_END_DECLS
#endif /* __EMPATHY_CHAT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]