diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js index b4bf75c..f98200f 100644 --- a/src/chrome/content/options.js +++ b/src/chrome/content/options.js @@ -7,27 +7,20 @@ const Cu = Components.utils; Cu.import("resource://firetray/FiretrayHandler.jsm"); Cu.import("resource://firetray/commons.js"); -/** - * firetray namespace. - */ -if ("undefined" == typeof(firetray)) { - var firetray = {}; -}; - const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0; const TREEROW_ACCOUNT_OR_SERVER_TYPE_EXCLUDED = 1; const TREEROW_ACCOUNT_OR_SERVER_TYPE_ORDER = 2; const TREELEVEL_SERVER_TYPES = 0; const TREELEVEL_EXCLUDED_ACCOUNTS = 1; -firetray.UIOptions = { +var firetrayUIOptions = { strings: null, onLoad: function(e) { - window.removeEventListener('load', arguments.callee, true); - this.strings = document.getElementById("firetray-options-strings"); + this.initWindowAndIconControls(); + if(firetray.Handler.inMailApp) { Cu.import("resource://firetray/FiretrayMessaging.jsm"); this.initMailControls(); @@ -35,12 +28,9 @@ firetray.UIOptions = { let mailTab = document.getElementById("mail_tab"); this.hideElement(mailTab, true); } - }, onQuit: function(e) { - window.removeEventListener('unload', arguments.callee, true); - // cleaning: removeEventListener on cells // NOTE: not sure this is necessary on window close let tree = document.getElementById("ui_tree_mail_accounts"); @@ -72,6 +62,16 @@ firetray.UIOptions = { } catch(e) {} }, + initWindowAndIconControls: function() { + this.disableHidesOptions(!firetray.Utils.prefService.getBoolPref('hides_on_close')); + }, + + disableHidesOptions: function(doDisable) { + LOG("doDisable="+doDisable); + document.getElementById('ui_hides_single_window').disabled = doDisable; + // TODO: NOT IMPLEMENTED YET: document.getElementById('ui_hides_on_minimize').disabled = doDisable; + }, + initMailControls: function() { this.populateExcludedFoldersList(); this.populateTreeAccountsOrServerTypes(); @@ -229,7 +229,7 @@ firetray.UIOptions = { 'ancestor::xul:treeitem[1]/descendant::xul:treechildren//xul:treerow'); LOG("subRows="+subRows); for (let i=0; i + accesskey="&bool_hides_on_close.accesskey;" + onclick="firetrayUIOptions.disableHidesOptions(this.checked);"/> + - @@ -65,11 +66,11 @@ + oncommand="firetrayUIOptions.updateNotificationSettings()" /> + oncommand="firetrayUIOptions.updateNotificationSettings()" />