1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-11 15:25:47 +01:00

Fix about:pentadactyl = about:undefined in Gecko<2.0.

This commit is contained in:
Kris Maglione
2010-09-28 14:04:11 -04:00
parent 85a5e15fc6
commit afc2eac676
15 changed files with 70 additions and 126 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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]),

31
common/content/about.xul Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://pentadactyl/skin/about.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://dactyl/content/dactyl.dtd">
<page id="about-&dactyl.name;" orient="vertical"
xmlns="&xmlns.xul;" xmlns:html="&xmlns.html;">
<html:link rel="icon" href="chrome://&dactyl.name;/skin/icon.png"
type="image/png" style="display: none;"/>
<spring flex="1"/>
<hbox>
<spring flex="1"/>
<div xmlns="&xmlns.html;" style="text-align: center" id="text-container">
<img src="chrome://&dactyl.name;/content/logo.png" alt="&dactyl.appName;" />
version ###VERSION###
by Kris Maglione, Doug Kearns, et al.
&dactyl.appName; is open source and freely distributable
type :q&lt;<span class="key">Enter</span>> to exit <!---->
type :help&lt;<span class="key">Enter</span>> or &lt;<span class="key">F1</span>> for on-line help
type :help version-&dactyl.version;&lt;<span class="key">Enter</span>> for version info
</div>
<spring flex="1"/>
</hbox>
<spring flex="1"/>
</page>
<!-- vim: set sw=2 sts=2 et: -->

View File

@@ -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) {