[or-cvs] [https-everywhere/master 6/9] Add a disable all button.

mikeperry at torproject.org mikeperry at torproject.org
Thu Nov 11 19:09:52 UTC 2010


Author: Mike Perry <mikeperry-git fscked org>
Date: Thu, 11 Nov 2010 10:13:51 -0800
Subject: Add a disable all button.
Commit: e2001c6f9c6dfbc8730786e7eb10f70dbec332d0

Also rename the DTD elements to better reflect the buttons.
---
 src/chrome/content/preferences.js         |    8 ++++----
 src/chrome/content/preferences.xul        |    8 +++++---
 src/chrome/locale/en/https-everywhere.dtd |    3 ++-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index b9d2725..8ace9bd 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -80,15 +80,15 @@ function https_prefs_save(doc) {
   }
 }
 
-function https_enable_all(doc) {
-  // "restore defaults" / enable all rules
+function https_set_all(doc,val) {
+  // set all rules to val (enable/disable)
   var o_httpsprefs = https_everywhere.get_prefs();
   var rulesets = https_everywhere.https_rules.rules;
   var rs = doc.getElementById('https_everywhere_RuleSetList');
   for (var i = 0; i < rulesets.length; i++) {
     var ruleset = rulesets[i];
-    ruleset.active = true;
+    ruleset.active = val;
     var elem = doc.getElementById(id_prefix + ruleset.name);
-    elem.checked = true;
+    elem.checked = val;
   }
 }
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index 0615d35..5cfe9db 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -6,10 +6,12 @@
 <dialog id="https-everywhere-prefs"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
-        buttons="accept,cancel,extra1"
+        buttons="accept,cancel,extra1,extra2"
         title="&https-everywhere.prefs.title;"
-        buttonlabelextra1="&https-everywhere.prefs.restore_defaults;"
-        ondialogextra1="https_enable_all(document);"
+        buttonlabelextra1="&https-everywhere.prefs.enable_all;"
+        buttonlabelextra2="&https-everywhere.prefs.disable_all;"
+        ondialogextra1="https_set_all(document,true);"
+        ondialogextra2="https_set_all(document,false);"
         persist="screenX screenY"
         onload="https_prefs_init(document)"
         ondialogaccept="https_prefs_save(document)" 
diff --git a/src/chrome/locale/en/https-everywhere.dtd b/src/chrome/locale/en/https-everywhere.dtd
index d3edeea..06b6835 100644
--- a/src/chrome/locale/en/https-everywhere.dtd
+++ b/src/chrome/locale/en/https-everywhere.dtd
@@ -1,2 +1,3 @@
 <!ENTITY https-everywhere.prefs.title "HTTPS Everywhere Preferences">
-<!ENTITY https-everywhere.prefs.restore_defaults "Enable All">
+<!ENTITY https-everywhere.prefs.enable_all "Enable All">
+<!ENTITY https-everywhere.prefs.disable_all "Disable All">
-- 
1.7.1




More information about the tor-commits mailing list