Hide the 'Hidden Conversations' and 'Contacts' header when the last hidden conversation is closed.

This commit is contained in:
Florian Quèze 2011-09-14 01:54:24 +02:00
Родитель 6f5ecf54b4
Коммит 7ec31469a1
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -356,13 +356,12 @@ var buddyList = {
let convElt = document.createElement("conv");
this.convBox.appendChild(convElt);
convElt.build(aSubject);
this._updateListConvCount();
this.convBox._updateListConvCount();
return;
}
else if (aTopic == "showing-ui-conversation") {
if (this.convBox.listedConvs.hasOwnProperty(aSubject.id))
this.convBox.listedConvs[aSubject.id].removeNode();
this._updateListConvCount();
return;
}
@ -377,11 +376,6 @@ var buddyList = {
}
},
_updateListConvCount: function() {
let count = Object.keys(this.convBox.listedConvs).length;
this.convBox.parentNode.setAttribute("listedConvCount", count);
},
displayUserIcon: function bl_displayUserIcon() {
let icon = Services.core.getUserIcon();
document.getElementById("userIcon").src = icon ? icon.spec : "";
@ -664,6 +658,12 @@ var buddyList = {
buddyList.convBox = document.getElementById("convlistbox");
buddyList.convBox.listedConvs = {};
buddyList.convBox._updateListConvCount = function() {
let count = Object.keys(this.listedConvs).length;
this.parentNode.setAttribute("listedConvCount", count);
};
buddyList.convBox.addEventListener("DOMNodeRemoved",
buddyList.convBox._updateListConvCount);
let convs = Services.conversations.getUIConversations();
if (convs.length != 0) {
if (!("Conversations" in window))
@ -675,7 +675,7 @@ var buddyList = {
convElt.build(conv);
}
}
buddyList._updateListConvCount();
buddyList.convBox._updateListConvCount();
}
prefBranch.addObserver(showOfflineBuddiesPref, buddyList, false);
addObservers(buddyList, events);