[Pkg-mozext-commits] [firetray] 206/399: * refactor appinfo initializations * fix icon tooltip when unread messages
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:44 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 b6b8d5dca0c0665316b8b143156c070725293e8a
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Fri Mar 9 13:27:49 2012 +0100
* refactor appinfo initializations
* fix icon tooltip when unread messages
---
src/modules/FiretrayHandler.jsm | 26 +++++++++++---------------
src/modules/FiretrayMessaging.jsm | 19 ++++++-------------
src/modules/linux/FiretrayStatusIcon.jsm | 4 ++--
src/modules/linux/FiretrayWindow.jsm | 6 +++---
4 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 90cd538..93f7741 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -35,12 +35,12 @@ firetray.Handler = {
FILENAME_NEWMAIL: null,
initialized: false,
- appNameOriginal: null,
- appStarted: false,
- appName: null,
- runtimeOS: null,
+ appName: (function(){return Services.appinfo.name;})(),
+ runtimeABI: (function(){return Services.appinfo.XPCOMABI;})(),
+ runtimeOS: (function(){return Services.appinfo.OS;})(), // "WINNT", "Linux", "Darwin"
inMailApp: false,
inBrowserApp: false,
+ appStarted: false,
windows: {},
windowsCount: 0,
visibleWindowsCount: 0,
@@ -48,16 +48,6 @@ firetray.Handler = {
init: function() { // does creates icon
firetray.PrefListener.register(false);
- this.appNameOriginal = Services.appinfo.name;
- this.FILENAME_DEFAULT = firetray.Utils.chromeToPath(
- "chrome://firetray/skin/" + this.appNameOriginal.toLowerCase() + this.FILENAME_SUFFIX);
- this.FILENAME_BLANK = firetray.Utils.chromeToPath(
- "chrome://firetray/skin/blank-icon.png");
- this.FILENAME_NEWMAIL = firetray.Utils.chromeToPath(
- "chrome://firetray/skin/message-mail-new.png");
-
- this.runtimeABI = Services.appinfo.XPCOMABI;
- this.runtimeOS = Services.appinfo.OS; // "WINNT", "Linux", "Darwin"
// version checked during install, so we shouldn't need to care
let xulVer = Services.appinfo.platformVersion; // Services.vc.compare(xulVer,"2.0a")>=0
firetray.LOG("OS=" + this.runtimeOS + ", ABI=" + this.runtimeABI + ", XULrunner=" + xulVer);
@@ -73,13 +63,19 @@ firetray.Handler = {
return false;
}
- this.appName = Services.appinfo.name;
if (this.appName === "Thunderbird" || this.appName === "SeaMonkey")
this.inMailApp = true;
if (this.appName === "Firefox" || this.appName === "SeaMonkey")
this.inBrowserApp = true;
firetray.LOG('inMailApp: '+this.inMailApp+', inBrowserApp: '+this.inBrowserApp);
+ this.FILENAME_DEFAULT = firetray.Utils.chromeToPath(
+ "chrome://firetray/skin/" + this.appName.toLowerCase() + this.FILENAME_SUFFIX);
+ this.FILENAME_BLANK = firetray.Utils.chromeToPath(
+ "chrome://firetray/skin/blank-icon.png");
+ this.FILENAME_NEWMAIL = firetray.Utils.chromeToPath(
+ "chrome://firetray/skin/message-mail-new.png");
+
firetray.StatusIcon.init();
firetray.Handler.showHideIcon();
firetray.LOG('StatusIcon initialized');
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 23a1a73..2728eae 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -109,23 +109,23 @@ firetray.Messaging = {
if (!this.initialized)
return;
+ // initialize
+ let newMsgCount, localizedTooltip;
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
firetray.LOG("msgCountType="+msgCountType);
- let folderCountFunction, localizedTooltip;
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) {
- folderCountFunction = this.unreadMsgCountIterate;
+ newMsgCount = this.countMessages(this.unreadMsgCountIterate);
localizedTooltip = PluralForm.get(
newMsgCount,
firetray.Utils.strings.GetStringFromName("tooltip.unread_messages"))
- .replace("#1", newMsgCount);;
+ .replace("#1", newMsgCount);
+ firetray.WARN(localizedTooltip);
} else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) {
- folderCountFunction = this.newMsgCountIterate;
+ newMsgCount = this.countMessages(this.newMsgCountIterate);
localizedTooltip = firetray.Utils.strings.GetStringFromName("tooltip.new_messages");
} else
firetray.ERROR('unknown message count type');
- let newMsgCount = this.countMessages(folderCountFunction);
-
// update icon
if (newMsgCount == 0) {
firetray.Handler.setIconImageDefault();
@@ -149,13 +149,6 @@ firetray.Messaging = {
firetray.ERROR("Unknown notification mode: "+prefMailNotification);
}
- if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD) {
- folderCountFunction = this.unreadMsgCountIterate;
- } else if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW) {
- folderCountFunction = this.newMsgCountIterate;
- } else
- firetray.ERROR('unknown message count type');
-
firetray.Handler.setIconTooltip(localizedTooltip);
} else {
diff --git a/src/modules/linux/FiretrayStatusIcon.jsm b/src/modules/linux/FiretrayStatusIcon.jsm
index 6a603a9..5c468a8 100644
--- a/src/modules/linux/FiretrayStatusIcon.jsm
+++ b/src/modules/linux/FiretrayStatusIcon.jsm
@@ -143,9 +143,9 @@ firetray.Handler.setIconTooltip = function(toolTipStr) {
};
firetray.Handler.setIconTooltipDefault = function() {
- if (!this.appNameOriginal)
+ if (!this.appName)
throw "application name not initialized";
- this.setIconTooltip(this.appNameOriginal);
+ this.setIconTooltip(this.appName);
};
firetray.Handler.setIconText = function(text, color) { // FIXME: function too long
diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm
index bc7ade1..13df633 100644
--- a/src/modules/linux/FiretrayWindow.jsm
+++ b/src/modules/linux/FiretrayWindow.jsm
@@ -455,10 +455,10 @@ firetray.Window = {
getWindowTitle: function(xid) {
let title = firetray.Handler.windows[xid].baseWin.title;
firetray.LOG("baseWin.title="+title);
- let tailIndex = title.indexOf(" - Mozilla "+firetray.Handler.appNameOriginal);
+ let tailIndex = title.indexOf(" - Mozilla "+firetray.Handler.appName);
if (tailIndex !== -1)
return title.substring(0, tailIndex);
- else if (title === "Mozilla "+firetray.Handler.appNameOriginal)
+ else if (title === "Mozilla "+firetray.Handler.appName)
return title;
else
return null;
@@ -531,7 +531,7 @@ firetray.Handler.registerWindow = function(win) {
if (x.name === "RangeError") // instanceof not working :-(
win.alert(x+"\n\nYou seem to have more than "+FIRETRAY_WINDOW_COUNT_MAX
+" windows open. This breaks FireTray and most probably "
- +firetray.Handler.appNameOriginal+".");
+ +firetray.Handler.appName+".");
}
this.windowsCount += 1;
// NOTE: no need to check for window state to set visibility because all
--
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