[Pkg-mozext-commits] [firetray] 195/399: fix tooltip for count type 'new messages'

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:42 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 56b0fe63327f4f7ea967f98897ef617db56071be
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Mar 6 23:28:52 2012 +0100

    fix tooltip for count type 'new messages'
---
 src/chrome/locale/en-US/overlay.properties |    1 +
 src/modules/FiretrayMessaging.jsm          |   43 ++++++++++++++++------------
 src/modules/linux/FiretrayWindow.jsm       |    3 +-
 3 files changed, 28 insertions(+), 19 deletions(-)

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);

-- 
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