Difference between revisions of "Development:Supporting Additional Web-based Feed Readers"

From Camino Wiki
Jump to navigation Jump to search
(intro)
 
(finish up)
Line 4: Line 4:
  
 
Although the feedhandlers code is designed to built by Makefile (using <code>osacompile</code> and various shell commands), it is possible to manually assemble your own feedhandler application based on the source.
 
Although the feedhandlers code is designed to built by Makefile (using <code>osacompile</code> and various shell commands), it is possible to manually assemble your own feedhandler application based on the source.
 +
 +
==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.
 +
# 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 of the second argument before the <code>%s</code>).
 +
 +
==Building the AppleScript applet==
 +
# Rename <code>feedhandlers.applescript.in</code> to <code>feedhandlers.applescript</code> and open the file in Script Editor or AppleScript Editor.
 +
# Replace <code>%FEED_HANDLER_URL%</code> with the URL from step 2 of the [[#Preparation|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 <code>Info.plist</code>==
 +
# 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 <code>Info.plist</code> file (e.g., <code>Super Feedreader.app/Contents/Info.plist</code>) in a text editor, select the entire contents, and delete them.
 +
# Open the <code>Info.plist.in</code> from Camino’s feedhandlers source in a text editor, copy the entire contents, and paste them into your application’s <code>Info.plist</code> file.
 +
# Replace <code>%FEED_HANDLER_CFBUNDLE_NAME%</code> and <code>%FEED_HANDLER_DISPLAY_NAME%</code> with your application’s name, e.g. “Super Feedreader”.
 +
# Fix the copyright string (the information inside the <code>&lt;string&gt;</code> tags just below the <code>&lt;key&gt;CFBundleGetInfoString&lt;/key&gt;</code> line).
 +
# Change the bundle identifier (the information inside the <code>&lt;string&gt;</code> tags just below the <code>&lt;key&gt;CFBundleIdentifier&lt;/key&gt;</code> line) to a value appropriate for your application, e.g. <code>com.mydomain.superfeedreader</code>.
 +
# Replace <code>%FEED_HANDLER_CREATOR%</code> 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 <code>Info.plist</code> file.
 +
 +
==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 [[#Editing the <code>Info.plist</code>|above]].  Save the <code>PkgInfo</code> file.
 +
 +
==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.
 +
 +
==Registering the completed application with Mac OS X</code>==
 +
# 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.)

Revision as of 23:13, 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.

Preparation

  1. 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.
  2. 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 a navigator.registerProtocolHandler JavaScript call, this is the content of the second argument before the %s).

Building the AppleScript applet

  1. Rename feedhandlers.applescript.in to feedhandlers.applescript and open the file in Script Editor or AppleScript Editor.
  2. 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.
  3. 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

  1. 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.
  2. 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.
  3. Open the Info.plist.in from Camino’s feedhandlers source in a text editor, copy the entire contents, and paste them into your application’s Info.plist file.
  4. Replace %FEED_HANDLER_CFBUNDLE_NAME% and %FEED_HANDLER_DISPLAY_NAME% with your application’s name, e.g. “Super Feedreader”.
  5. Fix the copyright string (the information inside the <string> tags just below the <key>CFBundleGetInfoString</key> line).
  6. 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.
  7. 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).
  8. Save the Info.plist file.

Editing PkgInfo

  1. 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 [[#Editing the Info.plist|above]]. Save the PkgInfo file.

Providing a custom application icon

  1. 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 as applet.icns, replacing the existing Super Feedreader.app/Contents/Resources/applet.icns file.

Registering the completed application with Mac OS X

  1. 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.)