diff --git a/common/Makefile b/common/Makefile index 1dfa40db..e8e47fd6 100644 --- a/common/Makefile +++ b/common/Makefile @@ -24,7 +24,7 @@ JAR = chrome/$(NAME).jar XPI_BASES = $(JAR_BASES) $(TOP)/.. XPI_FILES = install.rdf TODO AUTHORS Donors NEWS License.txt -XPI_DIRS = modules components chrome +XPI_DIRS = modules components chrome defaults XPI_TEXTS = js jsm XPI_BINS = jar diff --git a/common/components/commandline-handler.js b/common/components/commandline-handler.js index 91dc31bb..0f4f386e 100644 --- a/common/components/commandline-handler.js +++ b/common/components/commandline-handler.js @@ -4,29 +4,34 @@ // given in the LICENSE.txt file included with this file. "use strict"; +const Ci = Components.interfaces, Cc = Components.classes; + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService) + .getBranch("extensions.dactyl."); +const appName = prefs.getComplexValue("appName", Ci.nsISupportsString).data; +const name = prefs.getComplexValue("name", Ci.nsISupportsString).data; + function CommandLineHandler() { this.wrappedJSObject = this; } CommandLineHandler.prototype = { - classDescription: "Dactyl Command-line Handler", + classDescription: appName + " Command-line Handler", classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"), - contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl", + contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=" + name, _xpcom_categories: [{ category: "command-line-handler", - entry: "m-dactyl" + entry: "m-" + name }], QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]), handle: function (commandLine) { - let name = Components.classes["@dactyl.googlecode.com/base/dactyl"] - .getService().wrappedJSObject.name; // TODO: handle remote launches differently? try { this.optionValue = commandLine.handleFlagWithParam(name, false); diff --git a/common/components/protocols.js b/common/components/protocols.js index 2edf08a5..68a4b8df 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -20,6 +20,8 @@ const NS_BINDING_ABORTED = 0x804b0002; const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler; const ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); +const prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService) + .getBranch("extensions.dactyl."); let channel = Components.classesByID["{61ba33c0-3031-11d3-8cd0-0060b0fc14a3}"] .getService(Ci.nsIProtocolHandler) @@ -88,7 +90,6 @@ ChromeData.prototype = { }; function Dactyl() { - Dactyl.prototype.__proto__ = Cc["@dactyl.googlecode.com/base/dactyl"].getService().wrappedJSObject; this.wrappedJSObject = this; this.HELP_TAGS = {}; @@ -111,6 +112,11 @@ Dactyl.prototype = { } }, + appName: prefs.getComplexValue("appName", Ci.nsISupportsString).data, + name: prefs.getComplexValue("name", Ci.nsISupportsString).data, + idName: prefs.getComplexValue("idName", Ci.nsISupportsString).data, + host: prefs.getComplexValue("host", Ci.nsISupportsString).data, + init: function (obj) { for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"]) { this[prop] = this[prop].constructor(); @@ -156,19 +162,15 @@ Dactyl.prototype = { return fakeChannel(uri); } }; -try { - Dactyl.prototype.__proto__ = Cc["@dactyl.googlecode.com/base/dactyl"].getService().wrappedJSObject; -} -catch (e) {} function AboutHandler() {} AboutHandler.prototype = { - classDescription: "About " + Dactyl.prototype.name + " Page", + classDescription: "About " + Dactyl.prototype.appName + " Page", classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"), - contractID: "@mozilla.org/network/protocol/about;1?what=" + Dactyl.prototype.appName, + contractID: "@mozilla.org/network/protocol/about;1?what=" + Dactyl.prototype.name, QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), diff --git a/common/content/about.xul b/common/content/about.xul new file mode 100644 index 00000000..ee257c00 --- /dev/null +++ b/common/content/about.xul @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 57836873..b8c95ef4 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1939,7 +1939,7 @@ const Dactyl = Module("dactyl", { dactyl.version = addon.version + " (created: @DATE@)"; }); - services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl"); + services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=" + config.name); let commandline = services.get("commandLineHandler").optionValue; if (commandline) { diff --git a/pentadactyl/TODO b/pentadactyl/TODO index 109df040..0325f9c0 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -23,7 +23,6 @@ BUGS: - the :help version-information page is no longer generated (recent Mercurial regressions): -9 about:pentadactyl is currently about:undefined FEATURES: 9 Add quoting help tag diff --git a/pentadactyl/chrome.manifest b/pentadactyl/chrome.manifest index e4a37883..9b2b3e0a 100644 --- a/pentadactyl/chrome.manifest +++ b/pentadactyl/chrome.manifest @@ -14,12 +14,9 @@ override chrome://dactyl/content/config.js chrome://pentadactyl/content/config overlay chrome://browser/content/browser.xul chrome://dactyl/content/dactyl.xul overlay chrome://browser/content/browser.xul chrome://pentadactyl/content/pentadactyl.xul -component {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} components/dactyl.js -contract @dactyl.googlecode.com/base/dactyl {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} - component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl +contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +category command-line-handler m-pentadactyl @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} diff --git a/pentadactyl/components/dactyl.js b/pentadactyl/components/dactyl.js deleted file mode 100644 index b4c5b421..00000000 --- a/pentadactyl/components/dactyl.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2008-2010 Kris Maglione -// -// This work is licensed for reuse under an MIT license. Details are -// given in the LICENSE.txt file included with this file. -"use strict"; - -const Ci = Components.interfaces, Cc = Components.classes; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - -function Dactyl() { - this.wrappedJSObject = this; -} -Dactyl.prototype = { - contractID: "@dactyl.googlecode.com/base/dactyl", - classID: Components.ID("{8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468}"), - - classDescription: "Dactyl component base definitions", - QueryInterface: XPCOMUtils.generateQI([]), - - appName: "Pentadactyl", - name: "pentadactyl", - idName: "PENTADACTYL", - host: "Firefox" -}; - -if (XPCOMUtils.generateNSGetFactory) - const NSGetFactory = XPCOMUtils.generateNSGetFactory([Dactyl]); -else - const NSGetModule = XPCOMUtils.generateNSGetModule([Dactyl]); - -// vim: set fdm=marker sw=4 ts=4 et: diff --git a/pentadactyl/defaults/preferences/dactyl.js b/pentadactyl/defaults/preferences/dactyl.js new file mode 100644 index 00000000..b2d69713 --- /dev/null +++ b/pentadactyl/defaults/preferences/dactyl.js @@ -0,0 +1,4 @@ +pref("extensions.dactyl.name", "pentadactyl"); +pref("extensions.dactyl.appName", "Pentadactyl"); +pref("extensions.dactyl.idName", "PENTADACTYL"); +pref("extensions.dactyl.host", "Firefox"); diff --git a/teledactyl/chrome.manifest b/teledactyl/chrome.manifest index f2f6b9dc..7842173f 100644 --- a/teledactyl/chrome.manifest +++ b/teledactyl/chrome.manifest @@ -16,12 +16,9 @@ overlay chrome://messenger/content/messenger.xul chrome://teledactyl/content/te overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/dactyl.xul overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/compose.xul -component {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} components/dactyl.js -contract @dactyl.googlecode.com/base/dactyl {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} - component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl +contract @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +category command-line-handler m-teledactyl @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} diff --git a/teledactyl/components/dactyl.js b/teledactyl/components/dactyl.js deleted file mode 100644 index ec6532ba..00000000 --- a/teledactyl/components/dactyl.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2008-2010 Kris Maglione -// -// This work is licensed for reuse under an MIT license. Details are -// given in the LICENSE.txt file included with this file. -"use strict"; - -const Ci = Components.interfaces, Cc = Components.classes; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - -function Dactyl() { - this.wrappedJSObject = this; -} -Dactyl.prototype = { - contractID: "@dactyl.googlecode.com/base/dactyl", - classID: Components.ID("{8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468}"), - - classDescription: "Dactyl component base definitions", - QueryInterface: XPCOMUtils.generateQI([]), - - appName: "Teledactyl", - name: "teledactyl", - idName: "TELEDACTYL", - host: "Thunderbird" -}; - -if (XPCOMUtils.generateNSGetFactory) - const NSGetFactory = XPCOMUtils.generateNSGetFactory([Dactyl]); -else - const NSGetModule = XPCOMUtils.generateNSGetModule([Dactyl]); - -// vim: set fdm=marker sw=4 ts=4 et: diff --git a/teledactyl/defaults/preferences/dactyl.js b/teledactyl/defaults/preferences/dactyl.js new file mode 100644 index 00000000..c54e4888 --- /dev/null +++ b/teledactyl/defaults/preferences/dactyl.js @@ -0,0 +1,4 @@ +pref("extensions.dactyl.name", "teledactyl"); +pref("extensions.dactyl.appName", "Teledactyl"); +pref("extensions.dactyl.idName", "TELEDACTYL"); +pref("extensions.dactyl.host", "Thunderbird"); diff --git a/xulmus/chrome.manifest b/xulmus/chrome.manifest index 7dd16f5a..3508fd0c 100644 --- a/xulmus/chrome.manifest +++ b/xulmus/chrome.manifest @@ -14,12 +14,9 @@ override chrome://dactyl/content/config.js chrome://xulmus/content/config.js overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://xulmus/content/xulmus.xul overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://dactyl/content/dactyl.xul -component {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} components/dactyl.js -contract @dactyl.googlecode.com/base/dactyl {8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468} - component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -contract @mozilla.org/commandlinehandler/general-startup;1?type=mus {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl +contract @mozilla.org/commandlinehandler/general-startup;1?type=xulmus {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +category command-line-handler m-xulmus @mozilla.org/commandlinehandler/general-startup;1?type=xulmus component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} diff --git a/xulmus/components/dactyl.js b/xulmus/components/dactyl.js deleted file mode 100644 index 82bfaf77..00000000 --- a/xulmus/components/dactyl.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2008-2010 Kris Maglione -// -// This work is licensed for reuse under an MIT license. Details are -// given in the LICENSE.txt file included with this file. -"use strict"; - -const Ci = Components.interfaces, Cc = Components.classes; - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - -function Dactyl() { - this.wrappedJSObject = this; -} -Dactyl.prototype = { - contractID: "@dactyl.googlecode.com/base/dactyl", - classID: Components.ID("{8e4a8e2f-95a0-4d8f-90ac-fc9d7d8f5468}"), - - classDescription: "Dactyl component base definitions", - QueryInterface: XPCOMUtils.generateQI([]), - - appName: "Xulmus", - name: "xulmus", - idName: "XULMUS", - host: "Songbird" -}; - -if (XPCOMUtils.generateNSGetFactory) - const NSGetFactory = XPCOMUtils.generateNSGetFactory([Dactyl]); -else - const NSGetModule = XPCOMUtils.generateNSGetModule([Dactyl]); - -// vim: set fdm=marker sw=4 ts=4 et: diff --git a/xulmus/defaults/preferences/dactyl.js b/xulmus/defaults/preferences/dactyl.js new file mode 100644 index 00000000..d00d5906 --- /dev/null +++ b/xulmus/defaults/preferences/dactyl.js @@ -0,0 +1,4 @@ +pref("extensions.dactyl.name", "xulmus"); +pref("extensions.dactyl.appName", "Xulmus"); +pref("extensions.dactyl.idName", "XULMUS"); +pref("extensions.dactyl.host", "Songbird");