[gnome-shell] Display the number of unread messages in the notification icon
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Display the number of unread messages in the notification icon
- Date: Thu, 7 Jul 2011 14:30:05 +0000 (UTC)
commit fda8ffd9ef86a887f1276778507a582153a3606c
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Jun 27 14:31:53 2011 +0200
Display the number of unread messages in the notification icon
https://bugzilla.gnome.org/show_bug.cgi?id=654139
js/ui/telepathyClient.js | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 8a47601..b916fac 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -370,6 +370,8 @@ ChatSource.prototype = {
this._pendingMessages.push(message);
}
+ this._updateCount();
+
let showTimestamp = false;
for (let i = 0; i < logMessages.length; i++) {
@@ -414,11 +416,16 @@ ChatSource.prototype = {
this.destroy();
},
+ _updateCount: function() {
+ this._setCount(this._pendingMessages.length, this._pendingMessages.length > 0);
+ },
+
_messageReceived: function(channel, message) {
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
return;
this._pendingMessages.push(message);
+ this._updateCount();
message = makeMessageFromTpMessage(message, NotificationDirection.RECEIVED);
this._notification.appendMessage(message);
@@ -489,8 +496,10 @@ ChatSource.prototype = {
_pendingRemoved: function(channel, message) {
let idx = this._pendingMessages.indexOf(message);
- if (idx >= 0)
+ if (idx >= 0) {
this._pendingMessages.splice(idx, 1);
+ this._updateCount();
+ }
else
throw new Error('Message not in our pending list: ' + message);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]