Ah, very slick. :) Thanks Gary.

> For what it's worth this is my solution to the upcoming 0.5  
> release.  It's certainly not elegant, but it works, and it means I  
> don't have the hassle of managing two versions of the commands  
> whilst people migrate.
>
> var isParser2 = function(){
>       var prefs = Components.classes["@mozilla.org/preferences-service; 
> 1"].getService(Components.interfaces.nsIPrefService);
>       var branch = prefs.getBranch("extensions.ubiquity.");   
>       return (branch.getPrefType("parserVersion") != 0) ?  
> branch.getIntPref("parserVersion") == 2 : false;
> }
>
> if (isParser2()) {            
>       /* Parser 2 version of the CmdUtils.CreateCommand calls here */
>       /* ... */
> } else {
>       /* Parser 1 version of the CmdUtils.CreateCommand calls here */
>       /* ... */
> }
>
> (Full code is here: 
> http://github.com/garyhodgson/ubiquity-rtm-api/blob/7299e60eab828fa89d76ce3c927faa1ad4064a23/ubiquity-rtm-api.js)
>
> Hope it helps.
>
> Gary
>
>
>
>
> 2009/7/7 earth2marsh <[email protected]>
>
> > For the time being, I don't think there's anything we can really
> > particularly do on the command feed-side
>
> What about adding an @ rule, like "@branch 0.1" in a commented section
> preceding any code (a la greasemonkey scripts). Perhaps a second
> commented @branch rule could then denote code for 0.5 without having
> to have multiple URLs for the same command? It's not terribly elegant,
> but it might suffice. You could require this for 0.5 and beyond, and
> if no @branch is found, assume it's pre-0.5.
>
> Or considering that extension XPI's have a space for version
> compatibility—couldn't we borrow their model?
>
> > This tutorial will walk through the conversion process
> > (hopefully in an easy to understand fashion). And if it's not easy  
> to
> > understand, please let us know! I'd love to get some feedback on it.
>
> I used that guide when converting my simpler commands, in preparation
> for migrating the more complicated chart ones here:
> http://earth2marsh.com/ubiquity/charts.html
>
> When I get some free cycles, I'll update those commands and make note
> of anything confusing in the tutorial.
>
> Marsh
>
>
>
> >

--
mitcho (Michael 芳貴 Erlewine)
[email protected]
http://mitcho.com/
linguist, coder, teacher


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to