mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Adds text/image/both modes for the main toolbar. Bug 22056, patch by
neil@parkwaycc.co.uk, r=timeless, sr=bzbarsky, moa=blake,hyatt
This commit is contained in:
parent
731c433e7e
commit
7a7ddf7aa7
@ -165,6 +165,58 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar">
|
||||
<implementation implements="nsIObserver">
|
||||
<field name="domain" readonly="true">
|
||||
"browser.chrome.toolbar_style"
|
||||
</field>
|
||||
|
||||
<field name="prefs" readonly="true">
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranchInternal)
|
||||
.QueryInterface(Components.interfaces.nsIPrefBranch)
|
||||
</field>
|
||||
|
||||
<method name="observe">
|
||||
<parameter name="subject"/>
|
||||
<parameter name="topic"/>
|
||||
<parameter name="name"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (topic == "nsPref:changed" && name == this.domain) {
|
||||
const styles = ["pictures", "text", "both"];
|
||||
const style = styles[this.prefs.getIntPref(name)];
|
||||
this.setAttribute("buttonstyle", style);
|
||||
this.update("toolbarbutton", style);
|
||||
this.update("button", style);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="update">
|
||||
<parameter name="tag"/>
|
||||
<parameter name="style"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var elements = this.getElementsByTagName(tag);
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
elements[i].setAttribute("buttonstyle", style);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
this.prefs.addObserver(this.domain, this, false);
|
||||
this.observe(this.prefs, "nsPref:changed", this.domain);
|
||||
</constructor>
|
||||
|
||||
<destructor>
|
||||
this.prefs.removeObserver(this.domain, this);
|
||||
</destructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="menubar" extends="xul:menubar">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/toolbar.css"/>
|
||||
|
Loading…
Reference in New Issue
Block a user