From 2480ffbf851ecf57e4efd2216f9d3092f49861e7 Mon Sep 17 00:00:00 2001 From: foudfou Date: Sat, 22 Mar 2014 01:15:19 +0100 Subject: [PATCH] * Handle custom icons on winnt. * cleaning (createTextIcon() on winnt) Harmonize custom icon handling (setIconImageDefault(), setIconImageCustom()). Harmonize preference handling in prefwindow regardless if instantApply. --- src/chrome/content/options.js | 56 +++++--- src/chrome/content/options.xul | 3 +- src/modules/FiretrayHandler.jsm | 10 +- src/modules/FiretrayMessaging.jsm | 3 +- src/modules/ctypes/ctypesMap.jsm | 2 +- src/modules/ctypes/winnt/gdi32.jsm | 11 ++ src/modules/linux/FiretrayStatusIcon.jsm | 15 +- src/modules/winnt/FiretrayStatusIcon.jsm | 168 +++++++++++++++-------- 8 files changed, 182 insertions(+), 86 deletions(-) diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js index c4b6841..c9c2f11 100644 --- a/src/chrome/content/options.js +++ b/src/chrome/content/options.js @@ -20,6 +20,7 @@ let log = firetray.Logging.getLogger("firetray.UIOptions"); var firetrayUIOptions = { strings: null, prefwindow: null, + listeners: {}, onLoad: function(e) { log.debug("FULL FEATURED="+firetray.Handler.support['full_feat']); @@ -60,6 +61,7 @@ var firetrayUIOptions = { onQuit: function(e) { if (firetray.Handler.inMailApp) { + this.removeListeners(); this.removeMailAccountsObserver(); } }, @@ -232,10 +234,14 @@ var firetrayUIOptions = { document.getElementById("ui_mail_notification_enabled").checked = (firetray.Utils.prefService.getBoolPref("mail_notification_enabled")); - let radioMailNotify = document.getElementById("ui_radiogroup_mail_notification"); + let mailNotifyRadio = document.getElementById("ui_radiogroup_mail_notification"); let prefMailNotificationType = firetray.Utils.prefService.getIntPref("mail_notification_type"); - radioMailNotify.selectedIndex = this.radioGetIndexByValue(radioMailNotify, prefMailNotificationType); + mailNotifyRadio.selectedIndex = this.radioGetIndexByValue(mailNotifyRadio, prefMailNotificationType); // this.disableNotificationMaybe(prefMailNotificationType); // done in toggleNotifications() + /* We need to ensure assigning selectedIndex in disableMessageCountMaybe() + does change the corresponding preference. */ + let listener = {evt:'select', fn:firetrayUIOptions.userChangedValue, cap:true}; + this.addListener(mailNotifyRadio, listener); }, initMessageCountSettings: function() { @@ -261,6 +267,10 @@ var firetrayUIOptions = { blinkStyle.selectedIndex = this.radioGetIndexByValue(blinkStyle, prefBlinkStyle); }, + userChangedValue: function(e) { + document.getElementById('pref-pane-mail').userChangedValue(e.originalTarget); + }, + radioGetIndexByValue: function(radio, value) { for (let i=0, len=radio.itemCount; i + observes="broadcaster-notification-disabled" flex="1" />