Difference between revisions of "Development:Supporting Additional Web-based Feed Readers"
(finish up) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
==Preparation== | ==Preparation== | ||
# Grab a copy of Camino’s feedhander source, either by checking out the Camino code, downloading a Camino source tarball, or viewing the source files in <code>[http://mxr.mozilla.org/camino/source/camino/feedhandlers/ MXR]</code>, clicking the “Raw file” link in the box on the upper right, and saving the files. | # Grab a copy of Camino’s feedhander source, either by checking out the Camino code, downloading a Camino source tarball, or viewing the source files in <code>[http://mxr.mozilla.org/camino/source/camino/feedhandlers/ MXR]</code>, clicking the “Raw file” link in the box on the upper right, and saving the files. | ||
− | # Next, you need to discover the service's subscription URL. This may be specified by the <code>navigator.registerProtocolHandler</code> JavaScript call on the site, if the site offers itself as a [https://developer.mozilla.org/en/Web-based_protocol_handlers web-based protocol handler]. For example, the Google feed subscription URL is http://www.google.com/ig/add?feedurl= (in a <code>navigator.registerProtocolHandler</code> JavaScript call, this is the content | + | # Next, you need to discover the service's subscription URL. This may be specified by the <code>navigator.registerProtocolHandler</code> JavaScript call on the site, if the site offers itself as a [https://developer.mozilla.org/en/Web-based_protocol_handlers web-based protocol handler]. For example, the Google feed subscription URL is http://www.google.com/ig/add?feedurl= (in a <code>navigator.registerProtocolHandler</code> JavaScript call, this is the content up to the <code>%s</code> of the call’s second argument). |
==Building the AppleScript applet== | ==Building the AppleScript applet== | ||
Line 25: | Line 25: | ||
==Editing <code>PkgInfo</code>== | ==Editing <code>PkgInfo</code>== | ||
− | # Open your application’s <code>PkgInfo</code> file (e.g., <code>Super Feedreader.app/Contents/PkgInfo</code>) in a text editor and replace the last four letters with the creator code you chose in step 7 [[# | + | # Open your application’s <code>PkgInfo</code> file (e.g., <code>Super Feedreader.app/Contents/PkgInfo</code>) in a text editor and replace the last four letters with the creator code you chose in step 7 [[#Editing_the_Info.plist|above]]. Save the <code>PkgInfo</code> file. |
==Providing a custom application icon== | ==Providing a custom application icon== | ||
# If you want the application to have a custom icon, prepare the icon as a <code>.icns</code> file and then copy it into your application bundle’s Resources folder as <code>applet.icns</code>, replacing the existing <code>Super Feedreader.app/Contents/Resources/applet.icns</code> file. | # If you want the application to have a custom icon, prepare the icon as a <code>.icns</code> file and then copy it into your application bundle’s Resources folder as <code>applet.icns</code>, replacing the existing <code>Super Feedreader.app/Contents/Resources/applet.icns</code> file. | ||
− | ==Registering the completed application with Mac OS X | + | ==Registering the completed application with Mac OS X== |
# Finally, move your application from the Application folder to the Desktop, and then move it back to the Applications folder. Double-click your application once to launch it (it should launch and quit, invisibly). These steps are necessary to have Mac OS X LaunchServices recognize your application and read the changes you made to the <code>Info.plist</code> file. | # Finally, move your application from the Application folder to the Desktop, and then move it back to the Applications folder. Double-click your application once to launch it (it should launch and quit, invisibly). These steps are necessary to have Mac OS X LaunchServices recognize your application and read the changes you made to the <code>Info.plist</code> file. | ||
At this point, you should be able to select your application as a feed reader. (Camino caches the list of available feed readers for a period of time, so if you add a new reader after you've already opened the General preference pane, you may have to quit Camino and restart before you can use Camino’s UI to select the default feed reader.) | At this point, you should be able to select your application as a feed reader. (Camino caches the list of available feed readers for a period of time, so if you add a new reader after you've already opened the General preference pane, you may have to quit Camino and restart before you can use Camino’s UI to select the default feed reader.) |
Latest revision as of 23:16, 12 February 2011
Camino 1.6 and newer ship with small AppleScript applications that handle the feed://
protocol in order to support choosing certain web-based feed readers (Google’s iGoogle and Google Reader, My Yahoo!, and Bloglines) as the user’s default feed reader.
The code for these applications lives in camino/feedhandlers
, with supporting code in MainController.mm
(prelaunchHelperApps
, helperAppPrelaunchComplete
, and doBackgroundPrelaunch:
) to handle Quarantine and LaunchServices registration on the first launch of a Camino version.
Although the feedhandlers code is designed to built by Makefile (using osacompile
and various shell commands), it is possible to manually assemble your own feedhandler application based on the source.
Contents
Preparation
- Grab a copy of Camino’s feedhander source, either by checking out the Camino code, downloading a Camino source tarball, or viewing the source files in
MXR
, clicking the “Raw file” link in the box on the upper right, and saving the files. - Next, you need to discover the service's subscription URL. This may be specified by the
navigator.registerProtocolHandler
JavaScript call on the site, if the site offers itself as a web-based protocol handler. For example, the Google feed subscription URL is http://www.google.com/ig/add?feedurl= (in anavigator.registerProtocolHandler
JavaScript call, this is the content up to the%s
of the call’s second argument).
Building the AppleScript applet
- Rename
feedhandlers.applescript.in
tofeedhandlers.applescript
and open the file in Script Editor or AppleScript Editor. - Replace
%FEED_HANDLER_URL%
with the URL from step 2 of the Preparation section, e.g. http://www.google.com/ig/add?feedurl= in the Google case. - Save the script as an “Application bundle”, giving it the name of your web-based feed reader (e.g., “Super Feedreader”). Be sure that "Stay Open" and "Startup Screen" are not checked.
Editing the Info.plist
- Now you must perform surgery on the bundle of the application you just saved. In the Finder, control-click on your application and choose “Show Package Contents” from the context menu.
- Open your application’s
Info.plist
file (e.g.,Super Feedreader.app/Contents/Info.plist
) in a text editor, select the entire contents, and delete them. - Open the
Info.plist.in
from Camino’s feedhandlers source in a text editor, copy the entire contents, and paste them into your application’sInfo.plist
file. - Replace
%FEED_HANDLER_CFBUNDLE_NAME%
and%FEED_HANDLER_DISPLAY_NAME%
with your application’s name, e.g. “Super Feedreader”. - Fix the copyright string (the information inside the
<string>
tags just below the<key>CFBundleGetInfoString</key>
line). - Change the bundle identifier (the information inside the
<string>
tags just below the<key>CFBundleIdentifier</key>
line) to a value appropriate for your application, e.g.com.mydomain.superfeedreader
. - Replace
%FEED_HANDLER_CREATOR%
with a four-letter creator code (must be all uppercase or mixed case and should not collide with the creator code of any other application). - Save the
Info.plist
file.
Editing PkgInfo
- Open your application’s
PkgInfo
file (e.g.,Super Feedreader.app/Contents/PkgInfo
) in a text editor and replace the last four letters with the creator code you chose in step 7 above. Save thePkgInfo
file.
Providing a custom application icon
- If you want the application to have a custom icon, prepare the icon as a
.icns
file and then copy it into your application bundle’s Resources folder asapplet.icns
, replacing the existingSuper Feedreader.app/Contents/Resources/applet.icns
file.
Registering the completed application with Mac OS X
- Finally, move your application from the Application folder to the Desktop, and then move it back to the Applications folder. Double-click your application once to launch it (it should launch and quit, invisibly). These steps are necessary to have Mac OS X LaunchServices recognize your application and read the changes you made to the
Info.plist
file.
At this point, you should be able to select your application as a feed reader. (Camino caches the list of available feed readers for a period of time, so if you add a new reader after you've already opened the General preference pane, you may have to quit Camino and restart before you can use Camino’s UI to select the default feed reader.)