aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-21 19:45:14 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-21 19:48:06 +0800
commit005e206844be26a15012cc235927531bd3e38420 (patch)
tree607f65e8131c6e1fcd20ec518aaba299692f13fd
parentb95223f0d32b6c8424341bf0c406e4422c831de6 (diff)
downloadgsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar.gz
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar.bz2
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar.lz
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar.xz
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.tar.zst
gsoc2013-empathy-005e206844be26a15012cc235927531bd3e38420.zip
empathy-chat: properly count unread messages when the connection goes away (#653090)
-rw-r--r--libempathy-gtk/empathy-chat.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index bb33130e3..cd73c1f0d 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -121,6 +121,7 @@ struct _EmpathyChatPriv {
GtkWidget *search_bar;
guint unread_messages;
+ guint unread_messages_when_offline;
/* TRUE if the pending messages can be displayed. This is to avoid to show
* pending messages *before* messages from logs. (#603980) */
gboolean can_show_pending;
@@ -2688,6 +2689,8 @@ chat_invalidated_cb (EmpathyTpChat *tp_chat,
gtk_widget_set_sensitive (chat->input_text_view, FALSE);
chat_update_contacts_visibility (chat, FALSE);
+
+ priv->unread_messages_when_offline = priv->unread_messages;
}
static gboolean
@@ -4026,6 +4029,14 @@ empathy_chat_messages_read (EmpathyChat *self)
if (priv->tp_chat != NULL) {
empathy_tp_chat_acknowledge_all_messages (priv->tp_chat);
}
+
+ if (priv->unread_messages_when_offline > 0) {
+ /* We can't ack those as the connection has gone away so just consider
+ * them as read. */
+ priv->unread_messages -= priv->unread_messages_when_offline;
+ g_object_notify (G_OBJECT (self), "nb-unread-messages");
+ priv->unread_messages_when_offline = 0;
+ }
}
/* Return TRUE if on of the contacts in this chat is composing */