mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-08 20:18:17 -05:00
refactor startIconBlinkingMaybe()
This commit is contained in:
parent
6b1bd0cfe6
commit
53e3421a51
@ -60,14 +60,7 @@ firetray.Chat = {
|
|||||||
case "new-directed-incoming-message": // when PM or cited in channel
|
case "new-directed-incoming-message": // when PM or cited in channel
|
||||||
let conv = subject.QueryInterface(Ci.prplIMessage).conversation;
|
let conv = subject.QueryInterface(Ci.prplIMessage).conversation;
|
||||||
log.debug("conversation name="+conv.name); // normalizedName shouldn't be necessary
|
log.debug("conversation name="+conv.name); // normalizedName shouldn't be necessary
|
||||||
|
this.startIconBlinkingMaybe(conv);
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "unread-im-count-changed":
|
case "unread-im-count-changed":
|
||||||
@ -87,8 +80,21 @@ firetray.Chat = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stopIconBlinkingMaybe: function(xid) {
|
// rename to setUrgency(bool), and possibly handle blinking ourselves
|
||||||
log.debug("acknowledgeOnFocus.must="+this.acknowledgeOnFocus.must);
|
// (gtk_status_icon_set_blinking deprecated)
|
||||||
|
startIconBlinkingMaybe: function(conv) {
|
||||||
|
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);
|
||||||
|
// TODO: + gtk_window_set_urgency_hint(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
stopIconBlinkingMaybe: function(xid) { // xid optional
|
||||||
|
log.error("acknowledgeOnFocus.must="+this.acknowledgeOnFocus.must);
|
||||||
if (!this.acknowledgeOnFocus.must) return;
|
if (!this.acknowledgeOnFocus.must) return;
|
||||||
|
|
||||||
let convIsCurrentlyShown = this.isConvCurrentlyShown(
|
let convIsCurrentlyShown = this.isConvCurrentlyShown(
|
||||||
@ -96,6 +102,7 @@ firetray.Chat = {
|
|||||||
log.debug("convIsCurrentlyShown="+convIsCurrentlyShown);
|
log.debug("convIsCurrentlyShown="+convIsCurrentlyShown);
|
||||||
|
|
||||||
if (this.acknowledgeOnFocus.must && convIsCurrentlyShown) {
|
if (this.acknowledgeOnFocus.must && convIsCurrentlyShown) {
|
||||||
|
// TODO: + gtk_window_set_urgency_hint(false)
|
||||||
firetray.ChatStatusIcon.setIconBlinking(false);
|
firetray.ChatStatusIcon.setIconBlinking(false);
|
||||||
this.acknowledgeOnFocus.must = false;
|
this.acknowledgeOnFocus.must = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user