1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-22 13:58:48 -05:00

option: ability to choose 'newmail' icon

This commit is contained in:
foudfou 2011-11-06 20:56:26 +01:00
parent 2fabe37d0c
commit 919d9fe3df
3 changed files with 23 additions and 6 deletions

View File

@ -86,8 +86,10 @@ firetray.UIOptions = {
if (notificationSetting === NOTIFICATION_DISABLED)
firetray.Messaging.disable();
else
else {
firetray.Messaging.enable();
firetray.Messaging.updateUnreadMsgCount();
}
},

View File

@ -46,7 +46,7 @@ firetray.Handler = {
this.FILENAME_BLANK = firetray.Utils.chromeToPath(
"chrome://firetray/skin/blank-icon.png");
this.FILENAME_NEWMAIL = firetray.Utils.chromeToPath(
"chrome/skin/message-mail-new.png");
"chrome://firetray/skin/message-mail-new.png");
// init all handled windows
this._updateHandledDOMWindows();
@ -78,8 +78,10 @@ firetray.Handler = {
try {
Cu.import("resource://firetray/FiretrayMessaging.jsm");
let prefMailNotification = firetray.Utils.prefService.getIntPref("mail_notification");
if (prefMailNotification !== NOTIFICATION_DISABLED)
if (prefMailNotification !== NOTIFICATION_DISABLED) {
firetray.Messaging.enable();
firetray.Messaging.updateUnreadMsgCount();
}
} catch (x) {
ERROR(x);
return false;

View File

@ -45,7 +45,6 @@ firetray.Messaging = {
mailSessionNotificationFlags);
this.enabled = true;
this.updateUnreadMsgCount();
},
disable: function() {
@ -112,14 +111,28 @@ firetray.Messaging = {
if (this._unreadMsgCount == 0) {
firetray.Handler.setImageDefault();
firetray.Handler.setTooltipDefault();
} else if (this._unreadMsgCount > 0) {
let prefIconTextColor = firetray.Utils.prefService.getCharPref("icon_text_color");
firetray.Handler.setText(this._unreadMsgCount.toString(), prefIconTextColor);
let prefMailNotification = firetray.Utils.prefService.getIntPref("mail_notification");
switch (prefMailNotification) {
case NOTIFICATION_NEWMAIL_ICON:
firetray.Handler.setImage(firetray.Handler.FILENAME_NEWMAIL);
break;
case NOTIFICATION_UNREAD_MESSAGE_COUNT:
let prefIconTextColor = firetray.Utils.prefService.getCharPref("icon_text_color");
firetray.Handler.setText(this._unreadMsgCount.toString(), prefIconTextColor);
break;
default:
ERROR("Unknown notification mode");
}
let localizedMessage = PluralForm.get(
this._unreadMsgCount,
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
.replace("#1", this._unreadMsgCount);;
firetray.Handler.setTooltip(localizedMessage);
} else {
throw "negative message count"; // should never happen
}