From a53edafac1656d6e9c5c2d5a1052d19f58c96771 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 18 Sep 2010 07:24:35 -0400 Subject: [PATCH] Fix :version for non-XPI installs. Fix :extensions in FF 3.6. --- common/Makefile | 1 + common/components/protocols.js | 1 + common/content/dactyl.js | 20 ++++++++++++++------ pentadactyl/Makefile | 1 - pentadactyl/install.rdf | 2 +- teledactyl/Makefile | 3 +-- teledactyl/content/compose/dactyl.dtd | 4 ++++ teledactyl/content/dactyl.dtd | 4 ++++ teledactyl/install.rdf | 9 ++------- xulmus/Makefile | 1 - xulmus/content/dactyl.dtd | 3 +++ xulmus/install.rdf | 2 +- 12 files changed, 32 insertions(+), 19 deletions(-) diff --git a/common/Makefile b/common/Makefile index ccc3d450..3821f6c3 100644 --- a/common/Makefile +++ b/common/Makefile @@ -6,6 +6,7 @@ BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") BASE = $(TOP)/../common GOOGLE_PROJ = dactyl GOOGLE = https://$(GOOGLE_PROJ).googlecode.com/files +VERSION = $(shell sed -n 's/.*\(.*\)<.*/\1/p' $(TOP)/install.rdf) LOCALEDIR = locale DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml) diff --git a/common/components/protocols.js b/common/components/protocols.js index 1afa24fc..db043541 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -114,6 +114,7 @@ function Dactyl() { this.HELP_TAGS = {}; this.FILE_MAP = {}; this.OVERLAY_MAP = {}; + this.addonID = this.name + "@dactyl.googlecode.com"; } Dactyl.prototype = { contractID: "@mozilla.org/network/protocol;1?name=dactyl", diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 5d8e040f..66f58e6f 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -72,7 +72,7 @@ const Dactyl = Module("dactyl", { forceNewWindow: false, /** @property {string} The Dactyl version string. */ - version: "@VERSION@ (created: @DATE@)", // these VERSION and DATE tokens are replaced by the Makefile + version: null, /** * @property {Object} The map of command-line options. These are @@ -1421,12 +1421,14 @@ const Dactyl = Module("dactyl", { if (typeof AddonManager == "undefined") modules.AddonManager = { - getAddonById: function (id, callback) { + getAddonByID: function (id, callback) { + callback = callback || util.identity; let addon = id; if (!isobject(addon)) addon = services.get("extensionManager").getItemForID(id); if (!addon) return callback(null); + addon = Object.create(addon); function getRdfProperty(item, property) { let resource = services.get("rdf").GetResource("urn:mozilla:item:" + item.id); @@ -1444,7 +1446,7 @@ const Dactyl = Module("dactyl", { ["aboutURL", "creator", "description", "developers", "homepageURL", "iconURL", "installDate", "name", - "optionsURL", "releaseNotesURI", "updateDate"].forEach(function (item) { + "optionsURL", "releaseNotesURI", "updateDate", "version"].forEach(function (item) { addon[item] = getRdfProperty(addon, item); }); addon.isActive = getRdfProperty(addon, "isDisabled") != "true"; @@ -1453,7 +1455,7 @@ const Dactyl = Module("dactyl", { services.get("extensionManager").uninstallItem(this.id); }; addon.appDisabled = false; - addon.__defineGetter("userDisabled", function() getRdfProperty("userDisabled") == "true"); + addon.__defineGetter__("userDisabled", function() getRdfProperty("userDisabled") == "true"); addon.__defineSetter__("userDisabled", function(val) { services.get("extensionManager")[val ? "enableItem" : "disableItem"](this.id); }); @@ -1465,8 +1467,8 @@ const Dactyl = Module("dactyl", { for (let [,type] in Iterator(types)) for (let [,item] in Iterator(services.get("extensionManager") .getItemList(Ci.nsIUpdateItem["TYPE_" + type.toUpperCase()], {}))) - res.append(this.getAddonById(item)); - return res; + res.push(this.getAddonByID(item)); + callback(res); }, getInstallForFile: function (file, callback, mimetype) { callback({ @@ -1975,6 +1977,12 @@ const Dactyl = Module("dactyl", { dactyl.log("All modules loaded", 3); + AddonManager.getAddonByID(services.get("dactyl:").addonID, function (addon) { + // @DATE@ token replaced by the Makefile + // TODO: Find it automatically + dactyl.version = addon.version + " (created: @DATE@)"; + }); + services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=" + config.name); let commandline = services.get("commandLineHandler").optionValue; diff --git a/pentadactyl/Makefile b/pentadactyl/Makefile index 71d2f47f..ad5bdb81 100644 --- a/pentadactyl/Makefile +++ b/pentadactyl/Makefile @@ -1,6 +1,5 @@ #### configuration -VERSION = 1.0pre NAME = pentadactyl include ../common/Makefile diff --git a/pentadactyl/install.rdf b/pentadactyl/install.rdf index 1c72f7ed..1324f9a1 100644 --- a/pentadactyl/install.rdf +++ b/pentadactyl/install.rdf @@ -4,7 +4,7 @@ pentadactyl@dactyl.googlecode.com Pentadactyl - @VERSION@ + 1.0b1pre Firefox for Vim and Links addicts Kris Maglione http://dactyl.sf.net/Pentadactyl diff --git a/teledactyl/Makefile b/teledactyl/Makefile index a747f8f2..e26e3a94 100644 --- a/teledactyl/Makefile +++ b/teledactyl/Makefile @@ -1,6 +1,5 @@ #### configuration -VERSION = 0.6a1pre -NAME = muttator +NAME = teledactyl include ../common/Makefile diff --git a/teledactyl/content/compose/dactyl.dtd b/teledactyl/content/compose/dactyl.dtd index c92f0174..f271bff9 100644 --- a/teledactyl/content/compose/dactyl.dtd +++ b/teledactyl/content/compose/dactyl.dtd @@ -2,3 +2,7 @@ + + + + diff --git a/teledactyl/content/dactyl.dtd b/teledactyl/content/dactyl.dtd index e4211b7c..255be5fb 100644 --- a/teledactyl/content/dactyl.dtd +++ b/teledactyl/content/dactyl.dtd @@ -11,3 +11,7 @@ + + + + diff --git a/teledactyl/install.rdf b/teledactyl/install.rdf index f0a5dc6d..0ee64eac 100644 --- a/teledactyl/install.rdf +++ b/teledactyl/install.rdf @@ -4,17 +4,12 @@ teledactyl@dactyl.googlecode.com Teledactyl - ###VERSION### + 0.5b1pre Thunderbird for Mutt and Vim addicts Kris Maglione http://dactyl.sf.net/Teledactyl - chrome://muttator/skin/icon.png + chrome://teledactyl/skin/icon.png chrome://dactyl/content/preferences.xul - - - content/teledactyl/ - - {3550f703-e582-4d05-9a08-453d09bdfdc6} diff --git a/xulmus/Makefile b/xulmus/Makefile index 9f5cc05b..fac1f1b6 100644 --- a/xulmus/Makefile +++ b/xulmus/Makefile @@ -1,6 +1,5 @@ #### configuration -VERSION = 0.2a1pre NAME = xulmus include ../common/Makefile diff --git a/xulmus/content/dactyl.dtd b/xulmus/content/dactyl.dtd index efafb532..3ff03063 100644 --- a/xulmus/content/dactyl.dtd +++ b/xulmus/content/dactyl.dtd @@ -11,3 +11,6 @@ + + + diff --git a/xulmus/install.rdf b/xulmus/install.rdf index c9557160..549c818b 100644 --- a/xulmus/install.rdf +++ b/xulmus/install.rdf @@ -6,7 +6,7 @@ xulmus@vimperator.org 2 Xulmus - ###VERSION### + 0.2a1pre Makes Songbird behave like Vim and CMus. Prathyush Thota http://vimperator.org