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

[or-cvs] r10266: [darcs-to-svn @ set the toolbarbutton to the correct state u (torbutton/trunk/src/chrome/content)



Author: squires
Date: 2007-05-22 01:25:21 -0400 (Tue, 22 May 2007)
New Revision: 10266

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
Log:
[darcs-to-svn @ set the toolbarbutton to the correct state upon insertion into the toolbar]

Original author: squires@xxxxxxxxx
Date: 2006-10-21 19:34:51+00:00

Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2007-05-22 05:25:17 UTC (rev 10265)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2007-05-22 05:25:21 UTC (rev 10266)
@@ -151,6 +151,12 @@
     }
 }
 
+function torbutton_init_toolbutton(event)
+{
+    if (event.originalTarget && event.originalTarget.getAttribute('id') == 'torbutton-button')
+       torbutton_update_toolbutton(torbutton_check_status());
+}
+
 function torbutton_init() {
     torbutton_log(1, 'called init()');
     
@@ -160,6 +166,10 @@
     // set panel style from preferences
     torbutton_set_panel_style();
 
+    // listen for our toolbar button being added so we can initialize it
+    document.getElementById('navigator-toolbox')
+            .addEventListener('DOMNodeInserted', torbutton_init_toolbutton, false);
+
     if (!m_wasinited) {
         torbutton_log(5, 'registering pref observer');
         torbutton_pref_observer.register();