[Project_owners] Hide statusbar icon

Michael Vincent van Rantwijk, MultiZilla mv_van_rantwijk at yahoo.com
Sun Sep 16 15:07:33 PDT 2007


Christian Arnold wrote:
> Michael Vincent van Rantwijk, MultiZilla schrieb:
>> Philip Chee wrote:
>>> On Sat, 15 Sep 2007 22:18:39 +0200, Michael Vincent van Rantwijk,
>>> MultiZilla wrote:
>>>
>>>>> i want to let user choose if he/she needs status bar icon or not, 
>>>>> is there
>>>>> any special method to do that or not ?
>>>> You can use: "browser.toolbars.showbutton.mybuttonid" for which 
>>>> SeaMonkey has a pref observer setup, which works for me (when I use 
>>>> a button ID like: mybuttonid-tbbutton).
>>> First this is suite specific. I don't think Firefox/Flock/IceWeasel/NN 9
>>> have this.
>>
>> Right, but we use our own pref listener for years already.
>>
>>> Secondly it's "mybuttonid-button" without the "tb" whatever that is.
>>
>> For the build-in observer, yes, but we use this and it is short for 
>> ToolBar.
>>
>>> Thirdly how many suite extensions are using this feature? The reason I
>>> ask is that I was thinking of removing this feature as part of my
>>> customizable toolbars patch for the suite (since with customizable
>>> toolbar buttons this functionality is mostly redundant). But if there
>>> are more than a few extensions using this I'll leave the
>>> gButtonPrefListener functionality in.
>>
>> When will that patch be ready?
>>
>> p.s. remember me writing to be ready in time ;)
>>
> 
> I use this code to show/hide my statusbaricon in my extension by the 
> optionwindow. It works with FF, but should work with others after 
> changing the type:
> 
> function statusbarIcon(iconVisible) {
>     var wm = 
> Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); 
> 
>     var type = 'navigator:browser'
>     var enumerator = wm.getEnumerator(type);
>     while(enumerator.hasMoreElements()) {
>         var win = enumerator.getNext();
>         var panel = 
> win.document.getElementById("your-extension-statusbarpanel");
>         panel.hidden = iconVisible;
>     }
> }
> 
> The XUL-Part:
> <checkbox id="prefstatusbarvisible" preference="statusbarvisible" 
> label="&prefstatusbarvisible.label;" onclick="return 
> statusbarIcon(this.checked);"/>
> 
> This will show/hide the statusbar icon in every running Firefox window.
> 
> Hope this helps and works with SeaMonkey and others

Don't use code like this, but use the observer service to notify all 
open windows.

p.s. Assuming the every window with "navigator: browser" is a 
browser/navigator window is wrong.

-- 
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member (ActiveState Training Partner)
- iPhone Application Developer



More information about the Project_owners mailing list