Visit Mozilla.org

Preferences System

Aus MDC


Dieses Dokument beschreibt das neue Aviary Toolkit-Einstellungssystem. Mit diesem System ist es möglich, .....-Fenster zu erstellen, welche auf allen Plattformen arbeiten (Windows, MacOS X und GNOME).

Notiz: Das Preference-System ist nur für Firefox/Thunderbird eb Version 1.5 erhältlich (eingeschlossen ihre Alpha und Beta-Versionen). Sie können es in Firefox 1.0-basierten Applikationen und Erweiterungen nicht benützen.

Das neue System ist durch ein paar XUL-Elemente und Attribute implementiert. Feferenzinformationen darüber sind erhältlich, klicken Sie einfach auf einen der untenstehenden Links:

Vorlage:Preferences System TOC

Inhaltsverzeichnis

[bearbeiten] Benützung

Der Code für ein typisches Preference-Window könnte so aussehen:

<prefwindow id="appPreferences"
            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <prefpane id="pane1" label="&pane1.title;">
    <preferences>
      <preference id="pref1" name="pref.name" type="bool"/>
    </preferences>
     
   .. UI elements that refer to the preferences above, e.g.:
    <checkbox id="check1" preference="pref1"
              label="&check1.label;" accesskey="&check1.accesskey;"/>
  </prefpane>

  <prefpane id="pane2" label="&pane2.title;" src="chrome://uri/to/pane.xul"/>
</prefwindow>


[bearbeiten] TRANSLATING

Pane content can be specified inline or an external chrome URI supplied for pane content to be loaded in via a dynamic overlay. You should be careful to read the HIGs for the platforms you are targeting and use the XUL preprocessor if necessary to set different window titles as appropriate. You should also be careful to specify the width of the window (in em) as appropriate using the preprocessor for each targeted platform, as well as the height (in em) for platforms where the window size does not change as the selected panel is changed (e.g. Windows).

[bearbeiten] Usage in XULRunner applications

When opening a preferences dialog from a XULRunner application, be sure to check the following:

  • The boolean preferences browser.preferences.animateFadeIn and browser.preferences.instantApply should be defined in the default preferences (see Fehler 302509). Example:
pref("browser.preferences.animateFadeIn", false);
pref("browser.preferences.instantApply", true);
  • When calling openDialog() to open a preferences dialog, "toolbar" should be included in the features string. Example:
var features = "chrome,titlebar,toolbar,centerscreen,modal";
window.openDialog(url, "Preferences", features);

[bearbeiten] Bugzilla

The component for bugs in the Preferences bindings (but not in Firefox/Thunderbird Options UI) is Toolkit:Preferences (file a bug list open bugs)