diff --git a/src/chrome/locale/en-US/overlay.properties b/src/chrome/locale/en-US/overlay.properties index 84b74e9..dea0a52 100644 --- a/src/chrome/locale/en-US/overlay.properties +++ b/src/chrome/locale/en-US/overlay.properties @@ -3,3 +3,4 @@ popupMenu.itemLabel.Quit=Quit popupMenu.itemLabel.NewWindow=New window popupMenu.itemLabel.NewMessage=New message tooltip.unread_messages=#1 unread message;#1 unread messages +tooltip.new_messages=New messages ! diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm index e41c99a..f470f72 100644 --- a/src/modules/FiretrayMessaging.jsm +++ b/src/modules/FiretrayMessaging.jsm @@ -109,7 +109,22 @@ firetray.Messaging = { if (!this.initialized) return; - let newMsgCount = this.countMessages(); + let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type"); + LOG("msgCountType="+msgCountType); + let folderCountFunction, localizedTooltip; + if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) { + folderCountFunction = this.unreadMsgCountIterate; + localizedTooltip = PluralForm.get( + newMsgCount, + firetray.Utils.strings.GetStringFromName("tooltip.unread_messages")) + .replace("#1", newMsgCount);; + } else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) { + folderCountFunction = this.newMsgCountIterate; + localizedTooltip = firetray.Utils.strings.GetStringFromName("tooltip.new_messages"); + } else + ERROR('unknown message count type'); + + let newMsgCount = this.countMessages(folderCountFunction); // update icon if (newMsgCount == 0) { @@ -134,11 +149,14 @@ firetray.Messaging = { ERROR("Unknown notification mode: "+prefMailNotification); } - let localizedMessage = PluralForm.get( - newMsgCount, - firetray.Utils.strings.GetStringFromName("tooltip.unread_messages")) - .replace("#1", newMsgCount);; - firetray.Handler.setIconTooltip(localizedMessage); + if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) { + folderCountFunction = this.unreadMsgCountIterate; + } else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) { + folderCountFunction = this.newMsgCountIterate; + } else + ERROR('unknown message count type'); + + firetray.Handler.setIconTooltip(localizedTooltip); } else { throw "negative message count"; // should never happen @@ -149,18 +167,7 @@ firetray.Messaging = { /** * computes total unread or new message count. */ - countMessages: function() { - let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type"); - LOG("msgCountType="+msgCountType); - - let folderCountFunction; - if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) { - folderCountFunction = this.unreadMsgCountIterate; - } else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) { - folderCountFunction = this.newMsgCountIterate; - } else - ERROR('unknown message count type'); - + countMessages: function(folderCountFunction) { let mailAccounts = firetray.Utils.getObjPref('mail_accounts'); LOG("mail accounts from pref: "+JSON.stringify(mailAccounts)); let serverTypes = mailAccounts["serverTypes"]; diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm index 9c21a68..72ee8de 100644 --- a/src/modules/linux/FiretrayWindow.jsm +++ b/src/modules/linux/FiretrayWindow.jsm @@ -198,7 +198,8 @@ firetray.Window = { // better visual effect if visibility set here instead of before firetray.Window.setVisibility(xid, true); - firetray.Window.restoreDesktop(xid); // after show + // after show + firetray.Window.restoreDesktop(xid); firetray.Window.activate(xid); firetray.PopupMenu.hideSingleWindowItemAndSeparatorMaybe(xid);