Bug 653637 - Provide a simple way for addons to have preferences UI - Part 1; r=mark.finkle,dtownsend

--HG--
rename : mobile/chrome/content/bindings/setting.xml => toolkit/mozapps/extensions/content/setting.xml
This commit is contained in:
Geoff Lankow 2011-06-03 11:33:55 +12:00
Родитель 7c28d5abf6
Коммит db9550f627
8 изменённых файлов: 109 добавлений и 87 удалений

Просмотреть файл

@ -23,31 +23,31 @@ documenttab {
}
settings {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#settings");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#settings");
}
setting[type="bool"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-bool");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-bool");
}
setting[type="bool"][localized="true"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-localized-bool");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-localized-bool");
}
setting[type="boolint"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-boolint");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-boolint");
}
setting[type="integer"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-integer");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-integer");
}
setting[type="control"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-control");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-control");
}
setting[type="string"] {
-moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-string");
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-string");
}
#browsers > notificationbox {

Просмотреть файл

@ -256,13 +256,13 @@ var ViewConfig = {
row.setAttribute("default", aPref.default);
let label = document.createElement("label");
label.setAttribute("class", "preftitle");
label.setAttribute("class", "preferences-title");
label.setAttribute("value", aPref.name);
label.setAttribute("crop", "end");
row.appendChild(label);
label = document.createElement("label");
label.setAttribute("class", "prefvalue");
label.setAttribute("class", "preferences-value");
label.setAttribute("value", aPref.value);
label.setAttribute("crop", "end");
row.appendChild(label);

Просмотреть файл

@ -48,7 +48,6 @@ chrome.jar:
content/bindings/console.xml (content/bindings/console.xml)
content/bindings/dialog.xml (content/bindings/dialog.xml)
content/bindings/pageaction.xml (content/bindings/pageaction.xml)
content/bindings/setting.xml (content/bindings/setting.xml)
content/bindings/arrowbox.xml (content/bindings/arrowbox.xml)
content/browser.css (content/browser.css)
content/cursor.css (content/cursor.css)

Просмотреть файл

@ -1216,37 +1216,41 @@ pageaction:not([image]) > hbox >.pageaction-image {
border-bottom: @border_width_tiny@ solid #cacdd5;
}
/* XXX should be a richlistitem */
.prefbox {
setting {
padding: @padding_xsmall@;
border-bottom: @border_width_tiny@ solid rgb(207,207,207);
min-height: @touch_row@; /* row size */
-moz-box-align: center;
-moz-box-orient: horizontal;
}
.setting-group > .prefbox {
.setting-label {
-moz-box-flex: 1;
}
.setting-group > setting {
border-bottom: none;
}
.setting-subgroup > .prefbox {
.setting-subgroup > setting {
border-bottom: none;
-moz-margin-start: @margin_xxxnormal@;
}
.setting-subgroup + :not(.setting-subgroup) > .prefbox {
.setting-subgroup + :not(.setting-subgroup) > setting {
border-top: @border_width_tiny@ solid rgb(207,207,207);
}
/* Put setting textboxes on a separate row in portrait */
@media (@orientation@: portrait) {
.setting-integer,
.setting-string {
setting[type="integer"],
setting[type="string"] {
-moz-box-align: start;
-moz-box-orient: vertical;
}
.setting-integer > .setting-input > textbox,
.setting-string > .setting-input > textbox {
setting[type="integer"] > .setting-input > textbox,
setting[type="string"] > .setting-input > textbox {
width: 499px; /* textboxes seem to need a width in order to flex */
-moz-box-flex: 1;
}
@ -1256,17 +1260,17 @@ pageaction:not([image]) > hbox >.pageaction-image {
-moz-margin-start: 28px; /* sized based on the 32px addon image */
}
.options-box > setting:last-child > .prefbox {
.options-box > setting:last-child {
border-bottom: 0;
}
/* XXX should be a richlistitem description.title */
.preftitle {
.preferences-title {
font-size: @font_normal@ !important;
}
/* XXX should be a richlistitem description.normal */
.prefdesc {
.preferences-description {
font-size: @font_small@ !important;
color: grey;
}

Просмотреть файл

@ -44,7 +44,7 @@ richlistitem {
-moz-box-align: center;
}
richlistitem .preftitle {
richlistitem .preferences-title {
pointer-events: none;
min-width: 200px;
-moz-box-flex: 1;
@ -52,7 +52,7 @@ richlistitem .preftitle {
}
/* XXX look + sync */
richlistitem[default="false"] .preftitle {
richlistitem[default="false"] .preferences-title {
font-weight: bold;
}
@ -98,11 +98,11 @@ richlistitem .prefvalue {
display: none;
}
#editor[default="false"] .preftitle {
#editor[default="false"] .preferences-title {
font-weight: bold;
}
#editor-setting .prefbox {
#editor-setting setting {
border-color: transparent !important;
}

Просмотреть файл

@ -88,6 +88,34 @@ xhtml|link {
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#detail-row");
}
settings {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#settings");
}
setting[type="bool"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-bool");
}
setting[type="bool"][localized="true"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-localized-bool");
}
setting[type="boolint"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-boolint");
}
setting[type="integer"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-integer");
}
setting[type="control"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-control");
}
setting[type="string"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-string");
}
#addonitem-popup > menuitem[disabled="true"] {
display: none;
}

Просмотреть файл

@ -161,19 +161,17 @@
</implementation>
</binding>
<binding id="setting-bool" extends="chrome://browser/content/bindings/setting.xml#setting-base">
<binding id="setting-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
<content>
<xul:box flex="1" class="prefbox setting-bool">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:checkbox anonid="input" xbl:inherits="disabled,onlabel,offlabel" oncommand="inputChanged();"/>
</xul:hbox>
</xul:box>
<xul:vbox class="setting-label">
<xul:label class="preferences-title" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="preferences-description" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:checkbox anonid="input" xbl:inherits="disabled,onlabel,offlabel" oncommand="inputChanged();"/>
</xul:hbox>
</content>
<implementation>
@ -200,19 +198,17 @@
</implementation>
</binding>
<binding id="setting-boolint" extends="chrome://browser/content/bindings/setting.xml#setting-base">
<binding id="setting-boolint" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
<content>
<xul:box flex="1" class="prefbox setting-boolint">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:checkbox anonid="input" xbl:inherits="disabled" oncommand="inputChanged();"/>
</xul:hbox>
</xul:box>
<xul:vbox class="setting-label">
<xul:label class="preferences-title" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="preferences-description" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:checkbox anonid="input" xbl:inherits="disabled" oncommand="inputChanged();"/>
</xul:hbox>
</content>
<implementation>
@ -238,7 +234,7 @@
</implementation>
</binding>
<binding id="setting-localized-bool" extends="chrome://browser/content/bindings/setting.xml#setting-bool">
<binding id="setting-localized-bool" extends="chrome://mozapps/content/extensions/setting.xml#setting-bool">
<implementation>
<method name="valueFromPreference">
<body>
@ -265,19 +261,17 @@
</implementation>
</binding>
<binding id="setting-integer" extends="chrome://browser/content/bindings/setting.xml#setting-base">
<binding id="setting-integer" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
<content>
<xul:box flex="1" class="prefbox setting-integer">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:textbox type="number" anonid="input" xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound" oninput="inputChanged();" oncommand="inputChanged();"/>
</xul:hbox>
</xul:box>
<xul:vbox class="setting-label">
<xul:label class="preferences-title" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="preferences-description" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:textbox type="number" anonid="input" xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound" oninput="inputChanged();" oncommand="inputChanged();"/>
</xul:hbox>
</content>
<implementation>
@ -303,35 +297,31 @@
</implementation>
</binding>
<binding id="setting-control" extends="chrome://browser/content/bindings/setting.xml#setting-base">
<binding id="setting-control" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
<content>
<xul:box flex="1" class="prefbox setting-control">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<children includes="button|menulist"/>
</xul:hbox>
</xul:box>
<xul:vbox class="setting-label">
<xul:label class="preferences-title" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="preferences-description" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<children includes="button|menulist"/>
</xul:hbox>
</content>
</binding>
<binding id="setting-string" extends="chrome://browser/content/bindings/setting.xml#setting-base">
<binding id="setting-string" extends="chrome://mozapps/content/extensions/setting.xml#setting-base">
<content>
<xul:box flex="1" class="prefbox setting-string">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:textbox xbl:inherits="disabled,emptytext,type=inputtype,min,max,increment,hidespinbuttons,decimalplaces,wraparound" anonid="input" oninput="inputChanged();"/>
</xul:hbox>
</xul:box>
<xul:vbox class="setting-label">
<xul:label class="preferences-title" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="preferences-description" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container" class="setting-input">
<xul:textbox xbl:inherits="disabled,emptytext,type=inputtype,min,max,increment,hidespinbuttons,decimalplaces,wraparound" anonid="input" oninput="inputChanged();"/>
</xul:hbox>
</content>
<implementation>

Просмотреть файл

@ -18,3 +18,4 @@ toolkit.jar:
* content/mozapps/extensions/update.js (content/update.js)
* content/mozapps/extensions/eula.xul (content/eula.xul)
* content/mozapps/extensions/eula.js (content/eula.js)
content/mozapps/extensions/setting.xml (content/setting.xml)