1
0
mirror of https://github.com/moparisthebest/FireTray synced 2025-01-08 12:08:05 -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) if (notificationSetting === NOTIFICATION_DISABLED)
firetray.Messaging.disable(); firetray.Messaging.disable();
else else {
firetray.Messaging.enable(); firetray.Messaging.enable();
firetray.Messaging.updateUnreadMsgCount();
}
}, },

View File

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

View File

@ -45,7 +45,6 @@ firetray.Messaging = {
mailSessionNotificationFlags); mailSessionNotificationFlags);
this.enabled = true; this.enabled = true;
this.updateUnreadMsgCount();
}, },
disable: function() { disable: function() {
@ -112,14 +111,28 @@ firetray.Messaging = {
if (this._unreadMsgCount == 0) { if (this._unreadMsgCount == 0) {
firetray.Handler.setImageDefault(); firetray.Handler.setImageDefault();
firetray.Handler.setTooltipDefault(); firetray.Handler.setTooltipDefault();
} else if (this._unreadMsgCount > 0) { } else if (this._unreadMsgCount > 0) {
let prefIconTextColor = firetray.Utils.prefService.getCharPref("icon_text_color"); let prefMailNotification = firetray.Utils.prefService.getIntPref("mail_notification");
firetray.Handler.setText(this._unreadMsgCount.toString(), prefIconTextColor); 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( let localizedMessage = PluralForm.get(
this._unreadMsgCount, this._unreadMsgCount,
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages")) firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
.replace("#1", this._unreadMsgCount);; .replace("#1", this._unreadMsgCount);;
firetray.Handler.setTooltip(localizedMessage); firetray.Handler.setTooltip(localizedMessage);
} else { } else {
throw "negative message count"; // should never happen throw "negative message count"; // should never happen
} }