mozdev.org

The Transition from a Mozilla Package to a Firebird Extension - a FAQ

Please send all corrections, suggestions, or experiences in creating a Firebird Extension to Brian King.

1. Is the transition difficult, and will my code work in the new environment?
2. Does the install.js file have to change?
3. How do I add my application to the list of extensions in the Firebird Options (Tools->Options menu) window?
4. How do I launch my application, once it is installed?
5. I want to add a toolbar button for my extension, and add it to the 'Customize' D&D mechanism. Can it be done?
6. What does 'Disable Extension' do in the Options window?
7. How do I enable my application settings ('Settings button') in the Extensions panel?
8. Does my XUL/XBL code need to be re-written?
9. I like the sound of all this. Where can I go to find out more about Firebird extensions?

1. Is the transition difficult, and will my code work in the new environment?

In short, no it is not difficult, yet this may depend on the scale of your add-on or application. The application I used, xFly, was straightforward. The application itself is unfinished and suffering from bit-rot, but that is a separate issue than the one discussed here.

2. Does the install.js file have to change?

No, the installation file was just updated with some minor formatting changes. After a check for disk space, it adds the jar file, registers the chrome directories, and prompts the user to restart once successful. Nothing new here, see for yourself!

3. How do I add my application to the list of extensions in the Firebird Options (Tools->Options menu) window?

All that is required is one line. In the extension manifest (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, URL (if there is one), and a description of the extenstion which will appear in the Options list:

<!-- 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"> </RDF:Description> Note that for most applications, this file should reside in the contents/ folder, or wherever you main XUL files are.

xFly listed as a Firebird Extension
xFly listed as an extension in the Options window

4. How do I launch my application, once it is installed?

As a Mozilla package, xFly was launched from the Tools menu. This was the desired option for Firebird too, which has a Tools menu. It can be achieved with some modification to the main contents.rdf file, which contains the overlay information.

Added following to the list of files to overlay:

<RDF:li resource="chrome://browser/content/browser.xul"/>

Then the description needs to be added for the file:

<!-- Firebird --> <RDF:Seq about="chrome://browser/content/browser.xul"> <RDF:li>chrome://xfly/content/xflyextensionsoverlay.xul</RDF:li> </RDF:Seq>

browser.xul is the main window for the Firebird application, and what you are saying here is that this is the file that you will be overlaying (the file where the menuitem will be going). The menuitem definition is contained in the file xflyextensionsoverlay.xul.

<menupopup id="menu_ToolsPopup"> <menuitem id="xfly-item" label="&xflyMenu.label;" oncommand="toxFly();" /> </menupopup> The menuitem is contained in a menupopup with an id of menu_ToolsPopup, which corresponds to the menupopup of the Tools menu in browser.xul. Here is
the full contents.rdf file. Note that a description is still left in to overlay Mozilla, putting the menu definition contained in xflymenuoverlay_moz.xul into tasksOverlay.xul. This is important, as it illustrates that you can easily have one installer for Mozilla and Firebird.

This is just one of many methods to overlay Firebird and launch the application, with another possibility being a toolbar button.

5. I want to add a toolbar button for my extension, and add it to the 'Customize' D&D mechanism. Can it be done?

Yes, it certainly can. There are several steps you have to take to get this up and running.

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> There are a few things to watch for here. It has to be placed in a file that is overlaid into Firebird, so in this case it can live in xflyextensionsoverlay.xul with the menuitem. The <toolbarbutton> is contained in a <toolbarpalette>, the id of which (BrowserToolbarPalette) corresponds to the palette that contains the Drag and Drop buttons for the toolbar. This palette lives in the file browser.xul.

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/xflyButton.png"); } ... toolbar[iconsize="small"] #xfly-button { list-style-image: url("chrome://xfly/skin/images/xflyButton.png"); } You will fall at the last hurdle unless you register your stylesheet 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 recognise the stylesheet that contains the image properties and values for your images.

WARNING: Something that I experienced during my testing was the icon not appearing correctly on the palette, instead as a group of unrelated icons. The image you might see is 'Toolbar.png', which contains all the main application icons for Mozilla Firebird in one image. It can also be accessed by typing 'chrome://browser/skin/Toolbar.png' in the browser location bar. As a matter of interest, they are extracted for use using the -moz-image-region CSS property. This problem was resolved by deleting your Mozilla Firebird user profile, something that is recommended in the 0.6 release notes.

xFly D&D button
xFly D&D button on palette

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
xFly button on toolbar

6. What does 'Disable Extension' do in the Options window?

Disabling the extension will essentially hide all references to your extension, and make it impossible to load from any overlaid UI components. With xFly, the menu item and button disappeared. However, you do have to restart Firebird when you do this for it to take effect. Currently there is no prompt to tell you to do this, so interaction with user is poor on this feature. I am sure this will change in future versions.

7. How do I enable my application settings ('Settings button') in the Extensions panel?

You may have alternative routes to access settings for your application, but this is one "official" way of doing it via Firebird. The idea is to provide a utility for launching a new window where the user can change the global configuration of the extension, for features that require their input and choices.

In the extension manifest (main contents.rdf file), the following was added to the package description:

chrome:settingsURL="chrome://xfly/content/xflysettings.xul"

This tells Firebird to open the chrome window xflysettings.xul. This feature is still available even when the extension is disabled.

8. Does my XUL/XBL code need to be re-written?

The latest roadmap says:

Note: the Phoenix toolkit is a compatible reimplementation of the XPFE toolkit, with added features such as customizable toolbars. We are not starting a new C++ GUI toolkit, we are simply moving to the next generation XUL toolkit.

Due to the fact that the new toolkit should be compatible with the XPFE toolkit, your code should work fine. However, don't forget to test it anyway, and if possible take advantage of new features. The only new features I could find currently are related to toolbar customisation, with the addition of the <toolbarpalette> and <toolbaritem> elements. However, I am sure there will be more changes as the toolkit evolves.

9. I like the sound of all this. Where can I go to find out more about Firebird extensions?

Mozilla Firebird Project Page
http://mozilla.org/projects/firebird/

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/

More developer notes

User Notes: [?]

If you do not get a response to a question posted in this forum, please try sending a message to the project's mailing list or to the project owner directly.

[1] Submitted by: Steve Saturday June 21st 2003

I wonder if the Mozilla Calendar could be a firebird extension. I'd rather it was standalone and seperate, but as long as I can still use it.

[2] Submitted by: Brian King Thursday June 26th 2003

Calendar is already available as a Firebird extension. It is already listed at extensionroom.mozdev.org

[3] Submitted by: HJ Wednesday August 20th 2003

"WARNING: Something that I experienced during my testing was the icon not appearing correctly on the palette, instead as a group of unrelated icons. The image you might see is 'Toolbar.png', which contains all the main application icons for Mozilla Firebird in one image. It can also be accessed by typing 'chrome://browser/skin/Toolbar.png' in the browser location bar. As a matter of interest, they are extracted for use using the -moz-image-region CSS property. This problem was resolved by deleting your Mozilla Firebird user profile, something that is recommended in the 0.6 release notes."

All you need to do is to remove XUL.mfl from your profile directory, that's all :D

[4] Submitted by: Alex Sunday August 31st 2003

Nice project!

[5] Submitted by: Mike Sunday September 7th 2003

Very helpful comments here, thanks for posting this info.

[6] Submitted by: JB Monday September 15th 2003

Very interesting information.

Questions or comments not answered in the FAQ can be submitted from our feedback page.
Copyright © 2000-2018. All rights reserved. Terms of Use & Privacy Policy.