Skip to content

Commit

Permalink
Bug 17904: Allow P&S Settings dialog to resize
Browse files Browse the repository at this point in the history
If the dialog is too small to show all descriptions, then the
descriptions text area will show a scrollbar.
  • Loading branch information
arthuredelstein committed Sep 20, 2016
1 parent 1db6465 commit d7f77b2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
4 changes: 0 additions & 4 deletions src/chrome/content/preferences.js
Expand Up @@ -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.');

Expand Down Expand Up @@ -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() {
Expand Down
98 changes: 51 additions & 47 deletions src/chrome/content/preferences.xul
Expand Up @@ -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;"/>
<checkbox id="torbutton_blockDisk"
Expand All @@ -30,48 +32,58 @@
<checkbox id="torbutton_resistFingerprinting"
label="&torbutton.prefs.resist_fingerprinting;"/>
</groupbox>
<spacer flex="1"/>
<groupbox>
<groupbox align="stretch" flex="1"> <!-- security settings container -->
<caption label="&torbutton.prefs.sec_caption;"/>
<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>
<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">
Expand Down Expand Up @@ -168,19 +180,11 @@
&torbutton.prefs.sec_low_desc;
</description>
<description class="slider-text-size">
&torbutton.prefs.sec_low_usable_desc;
&torbutton.prefs.sec_low_usable_desc;
</description>
</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>

Expand Down

0 comments on commit d7f77b2

Please sign in to comment.