[tor-commits] [torbutton/master] Bug #10751.2: Adapt Torbutton to Australis UI.

mikeperry at torproject.org mikeperry at torproject.org
Tue Sep 30 00:23:25 UTC 2014


commit 4024c6ff958724d226a5a30b68316b25fb876616
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Mon Aug 25 16:46:54 2014 -0700

    Bug #10751.2: Adapt Torbutton to Australis UI.
    
    Use CustomizableUI, if it is available, to add TorButton's
    button to navigation toolbar.
---
 src/chrome/content/torbutton.js |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 153cc3c..4ca6614 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -541,14 +541,21 @@ function torbutton_init() {
     if (!m_tb_prefs.getBoolPref("extensions.torbutton.inserted_button")) {
       torbutton_log(3, 'Adding button');
       try {
-        var toolbutton = torbutton_get_button_from_toolbox();
-        var navbar = document.getElementById("nav-bar");
-        // XXX: Will probably fail on fennec. Also explicitly forbidden
-        // by MDC style guides (for good reason). Fix later..
-        var urlbar = document.getElementById("urlbar-container");
-        navbar.insertBefore(toolbutton, urlbar);
-        navbar.setAttribute("currentset", navbar.currentSet);
-        document.persist("nav-bar", "currentset");
+        if (CustomizableUI) {
+          // ESR31-style toolbar
+          CustomizableUI.addWidgetToArea("torbutton-button", CustomizableUI.AREA_NAVBAR, 0);
+        } else {
+          // ESR24-style toolbar
+          // TODO: Remove this branch once TBB-ESR24 has been retired.
+          var toolbutton = torbutton_get_button_from_toolbox();
+          var navbar = document.getElementById("nav-bar");
+          // XXX: Will probably fail on fennec. Also explicitly forbidden
+          // by MDC style guides (for good reason). Fix later..
+          var urlbar = document.getElementById("urlbar-container");
+          navbar.insertBefore(toolbutton, urlbar);
+          navbar.setAttribute("currentset", navbar.currentSet);
+          document.persist("nav-bar", "currentset");
+        }
         torbutton_log(3, 'Button added');
         m_tb_prefs.setBoolPref("extensions.torbutton.inserted_button", true);
       } catch(e) {





More information about the tor-commits mailing list