commit 20d6479ab2e32b868d336b81f0a1a25799272ac2 Author: Mike Perry mikeperry-git@fscked.org Date: Tue Jun 28 18:44:29 2011 -0700
Make it harder to accidentally toggle torbutton.
Also make clicking provide a menu rather than auto-toggle. --- src/chrome/content/popup.xul | 4 ++-- src/chrome/content/torbutton.js | 13 ++++--------- src/chrome/content/torbutton.xul | 11 ++++++----- 3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/chrome/content/popup.xul b/src/chrome/content/popup.xul index f96b821..bd6fc35 100644 --- a/src/chrome/content/popup.xul +++ b/src/chrome/content/popup.xul @@ -9,12 +9,12 @@ <stringbundleset id="torbutton-stringbundleset"> <stringbundle id="torbutton-bundle" src="chrome://torbutton/locale/torbutton.properties"/> </stringbundleset> - <menupopup id="torbutton-context-menu" onpopupshowing="torbutton_check_protections();"> + <menupopup id="torbutton-context-menu" onpopupshowing="torbutton_check_protections();" + anchor="torbutton-button" position="after_start"> <menuitem id="torbutton-toggle" label="&torbutton.context_menu.toggle;" accesskey="&torbutton.context_menu.toggle.key;" insertafter="context-stop" - key="torbutton-toggle-key" oncommand="torbutton_toggle(true)"/> <menuitem id="torbutton-preferences" label="&torbutton.context_menu.preferences;" diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index 2a5d8ca..2d90676 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -1726,15 +1726,10 @@ function torbutton_close_on_toggle(mode) {
function torbutton_check_protections() { - var pref = m_tb_prefs.getBoolPref("extensions.torbutton.cookie_protections"); - // XXX: This should always be visible if the user enabled it. It does seem to have - // other bugs though. - /* && ((!m_tb_prefs.getBoolPref("extensions.torbutton.tor_memory_jar") - && m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")) - || (!m_tb_prefs.getBoolPref("extensions.torbutton.nontor_memory_jar") - && !m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled"))); - */ - document.getElementById("torbutton-cookie-protector").disabled = !pref; + var cookie_pref = m_tb_prefs.getBoolPref("extensions.torbutton.cookie_protections"); + var locked_pref = m_tb_prefs.getBoolPref("extensions.torbutton.locked_mode") + document.getElementById("torbutton-cookie-protector").disabled = !cookie_pref; + document.getElementById("torbutton-toggle").collapsed = locked_pref; }
function torbutton_open_cookie_dialog() { diff --git a/src/chrome/content/torbutton.xul b/src/chrome/content/torbutton.xul index f600f89..8e9cde6 100644 --- a/src/chrome/content/torbutton.xul +++ b/src/chrome/content/torbutton.xul @@ -29,9 +29,10 @@ class="toolbarbutton-1 chromeclass-toolbar-additional" label="Torbutton" tooltiptext="&torbutton.button.tooltip;" - context="torbutton-context-menu" - oncommand="torbutton_toggle(false);" /> + menu="torbutton-context-menu" + context="torbutton-context-menu"/> </toolbarpalette> + <!-- <commandset id="mainCommandSet"> <command id="torbutton-toggle-cmd" oncommand="torbutton_toggle(false);"/> </commandset> @@ -40,12 +41,12 @@ <key id="torbutton-toggle-key" modifiers="control" key="2" command="torbutton-toggle-cmd"/> </keyset> - + --> <statusbar id="status-bar"> <statusbarpanel id="torbutton-panel" insertbefore="statusbar-updates" - context="torbutton-context-menu" - onclick="if (event.button == 0) torbutton_toggle(false)"/> + menu="torbutton-context-menu" + context="torbutton-context-menu" /> <!-- <statusbarpanel context="clipmenu" class="statusbarpanel-iconic" id="plugins-status" tooltip="plugin-tooltip" onclick="torbutton_toggle_plugins();"/> --> </statusbar> <popup id="contentAreaContextMenu">
tor-commits@lists.torproject.org