Monday, September 29, 2008

Google Gears in Prism

I've been searching for a while to see if someone has gotten Google Gears working in Prism, but from what I've seen, it hasn't been done before. So I decided to see what it would take to get Prism to accept Gears as a extension.

My first stop was to Mozilla's Prism Extensions page: http://developer.mozilla.org/en/Prism/Extensions I ran into it a bunch of times before, but never paid much attention to it. There is one section that caught my attention "Porting an Existing Extension". This section tells you that you have to add this code to the install.rdf file to say that the extension works in prism:

  <em:targetApplication>
    <!– Prism –>
    <Description>
      <em:id>prism@developer.mozilla.org</em:id>
      <em:minVersion>0.8</em:minVersion>
      <em:maxVersion>1.0.0.*</em:maxVersion>
    </Description>
  </em:targetApplication>

So my next step was to get the actual Gears extension file: http://gears.google.com/ For some reason this was hard for me, but all you have to do is click on the link for your operating system below the big blue button, then the big "Install Gears" button.

Now you have everything you need to try to get Gears to work in Prism. Just open the .xpi, edit install.rdf to include the snippet above (I had problems adding in the snippet, but it worked for me when I substituted it with the targetApplication that was already in the install.rds). Now the extension should be good to add to Prism.

Here is a copy of the Gears.xpi that I created (it is Linux and Prism only). This technique should work with most Firefox extensions, but don't be surprised if it doesn't.

For more information on the install.rds file, check out developer.mozilla.org/en/Install_Manifests To learn more about where Prism came from and where it is going, check out wiki.mozilla.org/Prism

11 comments:

Andrew said...

So I managed to add your great tutorial. Your gears xpi link is dead. Here's where I got mine http://dl.google.com/gears/current/gears-linux-opt.xpi.

Question. What's the indication that Google Gears is actually running with Prism?

Would appreciate a response. Thanks again for the tutorial.

Douglas Meyer said...

Thanks for letting me know about the link, I'll be sure to find a more reliable file host.
You should be able to see that Gears is working by clicking on the "gear" on the bottom right of a Prism window, then selecting "Tools" then "Add-ons" (the "gear" stands for settings, not Google Gears). You should then see that Google Gears is enabled and running.
Of course you can always go to Google Docs or Reader and try running it :-)

Andrew said...

Hi Douglas. Thank you very much for replying. I guess this is it. Proof of your guidance, http://flickr.com/photos/ajabogado/3216923330/. Thanks you thank you.

j_zhill said...

Thanks a lot for this.

Is there supposed to be a comment in the code? Specifically, should !- Prism - have two hyphens instead of one as per xml comment syntax? This tutorial worked for me only when I changed the inserted code accordingly.

InspiredHeart said...

Thanks for this info.
It seemed to work fine. Prism shows that gears is installed and enabled. I am on Ubuntu 8.10

BUT when I try to use gears (such as to enable offline support for gmail) a new prism window pops up with a message from Google saying that my browser version is not supported. Odd.

I shall hunt around for info on this issue. If you know a way around it, please post it here as it may be useful to other people following your instructions too.

Cheers,
Jonathan

InspiredHeart said...

Further to my last comment... it is almost as though Prism has multiple instances it calls up.
Gears is showing as installed on some Google Calendar (the one I had open when I installed gears) but not on Docs for instance. I have now installed it a second time, this time whilst using Docs. It is now installed there. But it's not showing up as installed when I am using the Gmail instance.
Looks like I need to find out more about how Prism works. I had assumed it used the same "thing" (what to call it) in the background for all app instances.

J

Douglas Meyer said...

j_zhill: Thanks for the update, I wonder how many people bailed when it didn't work for them. I'll be sure to make that change.

Jonathan: For me, installing in one Prism app worked for all Prism apps. It looks like Gears was installed in my ~/.prism/blablabla.default directory, you may be seeing something different if you have something like ~/.prism-gmail/ ? For the record, I used Synaptic Package Manager to install different Prism apps "prism-*"

Thanks for the comments! I may move this blog to a more customizable place. Any suggestions for a name? (I would like something more professional than "Brain Dump")

InspiredHeart said...

Thanks Douglas,
For some reason it has installed into my default prism profile folder also, but then I had to load it it into every other one aswell (like the /gmail and /gcalendar ones for instance).
I also installed them all through Synaptic.

Odd. I ended up manually making the various extension specific files and folders identical to one with Gears in it. They all have it now.

Although I notice that if I am in the Gmail prism window and I click on the google calendar link (for example) calendar will open in a new prism window and that one will not have gears installed. Arggghhhh... computers!

oroberos said...

Come on guys, here you get the right stuff:
http://dl.getdropbox.com/u/515248/Blog/MeinBlog/gears-linux-opt.xpi

Sanjaya Yogi said...

cd into your download directory:

wget http://dl.getdropbox.com/u/515248/Blog/MeinBlog/gears-linux-opt.xpi

Added from Prism > Tools > Addons > Install

Worked like a charm - working as I speak with Google Mail

I need to check it with Google Docs...

Wes said...

InspiredHeart: At some point in its development, Prism switched from using a single profile for all webapps to a separate profile for each. The separate profiles thing makes sense -- the whole idea is that each webapp gets to play in its own sandbox -- but it does make things like installing extensions more involved.

Also, the instructions in this post are no longer sufficient for the latest version of Gears, 0.5.30.0. The Gears extension now contains its own loader stub that detects which release of Firefox you're using and then chooses the appropriate module. (At least, that's what it does on OS X.) This loader fails when it gets Prism's version number (eg, 1.0) instead of the 3.0 or 3.5 that it expects... the result is that it looks like the Gears extension is installed, but anything that tries to use it can't detect it and claims that it isn't.

The workaround, to force it to pick the right module instead of throwing an exception, is quite simple... but a bit of an ugly hack: http://westacular.livejournal.com/43666.html