Development:Third-Party Preference Panes

From Camino Wiki
Revision as of 14:46, 21 December 2007 by Clawson (talk | contribs) (preliminary work on actual instructions)
Jump to navigation Jump to search
DRAFT
This page is not complete.

See Bug 384800 for more information on the status of this page. The current how-to should not be attempted by people unfamiliar with Xcode and its related tools or the Camino codebase.

Who should read this document?

Camino, per our mission statement, "is an open source web browser developed with a focus on providing the best possible experience for Mac OS X users." This, along with the limited time available for our all-volunteer programming team to implement features, means that certain choices have to be made about what should and shouldn't be part of the Camino application itself. As with Firefox extensions, there are many opportunities for third-party developers to step in and provide niche features or UI for things that Camino doesn't provide by default. This document is intended to provide a jumping-off point for third-party developers interested in developing additional preference panes for Camino.

Getting started

These instructions assume a basic working knowledge of Apple's Developer Tools, including Xcode and Interface Builder, as well as the Objective-C language itself. If you are unfamiliar with these, Apple Developer Connection is an excellent place to start learning.

These instructions should work for anyone developing preference panes on Mac OS X 10.4 or higher, with Xcode 2.4.x or higher and Interface Builder 2.x or higher, to be deployed on any version of Camino from 1.0.x onward.

Creating the Xcode project

Camino's preference panes are standard Apple PreferencePanes with a small twist: their creator code is MOZC (Camino's creator code) instead of the default "????". You can change this in the Properties tab of Xcode's Target Info window (see screenshot).

Error creating thumbnail: Unable to save thumbnail to destination

We've put together a [CBSamplePane.zip sample Xcode project] (download size) for developers to use when writing preference panes for Camino. Feel free to use this project as a starting point, or make your own.

Laying out the UI

In order to keep the UI of your preference panes as consistent as possible with the preference panes shipped with Camino itself, please use our NIB Editing Guide as a reference for laying out the UI when developing preference panes for Camino.

Using Camino methods

If you plan to use any of Camino's methods, you'll need to tell the linker how to find a Camino application in order for the -bundle_loader switch to do its job. Again using the Target Info window, point the linker's "Bundle loader" to a Camino app on your hard disk. For example, if Camino is in your Applications folder, inside a folder called "Internet", it would look like this:

Error creating thumbnail: Unable to save thumbnail to destination

If you have multiple copies of Camino, point it to the oldest one you plan to support with your preference pane.

You'll also need to copy over any Camino header files for methods you're using in your preference pane. You can add them to the Copy Headers phase of the project, like this:

Error creating thumbnail: Unable to save thumbnail to destination

That's it! You should be able to build the project and test your preference pane with Camino. Remember to re-launch Camino after placing the preference pane in [~]/Library/Application Suppport/Camino/PreferencePanes/ .

Other potential gotchas and caveats

  • It is not currently possible to use Gecko code directly in third-party preference panes. If there's something you really need to use that simply doesn't have a Cocoa wrapper on it in Camino, please bring it to our attention. We may be willing to add wrapper code for it, since one architectural goal we have for Camino is to hide Gecko from our Cocoa developers as much as possible.

Error messages

Undefined Symbols

it compiles ok, but if it's in deployment mode I get an undefined symbol error [Is this still a problem with -bundle_loader? -cl]

  • Get info on your target (or project) and set "Other Linker Flags" to "-undefined dynamic_lookup" for all configurations
  • You only need the appropriate header files (the header files for the classes you're using/subclassing) if you're using -undefined dynamic_lookup; you don't need to link against the Gecko code (often, this is just PrefPaneBase.h)

Camino doesn't like my prefPane; it says it has to have a 'MOZC' signature

  • Get Info on your prefpane target
  • Go to "Properties"
  • Change the "Creator" field to "MOZC" (without quotes)