[tbb-commits] [torbutton/master] Bug 17904: Allow P&S Settings dialog to resize

gk at torproject.org gk at torproject.org
Mon Sep 26 11:53:32 UTC 2016


commit b1adcba17a96a925345001d4da69cb71b469e3ed
Author: arthuredelstein at gmail.com <arthuredelstein at gmail.com>
Date:   Thu Sep 15 16:23:58 2016 -0700

    Bug 17904: Allow P&S Settings dialog to resize
    
    If the dialog is too small to show all descriptions, then the
    descriptions text area will show a scrollbar.
---
 src/chrome/content/preferences.js  |  4 --
 src/chrome/content/preferences.xul | 99 ++++++++++++++++++++------------------
 2 files changed, 51 insertions(+), 52 deletions(-)

diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index fb5aafd..ee81568 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -9,7 +9,6 @@ const Cc = Components.classes, Ci = Components.interfaces;
 
 function torbutton_prefs_init(doc) {
     torbutton_log(2, "called prefs_init()");
-    sizeToContent();
 
     var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
 
@@ -184,9 +183,6 @@ function torbutton_set_slider_text(doc, custom) {
       doc.getElementById("desc_high").collapsed = true;
       break;
   }
-  // It can happen that the descriptions of the slider settings consume more
-  // space than originally allocated. Adapt the dialog size accordingly.
-  sizeToContent();
 }
 
 function torbutton_prefs_check_disk() {
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index baa6093..8474871 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -11,13 +11,15 @@
         buttons="accept,cancel,extra1"
         buttonlabelextra1="&torbutton.prefs.restore_defaults;"
         ondialogextra1="torbutton_prefs_reset_defaults();"
-        persist="screenX screenY"
+        persist="screenX screenY width height"
         onload="torbutton_prefs_init(document)"
+        align="stretch"
+        pack="center"
         ondialogaccept="torbutton_prefs_save(document)" >
 
     <script type="application/x-javascript" src="torbutton_util.js"/>
     <script type="application/x-javascript" src="preferences.js"/>
-      <vbox>
+    <vbox flex="1" align="stretch">
         <groupbox>
           <caption label="&torbutton.prefs.priv_caption;"
                    tooltiptext="&torbutton.prefs.priv_caption_tooltip;"/>
@@ -35,49 +37,58 @@
                     label="&torbutton.prefs.resist_fingerprinting;"
                     tooltiptext="&torbutton.prefs.resist_fingerprinting_tooltip;"/>
         </groupbox>
-        <spacer flex="1"/>
-        <groupbox>
-          <caption label="&torbutton.prefs.sec_caption;"
-                   tooltiptext="&torbutton.prefs.sec_caption_tooltip;"/>
-          <hbox>
-            <vbox height="200">
-              <scale id="torbutton_sec_slider" flex="1" min="1" max="4"
-                     movetoclick="true" orient="vertical"/>
-            </vbox>
-            <vbox height="200">
-              <hbox flex="1" align="start">
-                <description id="torbutton_sec_high"
-                             tooltip="high_preview"
-                             onclick="torbutton_toggle_slider(document, 1);">
-                  &torbutton.prefs.sec_high;
-                </description>
+        <groupbox align="stretch" flex="1"> <!-- security settings container -->
+          <caption label="&torbutton.prefs.sec_caption;"/>
+          <hbox flex="1" align="stretch">
+            <vbox>
+              <hbox height="200">
+                <vbox>
+                  <scale id="torbutton_sec_slider" flex="1" min="1" max="4"
+                         movetoclick="true" orient="vertical"/>
+                </vbox>
+                <vbox>
+                  <hbox flex="1" align="start">
+                    <description id="torbutton_sec_high"
+                                 tooltip="high_preview"
+                                 onclick="torbutton_toggle_slider(document, 1);">
+                      &torbutton.prefs.sec_high;
+                    </description>
+                  </hbox>
+                  <hbox flex="1" align="center">
+                    <description id="torbutton_sec_med_high"
+                                 tooltip="mh_preview"
+                                 onclick="torbutton_toggle_slider(document, 2);">
+                      &torbutton.prefs.sec_med_high;
+                    </description>
+                  </hbox>
+                  <hbox flex="1" align="center">
+                    <description id="torbutton_sec_med_low"
+                                 tooltip="ml_preview"
+                                 onclick="torbutton_toggle_slider(document, 3);">
+                      &torbutton.prefs.sec_med_low;
+                    </description>
+                  </hbox>
+                  <hbox flex="1" align="end">
+                    <description id="torbutton_sec_low"
+                                 tooltip="low_preview"
+                                 onclick="torbutton_toggle_slider(document, 4);">
+                      &torbutton.prefs.sec_low;
+                    </description>
+                  </hbox>
+                </vbox>
               </hbox>
-              <hbox flex="1" align="center">
-                <description id="torbutton_sec_med_high"
-                             tooltip="mh_preview"
-                             onclick="torbutton_toggle_slider(document, 2);">
-                  &torbutton.prefs.sec_med_high;
-                </description>
-              </hbox>
-              <hbox flex="1" align="center">
-                <description id="torbutton_sec_med_low"
-                             tooltip="ml_preview"
-                             onclick="torbutton_toggle_slider(document, 3);">
-                  &torbutton.prefs.sec_med_low;
-                </description>
-              </hbox>
-              <hbox flex="1" align="end">
-                <description id="torbutton_sec_low"
-                             tooltip="low_preview"
-                             onclick="torbutton_toggle_slider(document, 4);">
-                  &torbutton.prefs.sec_low;
-                </description>
+              <hbox>
+                <!-- We are using |oncommand| instead of |onclick| as the former does
+                     not fire if the checkbox is disabled and it does fire after the
+                     checkbox adapted its state. -->
+                <checkbox id="torbutton_sec_custom" flex="1"
+                          oncommand="torbutton_set_slider_text(document, event.target.checked);"
+                          label="&torbutton.prefs.sec_custom;"/>
               </hbox>
             </vbox>
-            <spacer flex="1"/>
             <!-- A width of 400 is already too much for OS X it seems. The above
                  spacer tag would basically be useless and the layout ugly. -->
-            <vbox flex="1" width="300">
+            <vbox flex="1" width="300" style="overflow: auto;">
               <vbox id="desc_high" collapsed="true">
                 <description
                   class="slider-text-size, slider-text-weight">
@@ -179,14 +190,6 @@
               </vbox>
             </vbox>
           </hbox>
-          <hbox>
-            <!-- We are using |oncommand| instead of |onclick| as the former does
-               not fire if the checkbox is disabled and it does fire after the
-               checkbox adapted its state. -->
-            <checkbox id="torbutton_sec_custom" flex="1"
-               oncommand="torbutton_set_slider_text(document, event.target.checked);"
-               label="&torbutton.prefs.sec_custom;"/>
-          </hbox>
         </groupbox>
       </vbox>
 



More information about the tbb-commits mailing list