[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [torbutton/master 21/31] Trim down prefs for startup.



Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Wed, 29 Dec 2010 02:36:48 -0600
Subject: Trim down prefs for startup.
Commit: 0c214d6cc0f43a20eb16683989848c906109a4da

They were too complicated and confusing. Lets just make it simple.
---
 src/chrome/content/preferences.js  |    6 ++++--
 src/chrome/content/preferences.xul |    5 +++--
 src/chrome/content/torbutton.js    |   11 ++++-------
 src/chrome/locale/en/torbutton.dtd |    1 +
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 379a04b..c18d40a 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -265,6 +265,7 @@ function torbutton_prefs_init(doc) {
             doc.getElementById('torbutton_restoreNonTor');
     }
 
+    /*
     switch(o_torprefs.getIntPref('startup_state')) {
         case 0: // non-tor
             doc.getElementById("torbutton_startupStateGroup").selectedItem =
@@ -278,7 +279,7 @@ function torbutton_prefs_init(doc) {
             doc.getElementById("torbutton_startupStateGroup").selectedItem =
                 doc.getElementById('torbutton_startPrevious');
             break;
-    }
+    }*/
     
     if ((doc.getElementById('torbutton_refererSpoofGroup').selectedIndex = o_torprefs.getIntPref('refererspoof'))==4)
       doc.getElementById('torbutton_CustomRef').value = o_torprefs.getCharPref('customref');
@@ -516,6 +517,7 @@ function torbutton_prefs_save(doc) {
             doc.getElementById('torbutton_restoreTorGroup').selectedItem ==
             doc.getElementById('torbutton_restoreTor'));
 
+    /*
     if(doc.getElementById('torbutton_startupStateGroup').selectedItem ==
             doc.getElementById('torbutton_startNonTor')) {
         o_torprefs.setIntPref('startup_state', 0);
@@ -524,7 +526,7 @@ function torbutton_prefs_save(doc) {
         o_torprefs.setIntPref('startup_state', 1);
     } else {
         o_torprefs.setIntPref('startup_state', 2);
-    }
+    }*/
 
     o_torprefs.setBoolPref('notor_sessionstore', !doc.getElementById('torbutton_torSessionStore').checked);
     o_torprefs.setBoolPref('nonontor_sessionstore', !doc.getElementById('torbutton_nonTorSessionStore').checked);
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index c5b62f4..b4eb3d0 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -282,6 +282,7 @@
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
              -->
             <vbox>
+            <!--
             <hbox>
              <label value="&torbutton.prefs.startup_state;" control="torbutton_startupStateGroup"/>
              <radiogroup align="center" orient="horizontal" id="torbutton_startupStateGroup">
@@ -296,9 +297,9 @@
                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
              </radiogroup>
             </hbox>
-
+            -->
             <hbox>
-             <label value="&torbutton.prefs.restore_tor;" control="torbutton_restoreTorGroup"/>
+             <label value="&torbutton.prefs.startup_tor;" control="torbutton_restoreTorGroup"/>
              <radiogroup align="center" orient="horizontal" id="torbutton_restoreTorGroup">
               <radio id="torbutton_restoreTor" 
                    label="&torbutton.prefs.tor;" 
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 022d62d..db9fb45 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -441,6 +441,7 @@ function torbutton_set_status() {
 
 function torbutton_init_toolbutton(event)
 {
+    // XXX: This fails on FF4
     if (event.originalTarget && event.originalTarget.getAttribute('id') == 'torbutton-button')
        torbutton_update_toolbutton(torbutton_check_status());
 }
@@ -3308,15 +3309,11 @@ function torbutton_do_main_window_startup()
 
 function torbutton_set_initial_state() {
     if(m_tb_prefs.getBoolPref("extensions.torbutton.noncrashed")) {
-        var startup_state = m_tb_prefs.getIntPref("extensions.torbutton.startup_state");
+        var restore_tor = m_tb_prefs.getIntPref("extensions.torbutton.restore_tor");
         
-        torbutton_log(3, "Setting initial state to: "+startup_state);
+        torbutton_log(3, "Setting initial state to: "+restore_tor);
 
-        if(startup_state == 0) {
-            torbutton_conditional_set(false); // must be boolean
-        } else if(startup_state == 1) {
-            torbutton_conditional_set(true);
-        } // 2 means leave it as it was
+        torbutton_conditional_set(restore_tor);
 
         m_tb_prefs.setBoolPref("extensions.torbutton.noncrashed", false);
 
diff --git a/src/chrome/locale/en/torbutton.dtd b/src/chrome/locale/en/torbutton.dtd
index 7e1fb3b..998eb76 100644
--- a/src/chrome/locale/en/torbutton.dtd
+++ b/src/chrome/locale/en/torbutton.dtd
@@ -76,6 +76,7 @@
 <!ENTITY torbutton.prefs.tor "Tor">
 <!ENTITY torbutton.prefs.non_tor "Non-Tor">
 <!ENTITY torbutton.prefs.restore_tor "On session restored startup, set Tor state to:">
+<!ENTITY torbutton.prefs.startup_tor "On browser startup, set Tor state to:">
 <!ENTITY torbutton.prefs.reload_crashed_jar "Reload cookie jar/clear cookies on Firefox crash (recommended)">
 <!ENTITY torbutton.prefs.dual_cookie_jars "Store both Tor and Non-Tor cookies in protected jars (dangerous)">
 <!ENTITY torbutton.prefs.clear_http_auth "Clear HTTP auth sessions (recommended)">
-- 
1.7.1