diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 862ba55..06c2511 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -19,16 +19,18 @@ var firetrayUIOptions = {
onLoad: function(e) {
this.strings = document.getElementById("firetray-options-strings");
- this.updateWindowAndIconOptions();
- this.updateScrollOptions();
-
- if(firetray.Handler.inMailApp) {
+ if (firetray.Handler.inMailApp) {
Cu.import("resource://firetray/FiretrayMessaging.jsm");
this.initMailControls();
} else {
let mailTab = document.getElementById("mail_tab");
this.hideElement(mailTab, true);
}
+
+ this.updateWindowAndIconOptions();
+ this.updateScrollOptions();
+ this.initAppIconType();
+ this.initIconNames();
},
onQuit: function(e) {
@@ -76,6 +78,42 @@ var firetrayUIOptions = {
this.disableGroup(document.getElementById("ui_radiogroup_scroll"), !scroll_hides);
},
+ initAppIconType: function() {
+ document.getElementById("ui_app_icon_type_themed").value =
+ FIRETRAY_APPLICATION_ICON_TYPE_THEMED;
+ document.getElementById("ui_app_icon_type_custom").value =
+ FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM;
+ document.getElementById("ui_app_icon_type").selectedIndex =
+ firetray.Utils.prefService.getIntPref("app_icon_type");
+ },
+
+ initIconNames: function() {
+ let appIconNames = firetray.Utils.getArrayPref(firetray.StatusIcon.prefAppIconNames);
+ LOG("appIconNames="+appIconNames);
+ let len = appIconNames.length;
+ if (len>2)
+ throw new RangeError("Too many icon names");
+ for (let i=0; i
+
+
@@ -36,7 +38,8 @@
-
+
+
@@ -44,8 +47,6 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -130,18 +162,30 @@
observes="broadcaster-notification-disabled"/>
-
+
+
+
+
+
+
+
+ onchange="firetray.Messaging.updateMsgCount();" flex="1" />
@@ -204,7 +248,7 @@
-
+
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 681d826..5e5d905 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -4,10 +4,10 @@
-
+
+
-
@@ -21,9 +21,16 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index e24b252..67e6907 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -13,6 +13,11 @@ pref("extensions.firetray.hides_single_window", false);
pref("extensions.firetray.start_hidden", false);
pref("extensions.firetray.show_activates", false);
+pref("extensions.firetray.app_icon_type", 0);
+pref("extensions.firetray.app_browser_icon_names", '[]');
+pref("extensions.firetray.app_mail_icon_names", '["indicator-messages", "applications-email-panel"]');
+pref("extensions.firetray.app_default_icon_names", '[]');
+pref("extensions.firetray.app_icon_filename", "");
pref("extensions.firetray.show_icon_on_hide", false);
pref("extensions.firetray.scroll_hides", true);
pref("extensions.firetray.scroll_mode", "down_hides");
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 2e2ca78..42b633f 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -370,6 +370,16 @@ firetray.PrefListener = new PrefListener(
case 'message_count_type':
firetray.Messaging.updateMsgCount();
break;
+ case 'app_mail_icon_names':
+ case 'app_browser_icon_names':
+ case 'app_default_icon_names':
+ firetray.StatusIcon.loadThemedIcons();
+ case 'app_icon_type':
+ if (firetray.Handler.inMailApp)
+ firetray.Messaging.updateMsgCount();
+ else
+ firetray.Handler.setIconImageDefault();
+ break;
default:
}
});
diff --git a/src/modules/commons.js b/src/modules/commons.js
index 6b64292..b1f1e81 100644
--- a/src/modules/commons.js
+++ b/src/modules/commons.js
@@ -4,9 +4,10 @@
provided by this module */
var EXPORTED_SYMBOLS =
[ "firetray", "LOG", "WARN", "ERROR", "FIREFOX_ID", "THUNDERBIRD_ID",
- "SEAMONKEY_ID", "FIRETRAY_ID", "FIRETRAY_SPLASH_PAGE", "getType",
- "isArray", "isEmpty", "strEquals",
- "FIRETRAY_NOTIFICATION_UNREAD_MESSAGE_COUNT",
+ "SEAMONKEY_ID", "FIRETRAY_ID", "FIRETRAY_SPLASH_PAGE",
+ "FIRETRAY_APPLICATION_ICON_TYPE_THEMED",
+ "FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM", "getType", "isArray", "isEmpty",
+ "strEquals", "FIRETRAY_NOTIFICATION_UNREAD_MESSAGE_COUNT",
"FIRETRAY_NOTIFICATION_NEWMAIL_ICON", "FIRETRAY_NOTIFICATION_CUSTOM_ICON",
"FIRETRAY_DELAY_BROWSER_STARTUP_MILLISECONDS",
"FIRETRAY_DELAY_NOWAIT_MILLISECONDS", "FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD",
@@ -29,6 +30,9 @@ const CHATZILLA_ID = "{59c81df5-4b7a-477b-912d-4e0fdf64e5f2}";
const FIRETRAY_ID = "{9533f794-00b4-4354-aa15-c2bbda6989f8}";
const FIRETRAY_SPLASH_PAGE = "http://foudfou.github.com/FireTray/";
+const FIRETRAY_APPLICATION_ICON_TYPE_THEMED = 0;
+const FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM = 1;
+
const FIRETRAY_NOTIFICATION_UNREAD_MESSAGE_COUNT = 0;
const FIRETRAY_NOTIFICATION_NEWMAIL_ICON = 1;
const FIRETRAY_NOTIFICATION_CUSTOM_ICON = 3;
@@ -216,6 +220,13 @@ if(!Object.keys) Object.keys = function(o){
return ret;
};
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim
+if(!String.prototype.trim) {
+ String.prototype.trim = function () {
+ return this.replace(/^\s+|\s+$/g,'');
+ };
+}
+
// http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json
function isEmpty(obj) {
for(var prop in obj) {
diff --git a/src/modules/linux/FiretrayStatusIcon.jsm b/src/modules/linux/FiretrayStatusIcon.jsm
index 3385d92..fd601a4 100644
--- a/src/modules/linux/FiretrayStatusIcon.jsm
+++ b/src/modules/linux/FiretrayStatusIcon.jsm
@@ -30,6 +30,7 @@ firetray.StatusIcon = {
trayIcon: null,
themedIconApp: null,
themedIconNewMail: null,
+ prefAppIconNames: null,
init: function() {
try {
@@ -39,9 +40,7 @@ firetray.StatusIcon = {
LOG("gtkIconTheme="+gtkIconTheme);
gtk.gtk_icon_theme_append_search_path(gtkIconTheme, this.GTK_THEME_ICON_PATH);
- // TODO: make related options
- this.themedIconApp = this.initThemedIcon(["indicator-messages", "applications-email-panel", firetray.Handler.appNameOriginal.toLowerCase()]);
- this.themedIconNewMail = this.initThemedIcon(["indicator-messages-new", "mail-message-new"]);
+ this.loadThemedIcons();
this.trayIcon = gtk.gtk_status_icon_new();
@@ -69,6 +68,20 @@ firetray.StatusIcon = {
this.initialized = false;
},
+ loadThemedIcons: function() {
+ if (firetray.Handler.inMailApp) {
+ this.prefAppIconNames = "app_mail_icon_names";
+ this.themedIconNewMail = this.initThemedIcon(["indicator-messages-new", "mail-message-new"]); // TODO
+ } else if (firetray.Handler.inBrowserApp) {
+ this.prefAppIconNames = "app_browser_icon_names";
+ } else {
+ this.prefAppIconNames = "app_default_icon_names";
+ }
+ let appIconNames = firetray.Utils.getArrayPref(this.prefAppIconNames);
+ appIconNames.push(firetray.Handler.appNameOriginal.toLowerCase());
+ this.themedIconApp = this.initThemedIcon(appIconNames);
+ },
+
initThemedIcon: function(names) {
if (!isArray(names)) throw new TypeError();
let namesLen = names.length;
@@ -162,7 +175,13 @@ firetray.Handler.setIconImageFromFile = firetray.StatusIcon.setIconImageFromFile
firetray.Handler.setIconImageDefault = function() {
if (!firetray.StatusIcon.themedIconApp)
throw "Default application themed icon not set";
- firetray.Handler.setIconImage(firetray.StatusIcon.themedIconApp);
+ let appIconType = firetray.Utils.prefService.getIntPref("app_icon_type");
+ if (appIconType === FIRETRAY_APPLICATION_ICON_TYPE_THEMED)
+ firetray.Handler.setIconImage(firetray.StatusIcon.themedIconApp);
+ else if (appIconType === FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM) {
+ let appIconFilename = firetray.Utils.prefService.getCharPref("app_icon_filename");
+ firetray.Handler.setIconImageFromFile(appIconFilename);
+ }
};
// GTK bug: Gdk-CRITICAL **: IA__gdk_window_get_root_coords: assertion `GDK_IS_WINDOW (window)' failed