[Pkg-mozext-commits] [firetray] 87/399: option: ability to choose 'newmail' icon

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:19 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit 919d9fe3dfe60e62e18b14f711b5bf9083d2480c
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Nov 6 20:56:26 2011 +0100

    option: ability to choose 'newmail' icon
---
 src/chrome/content/options.js     |    4 +++-
 src/modules/FiretrayHandler.jsm   |    6 ++++--
 src/modules/FiretrayMessaging.jsm |   19 ++++++++++++++++---
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 9c4bee2..7707b99 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -86,8 +86,10 @@ firetray.UIOptions = {
 
     if (notificationSetting === NOTIFICATION_DISABLED)
       firetray.Messaging.disable();
-    else
+    else {
       firetray.Messaging.enable();
+      firetray.Messaging.updateUnreadMsgCount();
+    }
 
   },
 
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 6b2ae51..b98b2d4 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -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;
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 5c1037b..a7e19e6 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -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
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list