[Pkg-mozext-commits] [firetray] 124/399: * cleaner fix to binding problem for options also * improve "hides" options behaviour

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:26 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 bdfdf5294cbd51de83dd4ac731ae3282170f66e4
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Jan 1 03:01:01 2012 +0100

    * cleaner fix to binding problem for options also
    * improve "hides" options behaviour
---
 src/chrome/content/options.js       |   40 +++++++++++++++++++++--------------
 src/chrome/content/options.xul      |   23 ++++++++++----------
 src/chrome/locale/en-US/options.dtd |    4 ++--
 src/defaults/preferences/prefs.js   |    2 +-
 4 files changed, 39 insertions(+), 30 deletions(-)

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<subRows.length; i++) {
-        firetray.UIOptions._disableTreeRow(
+        firetrayUIOptions._disableTreeRow(
           subRows[i], (checkboxCell.getAttribute("value") === "false"));
       }
 
@@ -419,5 +419,13 @@ firetray.UIOptions = {
 };
 
 
-window.addEventListener('load', firetray.UIOptions.onLoad, false);
-window.addEventListener('unload', firetray.UIOptions.onQuit, false);
+window.addEventListener(
+  'load', function (e) {
+    removeEventListener('load', arguments.callee, true);
+    firetrayUIOptions.onLoad(); },
+  false);
+window.addEventListener(
+  'unload', function (e) {
+    removeEventListener('unload', arguments.callee, true);
+    firetrayUIOptions.onQuit(); },
+  false);
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index 50c88f9..2b50929 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -42,14 +42,15 @@
 
             <checkbox id="ui_hides_on_close" preference="pref_bool_hides_on_close"
                       label="&bool_hides_on_close.label;"
-                      accesskey="&bool_hides_on_close.accesskey;"/>
+                      accesskey="&bool_hides_on_close.accesskey;"
+                      onclick="firetrayUIOptions.disableHidesOptions(this.checked);"/>
+            <checkbox id="ui_hides_single_window" preference="pref_bool_hides_single_window"
+                      label="&bool_hides_single_window.label;"
+                      accesskey="&bool_hides_single_window.accesskey;"/>
             <checkbox id="ui_hides_on_minimize" preference="pref_bool_hides_on_minimize"
                       label="&bool_hides_on_minimize.label;"
                       accesskey="&bool_hides_on_minimize.accesskey;"
                       disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
-            <checkbox id="ui_hides_single_window" preference="pref_bool_hides_single_window"
-                      label="&bool_hides_single_window.label;"
-                      accesskey="&bool_hides_single_window.accesskey;"/>
           </groupbox>
 
         </tabpanel>
@@ -65,11 +66,11 @@
             <radiogroup id="radiogroup_mail_notification">
               <radio id="radio_mail_icon1" label="&mail_notification_disabled.label;"
                      accesskey="&mail_notification_disabled.accesskey;"
-                     oncommand="firetray.UIOptions.updateNotificationSettings()" />
+                     oncommand="firetrayUIOptions.updateNotificationSettings()" />
               <hbox>
                 <radio id="radio_mail_icon2" label="&mail_notification_unread_count.label;"
                        accesskey="&mail_notification_unread_count.accesskey;"
-                       oncommand="firetray.UIOptions.updateNotificationSettings()" />
+                       oncommand="firetrayUIOptions.updateNotificationSettings()" />
                 <hbox id="icon_text_color" align="center">
                   <label value="&icon_text_color;" accesskey="&icon_text_color.accesskey;"/>
                   <colorpicker id="btn_icon_text_color" type="button"
@@ -79,17 +80,17 @@
               </hbox>
               <radio id="radio_mail_icon3" label="&mail_notification_newmail_icon.label;"
                      accesskey="&mail_notification_newmail_icon.accesskey;"
-                     oncommand="firetray.UIOptions.updateNotificationSettings()" />
+                     oncommand="firetrayUIOptions.updateNotificationSettings()" />
               <hbox>
                 <radio id="radio_mail_icon4" label="&mail_notification_custom_mail_icon.label;"
                        accesskey="&mail_notification_custom_mail_icon.accesskey;"
-                       oncommand="firetray.UIOptions.updateNotificationSettings()" />
+                       oncommand="firetrayUIOptions.updateNotificationSettings()" />
                 <hbox id="custom_mail_icon" align="center" flex="1" >
                   <textbox id="custom_mail_icon_filename" preference="pref_string_custom_mail_icon"
                            onblur="firetray.Messaging.updateUnreadMsgCount();" flex="1" />
                   <button id="custom_mail_icon_select" label="&choose;"
                           accesskey="&choose.accesskey;"
-                          oncommand="firetray.UIOptions.chooseMailIconFile()" />
+                          oncommand="firetrayUIOptions.chooseMailIconFile()" />
                 </hbox>
               </hbox>
             </radiogroup>
@@ -106,7 +107,7 @@
 
             <listbox id="excluded_folders_list" rows="7" flex="1" seltype="multiple"
                      tooltiptext="&excluded_folders_list.tooltip;"
-                     onselect="firetray.UIOptions.updateExcludedFoldersPref()"
+                     onselect="firetrayUIOptions.updateExcludedFoldersPref()"
                      observes="broadcaster-notification-disabled" />
           </groupbox>
 
@@ -123,7 +124,7 @@
                   observes="broadcaster-notification-disabled"
                   preference-editable="true"
                   preference="pref_string_mail_accounts"
-                  onsynctopreference="return firetray.UIOptions.saveTreeAccountsOrServerTypes();">
+                  onsynctopreference="return firetrayUIOptions.saveTreeAccountsOrServerTypes();">
               <treecols>
                 <treecol id="account_or_server_type_name" editable="false" flex="2"
                          persist="width" primary="true" label="&account_or_server_type_name;"
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index f96fddd..c3709d5 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -12,10 +12,10 @@
 
 <!ENTITY bool_hides_on_close.label "Closing window hides to tray">
 <!ENTITY bool_hides_on_close.accesskey "C">
-<!ENTITY bool_hides_on_minimize.label "Minimize window hides to tray">
-<!ENTITY bool_hides_on_minimize.accesskey "M">
 <!ENTITY bool_hides_single_window.label "Hide the current window only (not all windows)">
 <!ENTITY bool_hides_single_window.accesskey "H">
+<!ENTITY bool_hides_on_minimize.label "Minimize window hides to tray">
+<!ENTITY bool_hides_on_minimize.accesskey "M">
 
 <!ENTITY mail_notification.label "Mail notification">
 <!ENTITY mail_notification_disabled.label "disabled">
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index f165ad3..a1db399 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -8,7 +8,7 @@ pref("browser.tabs.warnOnClose", false);
 
 pref("extensions.firetray.hides_on_close", true);
 pref("extensions.firetray.hides_on_minimize", true);
-pref("extensions.firetray.hides_single_window", true); // FIXME: should default to 'false'
+pref("extensions.firetray.hides_single_window", false);
 
 pref("extensions.firetray.mail_notification", 1);
 pref("extensions.firetray.icon_text_color", "#000000");

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