The Future of Mozilla Application Development
Pages: 1, 2
Registering with Mozilla Firebird
The first thing you will probably want is to add your application to the list of extensions in the Firebird Options (Tools->Options menu) window. All that is required for this is one line. In the extension manifest, the main contents.rdf file, add the following to the package description:
chrome:extension="true"
This tells Firebird to list the program in the list of extensions once it is registered. Here is the full description, which includes some other useful information such as the author, name, project URL, and a description of the extension that appears in the listing:
<!-- package information -->
<RDF:Description about="urn:mozilla:package:xfly"
chrome:displayName="xFly"
chrome:author="Frillies"
chrome:authorURL="http://xfly.mozdev.org/"
chrome:name="xfly"
chrome:description="[2003-05-04] Adds xFly application
for viewing examples contained in 'Creating
Applications with Mozilla' [http://books.mozdev.org]"
chrome:extension="true"
chrome:settingsURL="chrome://xfly/content/xflysettings.xul">
</RDF:Description>

xFly listed as an extension in the Options window
Another new description property is chrome:settingsURL. This
enables the 'Settings' button which opens a window, the definition is which is
contained in the file pointed to by the property. For most applications, the
contents.rdf file resides in the contents/ folder, or wherever you
main XUL files are.
Launching Your Extension
There are many different ways that you can launch your application from within Mozilla Firebird. These include via a menu item, or a toolbar button. It is the latter of these two that is discussed here. The toolbars of Mozilla Firebird are highly customizable, much more so than in the Mozilla suite. You can add and remove buttons which represent application functionality via Drag&Drop, switch between text only/text and images/images only, and add new toolbars.

xFly D&D button on palette
There are several steps you have to take to get this working. The first thing to do is to create your buttons. Note that to be effective you need to create 2 different size buttons, 20x20px and 32x32px. Firebird is capable of having small and large button icons. Next up is to write the XUL for the button:
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton class="toolbarbutton-1"
id="xfly-button"
label="&xflyButton.label;"
oncommand="toxFly();"
tooltiptext="&xflyButton.tooltip;" />
</toolbarpalette>
The <toolbarbutton> is contained in a
<toolbarpalette>, the ID of which (BrowserToolbarPalette) corresponds to the palette that contains the Drag&Drop buttons for the toolbar. The original XUL for this palette lives
in the file browser.xul,
which is the main window for the Mozilla Firebird application
More modifications are needed to the main contents.rdf file, which as well as having the extension information, it contains the overlay information. More specifically, it contains information on chunks of XUL in files in your JAR file that you want to be added into some of the main Mozilla Firebird application files. So the following is added to the list of files to overlay:
<RDF:li resource="chrome://browser/content/browser.xul"/>
Then the list of files (in this case the toolbarbutton definition is contained in the file xflyextensionsoverlay.xul) is added to the sequence for this file. What is essentially being instructed is that this is the file that you will be overlaying (the file where the button will be going).
<!-- Firebird -->
<RDF:Seq about="chrome://browser/content/browser.xul">
<RDF:li>chrome://xfly/content/xflyextensionsoverlay.xul</RDF:li>
</RDF:Seq>
If you explore fully the manifest file, you will notice a description is still left in to overlay the Mozilla suite. A menuitem definition is contained in xflymenuoverlay_moz.xul, which overlays tasksOverlay.xul -- the file that contains the original 'Tools' menu definition for Mozilla. Once again this illustrates that your extension can be backwards compatible with the Mozilla suite.
Finally, you need to get the styles right for your button, related to the appearance of the image you created. Here is some of the code for the large and small buttons contained in the overlay CSS file, xflyextensionsoverlay.css.
#xfly-button {
list-style-image: url("chrome://xfly/skin/images/xflyButton32.png");
}
...
toolbar[iconsize="small"] #xfly-button {
list-style-image: url("chrome://xfly/skin/images/xflyButton20.png");
}
You will fall at the last hurdle unless you register your stylesheet, which is similar to how you register your overlay XUL file outlined previously, but this time in the skin contents.rdf file.
<RDF:Seq about="urn:mozilla:stylesheets">
<RDF:li resource="chrome://browser/content/browser.xul"/>
<RDF:li resource="chrome://global/content/customizeToolbar.xul"/>
</RDF:Seq>
<RDF:Seq about="chrome://global/content/customizeToolbar.xul">
<RDF:li>chrome://xfly/skin/xflyextensionsoverlay.css</RDF:li>
</RDF:Seq>
<RDF:Seq about="chrome://browser/content/browser.xul">
<RDF:li>chrome://xfly/skin/xflyextensionsoverlay.css</RDF:li>
</RDF:Seq>
This convinces the two Firebird application XUL files to recognize the stylesheet that contains the image properties and values for your images. Something we experienced during our testing was that the icon did not appear correctly on the palette, instead it appeared as a group of unrelated icons. It was resolved by deleting your Mozilla Firebird user profile, something that is recommended in the 0.6 release notes. Now everything should be in place, and you can grab your button and move onto one of your Firebird toolbars in the position that you wish.

xFly button on toolbar
We hope this article has clarified some of the issues raised in the new roadmap, and has given you the information you'll need to create a new Mozilla Firebird extension, or to convert your Mozilla package into one. While the new toolkit is by no means mature, its installation and registration offers a standard mechanism for developers to distribute their Mozilla applications and add-ons. If you are interested in learning more, the following links provide good places to start.
Resources
- Releases Page
http://mozilla.org/projects/firebird/releases.html - Firebird Help, a comprehensive site with a lot of good information, including Themes, Extensions and Tips&Tricks
http://texturizer.net/firebird/ - Various projects at mozdev.org hosting Firebird Extensions:
http://cdn.mozdev.org/
http://themes.mozdev.org/
http://extensionroom.mozdev.org/
David Boswell has been involved in the Mozilla community for more than six years. He is also a coauthor of Creating Applications with Mozilla and helped launch mozdev.org.
Brian King is an independent consultant who works with web and open source technologies.
O'Reilly & Associates recently released (September 2002) Creating Applications with Mozilla.
Sample Chapter 2, "Getting Started," is available free online.
You can also look at the Table of Contents, the Index, and the full description of the book.
For more information, or to order the book, click here.
Return to the Mozilla DevCenter.
Showing messages 1 through 3 of 3.
-
I prefer all iconsizes: SVG
2003-10-02 16:38:19 anonymous2 [View]
Scalable....Vector Graphics
-
XRE?
2003-06-27 17:59:52 anonymous2 [View]
How does this affect the XUL Runtime project? -
XRE?
2003-06-28 03:17:34 Brian King |
[View]
The XRE project page outlines the plan clearly for this:
http://www.mozilla.org/projects/xul/xre.html
"The first goal is to be able to build stand alone, profile independent, XUL based applications from the mozilla trunk. Current examples include the Mozilla application suite, Firebird, and Thunderbird.
The second goal would be to have all these application share and use a XRE, just like Gecko based applications will be able to share and use a GRE.
We are starting with the first goal, while we let the GRE pave the way for the second goal."
So it looks like any independent XUL based application, including Mozilla Browser (Firebird), will be able to use XRE.









