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