[or-cvs] r10265: [darcs-to-svn @ refactor torbutton_update_status()] Original (torbutton/trunk/src/chrome/content)
squires at seul.org
squires at seul.org
Tue May 22 05:25:18 UTC 2007
Author: squires
Date: 2007-05-22 01:25:17 -0400 (Tue, 22 May 2007)
New Revision: 10265
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
Log:
[darcs-to-svn @ refactor torbutton_update_status()]
Original author: squires at pobox.com
Date: 2006-10-21 19:33:05+00:00
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2007-05-22 05:25:12 UTC (rev 10264)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2007-05-22 05:25:17 UTC (rev 10265)
@@ -106,10 +106,10 @@
function torbutton_set_status() {
if (torbutton_check_status()) {
torbutton_log(1,'status: tor is enabled');
- torbutton_update_status(1);
+ torbutton_update_status(true);
} else {
torbutton_log(1,'status: tor is disabled');
- torbutton_update_status(0);
+ torbutton_update_status(false);
}
}
@@ -355,7 +355,48 @@
nonprefs.setIntPref("type", 1);
}
-function torbutton_update_status(nMode) {
+function torbutton_update_toolbutton(mode)
+{
+ o_toolbutton = torbutton_get_toolbutton();
+ if (!o_toolbutton) return;
+ o_stringbundle = torbutton_get_stringbundle();
+
+ if (mode)
+ {
+ tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.enabled");
+ o_toolbutton.setAttribute('tbstatus', 'on');
+ o_toolbutton.setAttribute('tooltiptext', tooltip);
+ } else {
+ tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.disabled");
+ o_toolbutton.setAttribute('tbstatus', 'off');
+ o_toolbutton.setAttribute('tooltiptext', tooltip);
+ }
+}
+
+function torbutton_update_statusbar(mode)
+{
+ o_statuspanel = torbutton_get_statuspanel();
+ if (!window.statusbar.visible) return;
+ o_stringbundle = torbutton_get_stringbundle();
+
+ if (mode) {
+ label = o_stringbundle.GetStringFromName("torbutton.panel.label.enabled");
+ tooltip = o_stringbundle.GetStringFromName("torbutton.panel.tooltip.enabled");
+ o_statuspanel.style.color = "#390";
+ o_statuspanel.setAttribute('label', label);
+ o_statuspanel.setAttribute('tooltiptext', tooltip);
+ o_statuspanel.setAttribute('tbstatus', 'on');
+ } else {
+ label = o_stringbundle.GetStringFromName("torbutton.panel.label.disabled");
+ tooltip = o_stringbundle.GetStringFromName("torbutton.panel.tooltip.disabled");
+ o_statuspanel.style.color = "#F00";
+ o_statuspanel.setAttribute('label', label);
+ o_statuspanel.setAttribute('tooltiptext', tooltip);
+ o_statuspanel.setAttribute('tbstatus', 'off');
+ }
+}
+
+function torbutton_update_status(mode) {
var o_toolbutton = false;
var o_statuspanel = false;
var o_stringbundle = false;
@@ -363,42 +404,9 @@
var label;
var tooltip;
- o_toolbutton = torbutton_get_toolbutton();
- o_statuspanel = torbutton_get_statuspanel();
- o_stringbundle = torbutton_get_stringbundle();
-
- torbutton_log(2, 'called update_status('+nMode+')');
- if (nMode == 0) {
- if (o_toolbutton) {
- tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.disabled");
- o_toolbutton.setAttribute('tbstatus', 'off');
- o_toolbutton.setAttribute('tooltiptext', tooltip);
- }
-
- if (window.statusbar.visible) {
- label = o_stringbundle.GetStringFromName("torbutton.panel.label.disabled");
- tooltip = o_stringbundle.GetStringFromName("torbutton.panel.tooltip.disabled");
- o_statuspanel.style.color = "#F00";
- o_statuspanel.setAttribute('label', label);
- o_statuspanel.setAttribute('tooltiptext', tooltip);
- o_statuspanel.setAttribute('tbstatus', 'off');
- }
- } else {
- if (o_toolbutton) {
- tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.enabled");
- o_toolbutton.setAttribute('tbstatus', 'on');
- o_toolbutton.setAttribute('tooltiptext', tooltip);
- }
-
- if (window.statusbar.visible) {
- label = o_stringbundle.GetStringFromName("torbutton.panel.label.enabled");
- tooltip = o_stringbundle.GetStringFromName("torbutton.panel.tooltip.enabled");
- o_statuspanel.style.color = "#390";
- o_statuspanel.setAttribute('label', label);
- o_statuspanel.setAttribute('tooltiptext', tooltip);
- o_statuspanel.setAttribute('tbstatus', 'on');
- }
- }
+ torbutton_log(2, 'called update_status('+mode+')');
+ torbutton_update_toolbutton(mode);
+ torbutton_update_statusbar(mode);
}
function torbutton_open_prefs_dialog() {
More information about the tor-commits
mailing list