Re: Add-on bar or navigation toolbar icon showing same status across windows

Neil <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
STF wrote:

> To simplify the concept, let's say I have two PNG images, on.png and 
> off.png and I need to show one of them according to a certain value.  
> I have gone through XUL tutorial 
> (https://developer.mozilla.org/en-US/docs/XUL/School_tutorial) but I 
> still have problem finding tutorials for my app.
>
>     In particular, here are my problems:
> * How am I supposed to change the image file (from on.png to off.png)?
>
> * I have found another app which uses the trick of changing class for 
> the above problem, but this leads to another problem: when there are 
> more than one window, only the current window's icon image is changed.

It's a bit difficult to generalise. If this is a global value that you 
maintain yourself, then you could enumerate all the windows so that they 
are all updated. If this is some other value, e.g. a preference, then 
you could use a global preference observer, or each window could observe 
the preference individually.

As for updating the icon, changing an attribute is usually easier than 
changing the class, in case you need to use multiple classes.

-- 
Warning: May contain traces of nuts.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.