mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-09 04:28:16 -05:00
option: ability to choose 'newmail' icon
This commit is contained in:
parent
2fabe37d0c
commit
919d9fe3df
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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 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");
|
let prefIconTextColor = firetray.Utils.prefService.getCharPref("icon_text_color");
|
||||||
firetray.Handler.setText(this._unreadMsgCount.toString(), prefIconTextColor);
|
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user