[gnome-shell] telepathyClient: Delay notification in case it gets acked
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] telepathyClient: Delay notification in case it gets acked
- Date: Mon, 22 Aug 2011 17:19:49 +0000 (UTC)
commit 11c84058798f2a5fbffbe16aabdd622a56ce9108
Author: Xavier Claessens <xclaesse gmail com>
Date: Mon Aug 22 16:23:50 2011 +0200
telepathyClient: Delay notification in case it gets acked
The shell should only notify in case no other client handles the message.
Empathy will ack the message if focused, so we don't want to step on its
toes.
js/ui/telepathyClient.js | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 4e2a95c..de88c33 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -358,6 +358,7 @@ ChatSource.prototype = {
this._notification = new ChatNotification(this);
this._notification.setUrgency(MessageTray.Urgency.HIGH);
+ this._notifyTimeoutId = 0;
// We ack messages when the message box is collapsed if user has
// interacted with it before and so read the messages:
@@ -519,7 +520,22 @@ ChatSource.prototype = {
message = makeMessageFromTpMessage(message, NotificationDirection.RECEIVED);
this._notification.appendMessage(message);
- this.notify();
+
+ // Wait a bit before notifying for the received message, a handler
+ // could ack it in the meantime.
+ if (this._notifyTimeoutId != 0)
+ Mainloop.source_remove(this._notifyTimeoutId);
+ this._notifyTimeoutId = Mainloop.timeout_add(500,
+ Lang.bind(this, this._notifyTimeout));
+ },
+
+ _notifyTimeout: function() {
+ if (this._pendingMessages.length != 0)
+ this.notify();
+
+ this._notifyTimeoutId = 0;
+
+ return false;
},
// This is called for both messages we send from
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]