[HTTPS-Everywhere] [PATCH 1/2] change rule set selection to listbox

Stefan Tomanek stefan.tomanek+httpse at wertarbyte.de
Sun Mar 13 10:46:39 PDT 2011


Adding more and more sites to the plugin makes the grid of checkboxes
hard to use; this patch changes it to a listbox, making it possible to
search specific rulesets by typing the name while also handling a large
amount of sites gracefully even on a small screen.

Signed-off-by: Stefan Tomanek <stefan.tomanek+httpse at wertarbyte.de>
---
 src/chrome/content/preferences.js  |   15 +++------------
 src/chrome/content/preferences.xul |    8 +-------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 198b645..85edf74 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -34,27 +34,18 @@ function https_prefs_init(doc) {
   for (var i = 0; i < rulesets.length; i++) {
     var ruleset = rulesets[i];
 
-    if (i % row_width == 0) {
-      hbox = doc.createElement("row");
-    }
-
-    var newopt = doc.createElement("checkbox");
+    var newopt = doc.createElement("listitem");
 
     // This pref should always have been created by the RuleSet constructor
     var enabled = o_httpsprefs.getBoolPref(ruleset.name);
     newopt.setAttribute("id", id_prefix + ruleset.name);
     newopt.setAttribute("label",ruleset.name);
     newopt.setAttribute("preference",null);
+    newopt.setAttribute("type", "checkbox");
     newopt.setAttribute("checked", enabled);
     newopt.setAttribute("oncommand",
                         "https_settings_changed(document)");
-    hbox.appendChild(newopt);
-    if (i % row_width == 0) {
-      rs.appendChild(hbox);
-    }
-
-    prefs_window.height = (screen.height*0.7).toString();
-    prefs_window.width = screen.width.toString();
+    rs.appendChild(newopt);
   }
   // Do this here rather than in the .xul so that it goes after all these
   // postpendments
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index f49e6e1..a12f393 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -24,13 +24,7 @@
         <caption label="Which HTTPS redirection rules should apply?" 
                align="center"/>
         <hbox flex="1" style="overflow:auto">
-          <grid class="indent" align="center">
-            <columns>
-             <column/> <column/> <column/> <column/> <column/>
-            </columns>
-            <rows id="https_everywhere_RuleSetList"/>
-          </grid>
-          <seperator orient="vertical" width="40" flex="1"/>
+          <listbox id="https_everywhere_RuleSetList" flex="1"/>
         </hbox>
         <vbox>
             You can learn how to write your own rulesets (to add support for other web sites)
-- 
1.7.2.3



More information about the HTTPS-everywhere mailing list