[Pkg-mozext-commits] [firetray] 360/399: Merge branch 'twitter-blink' into icon-blink
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:24:14 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch dfsg-clean
in repository firetray.
commit 837901c301e143d0edf2b21965e3a40370a4f9e5
Merge: 208db6f 7af80d0
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Apr 7 21:50:57 2013 +0200
Merge branch 'twitter-blink' into icon-blink
Conflicts:
src/modules/FiretrayChat.jsm
src/modules/FiretrayChat.jsm | 67 ++++++++++++++++++++++----
src/modules/FiretrayHandler.jsm | 8 ++-
src/modules/commons.js | 2 +-
src/modules/ctypes/linux/gtk.jsm | 2 +-
src/modules/linux/FiretrayChatStatusIcon.jsm | 3 +-
src/modules/linux/FiretrayWindow.jsm | 10 ++--
6 files changed, 74 insertions(+), 18 deletions(-)
diff --cc src/modules/FiretrayChat.jsm
index 631c4ac,14e9fec..722d54c
--- a/src/modules/FiretrayChat.jsm
+++ b/src/modules/FiretrayChat.jsm
@@@ -16,6 -16,6 +16,7 @@@ firetray.Chat =
initialized: false,
observedTopics: {},
acknowledgeOnFocus: {},
++ _isAttentionCalling: false,
init: function() {
if (this.initialized) {
@@@ -47,8 -47,27 +48,27 @@@
this.initialized = false;
},
+ // FIXME: the listener should probably attached on the conv entry in the
- // contactlist during startIconBlinkingMaybe
++ // contactlist during startGetAttentionMaybe
+ attachSelectListeners: function(win) {
+ log.debug("attachSelectListeners");
+ ["contactlistbox", "tabmail"].forEach(function(eltId) {
+ win.document.getElementById(eltId)
+ .addEventListener('select', firetray.Chat.onSelect);
+ });
+ },
+
+ detachSelectListeners: function(win) {
+ ["contactlistbox", "tabmail"].forEach(function(eltId) {
+ win.document.getElementById(eltId)
+ .removeEventListener('select', firetray.Chat.onSelect);
+ });
+ },
+
observe: function(subject, topic, data) {
log.debug("RECEIVED Chat: "+topic+" subject="+subject+" data="+data);
+ let conv = null;
+
switch (topic) {
case "account-connected":
case "account-disconnected":
@@@ -58,15 -77,28 +78,28 @@@
break;
case "new-directed-incoming-message": // when PM or cited in channel
- let conv = subject.QueryInterface(Ci.prplIMessage).conversation;
+ conv = subject.QueryInterface(Ci.prplIMessage).conversation;
log.debug("conversation name="+conv.name); // normalizedName shouldn't be necessary
- this.startIconBlinkingMaybe(conv);
+ this.startGetAttentionMaybe(conv);
break;
+ /* Twitter is obviously considered a chatroom, not a private
+ conversation. This is why we need to detect incoming messages and switch
+ to the conversation differently. The actual read should be caught by
+ focus-in-event and 'select' event on tabmail and contactlist */
+ case "new-text":
+ conv = subject.QueryInterface(Ci.prplIMessage).conversation;
+ log.info("new-text from "+conv.title);
+ let proto = conv.account.QueryInterface(Ci.imIAccount).protocol;
+ if (proto.normalizedName === 'twitter')
- this.startIconBlinkingMaybe(conv);
++ this.startGetAttentionMaybe(conv);
+ break;
+
case "unread-im-count-changed":
+ log.debug("unread-im-count-changed");
let unreadMsgCount = data;
if (unreadMsgCount == 0)
- this.stopIconBlinkingMaybe();
+ this.stopGetAttentionMaybe(firetray.Handler.findActiveWindow());
let localizedTooltip = PluralForm.get(
unreadMsgCount,
@@@ -80,39 -112,19 +113,42 @@@
}
},
- // FIXME: implement a pool of conv which initiated a warning
- startIconBlinkingMaybe: function(conv) {
+ startGetAttentionMaybe: function(conv) {
+ log.debug('startGetAttentionMaybe');
let convIsCurrentlyShown = this.isConvCurrentlyShown(conv);
log.debug("convIsCurrentlyShown="+convIsCurrentlyShown);
- if (!convIsCurrentlyShown) { // don't blink when conv tab already on top
- this.acknowledgeOnFocus.must = true;
- this.acknowledgeOnFocus.conv = conv;
- firetray.ChatStatusIcon.setIconBlinking(true);
+ if (convIsCurrentlyShown) // don't blink when conv tab already on top
+ return;
+
++ if (this._isAttentionCalling) return;
++ this._isAttentionCalling = true;
++
+ this.acknowledgeOnFocus.must = true;
+ this.acknowledgeOnFocus.conv = conv;
+
- /* there can potentially be multiple windows, each with a Chat tab and
- the same conv open... so we need to handle all windows */
++ /* there can potentially be multiple windows, each with a Chat tab and the
++ same conv open... so we need to handle urgency for all windows */
+ for (let xid in firetray.Handler.windows) {
+ let win = firetray.Handler.windows[xid].chromeWin;
+ let contactlist = win.document.getElementById("contactlistbox");
+ for (let i=0; i<contactlist.itemCount; ++i) {
+ let item = contactlist.getItemAtIndex(i);
+ if (item.localName !== 'imconv')
+ continue;
+ if (item.hasOwnProperty('conv') && item.conv.target === conv) {
+ firetray.ChatStatusIcon.setUrgency(xid, true);
+ }
+ }
}
+
+ firetray.ChatStatusIcon.startIconBlinking();
},
- stopIconBlinkingMaybe: function(xid) { // xid optional
- log.debug("acknowledgeOnFocus.must="+this.acknowledgeOnFocus.must);
+ /**
+ * @param xid id of the window that MUST have initiated this event
+ */
+ stopGetAttentionMaybe: function(xid) {
+ log.debug("stopGetAttentionMaybe acknowledgeOnFocus.must="+this.acknowledgeOnFocus.must);
if (!this.acknowledgeOnFocus.must) return;
let convIsCurrentlyShown = this.isConvCurrentlyShown(
@@@ -120,14 -132,22 +156,24 @@@
log.debug("convIsCurrentlyShown="+convIsCurrentlyShown);
if (this.acknowledgeOnFocus.must && convIsCurrentlyShown) {
+ log.debug("do stop icon blinking !!!");
- firetray.ChatStatusIcon.setIconBlinking(false);
+ firetray.ChatStatusIcon.setUrgency(xid, false);
+ firetray.ChatStatusIcon.stopIconBlinking();
this.acknowledgeOnFocus.must = false;
}
++
++ this._isAttentionCalling = false;
+ },
+
+ onSelect: function(event) {
+ log.debug("select event ! ");
- firetray.Chat.stopIconBlinkingMaybe();
++ firetray.Chat.stopGetAttentionMaybe(firetray.Handler.findActiveWindow());
},
- isConvCurrentlyShown: function(conv, xid) {
+ isConvCurrentlyShown: function(conv, activeWin) {
+ log.debug("isConvCurrentlyShown");
- let activeWin = xid || firetray.Handler.findActiveWindow();
if (!firetray.Handler.windows[activeWin]) return false;
+ log.debug("1 ***");
let activeChatTab = this.findSelectedChatTab(activeWin);
if (!activeChatTab) return false;
diff --cc src/modules/linux/FiretrayChatStatusIcon.jsm
index c67701b,379702d..ca17dd8
--- a/src/modules/linux/FiretrayChatStatusIcon.jsm
+++ b/src/modules/linux/FiretrayChatStatusIcon.jsm
@@@ -76,7 -73,7 +76,6 @@@ firetray.ChatStatusIcon =
setIconImageFromGIcon: function(gicon) {
if (!firetray.ChatStatusIcon.trayIcon || !gicon)
log.error("Icon missing");
-- log.debug(gicon);
gtk.gtk_status_icon_set_from_gicon(firetray.ChatStatusIcon.trayIcon, gicon);
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list