233461 specify icons for dialogs button

Hook up gnome icons in gnomestripe
r=mconnor
This commit is contained in:
marco%gnome.org 2005-03-02 10:53:06 +00:00
Родитель 52d4e65ee6
Коммит 52f82b7eb5
16 изменённых файлов: 177 добавлений и 215 удалений

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

@ -84,6 +84,7 @@ function filepickerLoad() {
if (o.displayDirectory) {
const directory = o.displayDirectory.path;
}
const initialText = o.defaultString;
const filterTitles = o.filters.titles;
const filterTypes = o.filters.types;
@ -138,13 +139,18 @@ function filepickerLoad() {
treeView.showOnlyDirectories = true;
}
// set up the right icon
if (filePickerMode == nsIFilePicker.modeSave)
okButton.setAttribute("icon","save");
else
okButton.setAttribute("icon","open");
// start out with a filename sort
handleColumnClick("FilenameColumn");
document.documentElement.setAttribute("ondialogcancel", "return onCancel();");
try {
var buttonLabel = getOKAction();
okButton.setAttribute("label", buttonLabel);
setOKAction();
} catch (exception) {
// keep it set to "OK"
}
@ -513,8 +519,9 @@ function onTreeFocus(event) {
onFileSelected(treeView.selectedFiles);
}
function getOKAction(file) {
function setOKAction(file) {
var buttonLabel;
var buttonIcon = "open"; // used in all but one case
if (file && file.isDirectory() && filePickerMode != nsIFilePicker.modeGetFolder) {
document.documentElement.setAttribute("ondialogaccept", "return openOnOK();");
@ -532,11 +539,12 @@ function getOKAction(file) {
break;
case nsIFilePicker.modeSave:
buttonLabel = gFilePickerBundle.getString("saveButtonLabel");
buttonIcon = "save";
break;
}
}
return buttonLabel;
okButton.setAttribute("label", buttonLabel);
okButton.setAttribute("icon", buttonIcon);
}
function onSelect(event) {
@ -575,8 +583,7 @@ function onFileSelected(/* nsIArray */ selectedFileList) {
}
if (validFileSelected) {
var buttonLabel = getOKAction(file);
okButton.setAttribute("label", buttonLabel);
setOKAction(file);
okButton.disabled = invalidSelection;
} else
okButton.disabled = (textInput.value == "");
@ -603,8 +610,7 @@ function addToTextFieldValue(path)
}
function onTextFieldFocus() {
var buttonLabel = getOKAction(null);
okButton.setAttribute("label", buttonLabel);
setOKAction(null);
doEnabling();
}

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

@ -112,7 +112,7 @@
<hbox class="dialog-button-box" align="center">
<checkbox label="&showHiddenFiles.label;" oncommand="toggleShowHidden();"
flex="1" align="left" accesskey="&showHiddenFiles.accesskey;"/>
<button dlgtype="cancel" class="dialog-button"/>
<button dlgtype="accept" class="dialog-button"/>
<button dlgtype="cancel" icon="cancel" class="dialog-button"/>
<button dlgtype="accept" icon="accept" class="dialog-button"/>
</hbox>
</dialog>

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

@ -53,7 +53,7 @@
<content>
<xul:button label="&print.label;" accesskey="&print.accesskey;"
oncommand="PrintUtils.print();"/>
oncommand="PrintUtils.print();" icon="print"/>
<xul:button label="&pageSetup.label;" accesskey="&pageSetup.accesskey;"
oncommand="this.parentNode.doPageSetup();"/>
@ -118,7 +118,7 @@
<xul:toolbarseparator class="toolbarseparator-primary"/>
<xul:button label="&close.label;" accesskey="&close.accesskey;"
oncommand="PrintUtils.exitPrintPreview();"/>
oncommand="PrintUtils.exitPrintPreview();" icon="close"/>
<xul:data value="&customPrompt.title;"/>
</content>

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

@ -94,7 +94,7 @@
</grid>
<separator/>
<hbox id="CancelButton" pack="end">
<button id="cancel" label="&dialogCancel.label;"
<button id="cancel" label="&dialogCancel.label;" icon="cancel"
oncommand="doCancelButton()"/>
</hbox>
</window>

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

@ -48,6 +48,7 @@
onload="onLoad();"
ondialogaccept="return onAccept();"
oncancel="return onCancel();"
buttoniconaccept="print"
title="&printDialog.title;"
persist="screenX screenY"
screenX="24" screenY="24">
@ -77,14 +78,16 @@
<label id="printerLabel" value="&printerInput.label;"/>
</hbox>
<menulist id="printerList" flex="1" type="description" oncommand="setPrinterDefaultsForSelectedPrinter();"/>
<button id="properties" label="&propertiesButton.label;" oncommand="displayPropertiesDialog();"/>
<button id="properties" label="&propertiesButton.label;"
icon="properties" oncommand="displayPropertiesDialog();"/>
</row>
<row align="center">
<hbox align="center" pack="end">
<label id="fileLabel" control="fileInput" value="&fileInput.label;"/>
</hbox>
<textbox id="fileInput" flex="1" onblur="stripTrailingWhitespace(this)"/>
<button id="chooseFile" label="&chooseButton.label;" oncommand="onChooseFile()"/>
<button id="chooseFile" label="&chooseButton.label;"
icon="open" oncommand="onChooseFile()"/>
</row>
<row align="center">
<hbox align="center" pack="end">

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

@ -72,7 +72,7 @@
<hbox align="center">
<button id="add_button" oncommand="AddAvailableCharset();"
label="&add.label;" disabled="true"/>
label="&add.label;" icon="add" disabled="true"/>
</hbox>
</vbox>
@ -87,7 +87,7 @@
<separator class="thin"/>
<hbox align="center">
<button id="remove_button" oncommand="RemoveActiveCharset();"
disabled="true"
disabled="true" icon="remove"
label="&remove.label;"/>
</hbox>
</vbox>

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

@ -90,14 +90,14 @@
<checkbox id="smallicons" oncommand="updateIconSize(this.checked);" label="&useSmallIcons.label;"/>
<button label="&addNewToolbar.label;" oncommand="addNewToolbar();"/>
<button label="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();"/>
<button label="&addNewToolbar.label;" oncommand="addNewToolbar();" icon="add"/>
<button label="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();" icon="refresh"/>
</box>
<separator class="groove"/>
<hbox align="center" pack="end">
<button label="&saveChanges.label;" oncommand="onAccept();" default="true"/>
<button label="&saveChanges.label;" oncommand="onAccept();" default="true" icon="close"/>
</hbox>
</vbox>

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

@ -83,8 +83,12 @@
</vbox>
<vbox flex="1">
<button id="btnFind" label="&findButton.label;" accesskey="&findButton.accesskey;"
dlgtype="accept"/>
<button label="&cancelButton.label;" dlgtype="cancel"/>
dlgtype="accept" icon="find"/>
#ifdef XP_UNIX
<button label="&closeButton.label;" icon="close" dlgtype="cancel"/>
#else
<button label="&cancelButton.label;" icon="cancel" dlgtype="cancel"/>
#endif
</vbox>
</hbox>
</dialog>

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

@ -186,7 +186,7 @@
align="center" pack="center" flex="1">
<children>
<xul:image class="button-icon" xbl:inherits="src=image"/>
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop" flex="1"/>
<xul:label class="button-text" xbl:inherits="value=label,accesskey,crop"/>
</children>
</xul:hbox>
</content>

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

@ -230,6 +230,30 @@
button.setAttribute("accesskey", accessKey);
}
}
// allow specifying alternate icons in the dialog header
if (!button.hasAttribute("icon")) {
// if there's an icon specified, use that
if (this.hasAttribute("buttonicon"+dlgtype))
button.setAttribute("icon", this.getAttribute("buttonicon"+dlgtype));
// otherwise set defaults
else
switch (dlgtype) {
case "accept":
button.setAttribute("icon","accept");
break;
case "cancel":
button.setAttribute("icon","cancel");
break;
case "disclosue":
button.setAttribute("icon","properties");
break;
case "help":
button.setAttribute("icon","help");
break;
default:
break;
}
}
}
// ensure that hitting enter triggers ondialogaccept

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

@ -12,7 +12,7 @@
<xul:hbox align="center">
<xul:button type="disclosure" class="expanderButton" anonid="disclosure" xbl:inherits="disabled" mousethrough="always"/>
<xul:label class="header expanderButton" anonid="label" xbl:inherits="value=label,disabled" mousethrough="always" flex="1"/>
<xul:button anonid="clear-button" xbl:inherits="label=clearlabel,disabled=cleardisabled,hidden=clearhidden" mousethrough="always"/>
<xul:button anonid="clear-button" xbl:inherits="label=clearlabel,disabled=cleardisabled,hidden=clearhidden" mousethrough="always" icon="clear"/>
</xul:hbox>
<xul:vbox flex="1" anonid="settings" class="settingsContainer" collapsed="true" xbl:inherits="align">
<children/>

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

@ -64,9 +64,19 @@
if (this.onFirstPage) {
this.canRewind = false;
this.setAttribute("firstpage", "true");
#ifdef XP_UNIX
#ifndef XP_MACOSX
this._backButton.setAttribute('hidden', 'true');
#endif
#endif
} else {
this.canRewind = true;
this.setAttribute("firstpage", "false");
#ifdef XP_UNIX
#ifndef XP_MACOSX
this._backButton.setAttribute('hidden', 'false');
#endif
#endif
}
if (this.onLastPage) {
@ -328,7 +338,11 @@
var btn = document.getAnonymousElementByAttribute(this._wizardButtons, "dlgtype", aName);
if (btn) {
btn.addEventListener("command", this["_"+aName+"Func"], false);
#ifdef XP_UNIX
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName+"-unix"));
#else
btn.setAttribute("label", this._bundle.GetStringFromName("button-"+aName));
#endif
this["_"+aName+"Button"] = btn;
}
return btn;
@ -478,16 +492,22 @@
<xul:separator class="wizard-buttons-separator groove"/>
<xul:hbox class="wizard-buttons-box-2">
<xul:spacer flex="1"/>
<xul:button class="wizard-button" dlgtype="back"/>
#ifdef XP_UNIX
<xul:button class="wizard-button" dlgtype="cancel" icon="cancel"/>
<xul:spacer style="width: 24px"/>
#endif
<xul:button class="wizard-button" dlgtype="back" icon="go-back"/>
<xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
<xul:hbox>
<xul:button class="wizard-button" dlgtype="finish" default="true" flex="1"/>
</xul:hbox>
<xul:hbox>
<xul:button class="wizard-button" dlgtype="next" default="true" flex="1"/>
<xul:button class="wizard-button" dlgtype="next" icon="go-forward" default="true" flex="1"/>
</xul:hbox>
</xul:deck>
<xul:button class="wizard-button" dlgtype="cancel"/>
#ifndef XP_UNIX
<xul:button class="wizard-button" dlgtype="cancel" icon="cancel"/>
#endif
</xul:hbox>
</xul:vbox>
</content>

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

@ -14,6 +14,7 @@
<!ENTITY findButton.label "Find Next">
<!ENTITY findButton.accesskey "F">
<!ENTITY cancelButton.label "Cancel">
<!ENTITY closeButton.label "Close">
<!ENTITY up.label "Up">
<!ENTITY up.accesskey "U">
<!ENTITY down.label "Down">

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

@ -2,10 +2,10 @@ button-back=< Back
button-next=Next >
button-finish=Finish
button-cancel=Cancel
button-back-gnome=Back
button-next-gnome=Next
button-finish-gnome=Finish
button-cancel-gnome=Cancel
button-back-unix=Back
button-next-unix=Next
button-finish-unix=Finish
button-cancel-unix=Cancel
default-first-title=Welcome to the %S
default-last-title=Completing the %S
default-first-title-mac=Introduction

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

@ -1,183 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla.org Code.
#
# The Initial Developer of the Original Code is
# Doron Rosenberg.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@bengoodger.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://mozapps/locale/downloads/pref-downloads.dtd" >
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.initPanel('chrome://mozapps/content/downloads/pref-downloads.xul');"
headertitle="&lHeader;" onunload="uninit();">
<stringbundle id="strings" src="chrome://mozapps/locale/downloads/unknownContentType.properties"/>
<script type="application/x-javascript" src="chrome://mozapps/content/downloads/helperApps.js"/>
<script type="application/x-javascript" src="chrome://mozapps/content/downloads/pref-downloads.js"/>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<groupbox>
<caption label="&askOnSave.label;"/>
<radiogroup id="askOnSave" onselect="doEnabling(this.selectedItem);" flex="1"
preftype="bool" prefstring="browser.download.useDownloadDir">
<radio id="alwaysAsk" label="&alwaysAsk.label;" value="false"/>
<hbox flex="1">
<radio id="neverAsk" label="&neverAsk.label;" value="true"/>
<button id="showFolder" label="&showFolder.label;" oncommand="showFolder();"/>
</hbox>
</radiogroup>
</groupbox>
#ifdef MOZ_PHOENIX
<groupbox align="start">
<caption label="&downloadManagerWindow.label;"/>
<checkbox id="showWhenStarting" label="&showWhenStarting.label;"
prefstring="browser.download.manager.showWhenStarting"
oncommand="toggleDMPrefUI(event.target);"/>
<checkbox id="closeWhenDone" label="&closeWhenDone.label;" class="indent"
prefstring="browser.download.manager.closeWhenDone"/>
</groupbox>
#endif
<groupbox flex="1">
<caption label="&fileTypes.label;"/>
<description>&fileTypesDescription.label;</description>
<separator class="thin"/>
<!-- XXX it's really lame that I'm using a content backed tree here rather
than one built with treebuilder but for some reason treebuilder is
throwing "can't do open ended queries like that!" assertions for
no discernible reason -->
<vbox class="indent" flex="1">
<vbox flex="1" id="fileHandlersListContainer">
<tree id="fileHandlersList" flex="1" hidecolumnpicker="true"
datasources="rdf:null"
onselect="fileHandlerListSelectionChanged();"
ondblclick="if (isValidLeftClick(event, 'treechildren')) editFileHandler();">
<template>
<rule>
<conditions>
<content uri="?uri"/>
<triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#MIME-types"
object="?MIME-types"/>
<member container="?MIME-types" child="?type"/>
<triple subject="?type"
predicate="http://home.netscape.com/NC-rdf#FileType"
object="?file-type"/>
<triple subject="?type"
predicate="http://home.netscape.com/NC-rdf#FileHandler"
object="?file-handler"/>
<triple subject="?type"
predicate="http://home.netscape.com/NC-rdf#FileIcon"
object="?file-icon"/>
<triple subject="?type"
predicate="http://home.netscape.com/NC-rdf#FileHandleAuto"
object="true"/>
</conditions>
<bindings>
<binding subject="?type"
predicate="http://home.netscape.com/NC-rdf#FileExtension"
object="?file-extension"/>
</bindings>
<action>
<treechildren class="extensionChildren">
<treeitem uri="?type">
<treerow>
<treecell label="?file-extension" src="?file-icon"/>
<treecell label="?file-type"/>
<treecell label="?file-handler"/>
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
</template>
<treecols>
<treecol id="fileExtension"
class="sortDirectionIndicator" persist="width"
sort="rdf:http://home.netscape.com/NC-rdf#FileExtension"
sortActive="true" sortDirection="none" hideheader="true"/>
<treecol id="fileType" flex="1"
class="sortDirectionIndicator" persist="width"
sort="rdf:http://home.netscape.com/NC-rdf#FileType"
sortActive="false" sortDirection="none" hideheader="true"/>
<splitter class="tree-splitter" />
<treecol id="fileHandler" flex="1"
class="sortDirectionIndicator" persist="width"
sort="rdf:http://home.netscape.com/NC-rdf#FileHandler"
sortActive="false" sortDirection="none" hideheader="true"/>
</treecols> <!-- label="&fileHandlerColName.label;" label="&fileTypeColName.label;" -->
</tree>
</vbox>
<separator class="thin"/>
<hbox>
<button label="&editFileHandler.label;" accesskey="&editFileHandler.accesskey;"
id="editFileHandler" oncommand="editFileHandler();"/>
<button label="&removeFileHandler.label;" accesskey="&removeFileHandler.accesskey;"
id="removeFileHandler" oncommand="removeFileHandler();"/>
#ifdef MOZ_PHOENIX
<spring flex="1"/>
<button label="&plugins.label;" accesskey="&plugins.accesskey;"
id="plugins" oncommand="showPlugins();"/>
#endif
</hbox>
</vbox>
</groupbox>
<menulist id="downloadFolderList" flex="1" hidden="true"
preftype="int" prefstring="browser.download.folderList" prefdefval="0"
oncommand="folderListCommand();">
<menupopup>
<menuitem value="0" label="&desktop.label;"/>
<menuitem value="1" label="&downloads.label;"/>
<menuitem value="2" label="" hidden="true" id="downloadFolder" crop="center" flex="1"/>
<menuitem value="9" label="&choose.label;"/>
</menupopup>
</menulist>
</page>

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

@ -63,6 +63,10 @@ button {
padding: 1px 4px 2px 3px;
}
.button-icon {
margin-right: 2px;
}
.button-text {
margin: 0 !important;
text-align: center;
@ -178,3 +182,86 @@ button[type="disclosure"][open="true"] {
list-style-image: url("chrome://global/skin/tree/twisty-open.png");
}
/*
* GNOME Stock Icon Styles
*/
button[icon="accept"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-ok?size=button");
}
button[icon="cancel"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-cancel?size=button");
}
button[icon="help"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-help?size=button");
}
button[icon="open"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-open?size=button");
}
button[icon="save"] .button-icon {
list-style-image: url(moz-icon://stock/gtk-save?size=button);
}
button[icon="find"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-find?size=button");
}
button[icon="clear"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-clear?size=button");
}
button[icon="yes"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-yes?size=button");
}
button[icon="no"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-no?size=button");
}
button[icon="apply"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-apply?size=button");
}
button[icon="close"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-close?size=button");
}
button[icon="print"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-print?size=button");
}
button[icon="add"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-add?size=button");
}
button[icon="remove"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-remove?size=button");
}
button[icon="refresh"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-refresh?size=button");
}
button[icon="go-forward"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-go-forward?size=button");
}
button[icon="go-back"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-go-back?size=button");
}
button[icon="properties"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-properties?size=button");
}
button[icon="select-font"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-select-font?size=button");
}
button[icon="network"] .button-icon {
list-style-image: url("moz-icon://stock/gtk-network?size=button");
}