only send change notification for pending filtered messages if the count changed - performance tweak

This commit is contained in:
bienvenu%netscape.com 1999-11-18 02:36:22 +00:00
Родитель 098299e271
Коммит 829eb193d3
1 изменённых файлов: 18 добавлений и 13 удалений

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

@ -990,23 +990,28 @@ PRInt32 nsMsgFolder::GetNumPendingTotalMessages()
void nsMsgFolder::ChangeNumPendingUnread(PRInt32 delta) void nsMsgFolder::ChangeNumPendingUnread(PRInt32 delta)
{ {
char *oldUnreadMessagesStr = PR_smprintf("%d", mNumUnreadMessages + mNumPendingUnreadMessages); if (delta)
mNumPendingUnreadMessages += delta; {
char *unreadMessagesStr = PR_smprintf("%d",mNumUnreadMessages + mNumPendingUnreadMessages); char *oldUnreadMessagesStr = PR_smprintf("%d", mNumUnreadMessages + mNumPendingUnreadMessages);
NotifyPropertyChanged("TotalUnreadMessages", oldUnreadMessagesStr, unreadMessagesStr); mNumPendingUnreadMessages += delta;
PR_smprintf_free(unreadMessagesStr); char *unreadMessagesStr = PR_smprintf("%d",mNumUnreadMessages + mNumPendingUnreadMessages);
PR_smprintf_free(oldUnreadMessagesStr); NotifyPropertyChanged("TotalUnreadMessages", oldUnreadMessagesStr, unreadMessagesStr);
PR_smprintf_free(unreadMessagesStr);
PR_smprintf_free(oldUnreadMessagesStr);
}
} }
void nsMsgFolder::ChangeNumPendingTotalMessages(PRInt32 delta) void nsMsgFolder::ChangeNumPendingTotalMessages(PRInt32 delta)
{ {
char *oldTotalMessagesStr = PR_smprintf("%d", mNumTotalMessages + mNumPendingTotalMessages); if (delta)
mNumPendingTotalMessages += delta; {
char *totalMessagesStr = PR_smprintf("%d",mNumTotalMessages + mNumPendingTotalMessages); char *oldTotalMessagesStr = PR_smprintf("%d", mNumTotalMessages + mNumPendingTotalMessages);
NotifyPropertyChanged("TotalMessages", oldTotalMessagesStr, totalMessagesStr); mNumPendingTotalMessages += delta;
PR_smprintf_free(totalMessagesStr); char *totalMessagesStr = PR_smprintf("%d",mNumTotalMessages + mNumPendingTotalMessages);
PR_smprintf_free(oldTotalMessagesStr); NotifyPropertyChanged("TotalMessages", oldTotalMessagesStr, totalMessagesStr);
PR_smprintf_free(totalMessagesStr);
PR_smprintf_free(oldTotalMessagesStr);
}
} }
#ifdef HAVE_DB #ifdef HAVE_DB