From ac457d17fae0af13b6bcbca84149d4c7a4f1ebed Mon Sep 17 00:00:00 2001 From: "ben%bengoodger.com" Date: Tue, 11 May 2004 05:09:57 +0000 Subject: [PATCH] 170006 - theme switching --- browser/app/profile/extensions/Makefile.in | 7 +- .../Makefile.in | 35 +++ .../install.rdf | 0 .../Makefile.in | 35 +++ .../install.rdf | 4 + browser/app/profile/firefox.js | 2 + browser/base/skin/Makefile.in | 2 - browser/base/skin/jar.mn | 3 +- browser/extensions/inspector/Makefile.in | 2 - .../inspector/content/inspector.gif | Bin 0 -> 203 bytes browser/extensions/inspector/jar.mn | 1 + .../mozapps/extensions/content/extensions.css | 9 + .../mozapps/extensions/content/extensions.js | 79 ++++++- .../mozapps/extensions/content/extensions.xml | 24 ++ .../mozapps/extensions/content/extensions.xul | 177 ++++++++------ .../mozapps/extensions/locale/extensions.dtd | 11 +- .../extensions/locale/extensions.properties | 2 + .../mozapps/extensions/skin/extensions.css | 21 ++ .../mozapps/extensions/skin/themeGeneric.png | Bin 0 -> 2194 bytes .../extensions/src/nsExtensionManager.js.in | 215 ++++++++++++++---- toolkit/mozapps/jar.mn | 3 +- .../update/src/nsBackgroundUpdateService.js | 6 +- 22 files changed, 508 insertions(+), 130 deletions(-) create mode 100644 browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/Makefile.in rename browser/{extensions/inspector => app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}}/install.rdf (100%) create mode 100644 browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in rename browser/{base/skin => app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}}/install.rdf (83%) create mode 100644 browser/extensions/inspector/content/inspector.gif create mode 100644 toolkit/mozapps/extensions/skin/themeGeneric.png diff --git a/browser/app/profile/extensions/Makefile.in b/browser/app/profile/extensions/Makefile.in index 4068a4061257..7d6f58c4001f 100644 --- a/browser/app/profile/extensions/Makefile.in +++ b/browser/app/profile/extensions/Makefile.in @@ -20,6 +20,9 @@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk + +DIRS = {641d8d09-7dda-4850-8228-ac0ab65e2ac9} {972ce4c6-7e08-4474-a285-3208198ce6fd} + include $(topsrcdir)/config/rules.mk FILES := \ @@ -30,8 +33,8 @@ FILES := $(addprefix $(srcdir)/, $(FILES)) libs:: $(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions - $(INSTALL) $(srcdir)/"installed-extensions.txt" $(DIST)/bin/Extensions + $(INSTALL) $(srcdir)/"installed-extensions.txt" $(DIST)/bin/defaults/profile/extensions install:: $(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions - $(SYSINSTALL) $(IFLAGS1) $(srcdir)/"installed-extensions.txt" $(DESTDIR)$(mozappdir)/Extensions + $(SYSINSTALL) $(IFLAGS1) $(srcdir)/"installed-extensions.txt" $(DESTDIR)$(mozappdir)/defaults/profile/extensions diff --git a/browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/Makefile.in b/browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/Makefile.in new file mode 100644 index 000000000000..9fd7d23567a1 --- /dev/null +++ b/browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/Makefile.in @@ -0,0 +1,35 @@ +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# Contributor(s): +# + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +FILES := \ + install.rdf \ + $(NULL) + +FILES := $(addprefix $(srcdir)/, $(FILES)) + +libs:: + $(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9} + +install:: + $(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9} diff --git a/browser/extensions/inspector/install.rdf b/browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/install.rdf similarity index 100% rename from browser/extensions/inspector/install.rdf rename to browser/app/profile/extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9}/install.rdf diff --git a/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in new file mode 100644 index 000000000000..d740333a1d0a --- /dev/null +++ b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in @@ -0,0 +1,35 @@ +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# Contributor(s): +# + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +FILES := \ + install.rdf \ + $(NULL) + +FILES := $(addprefix $(srcdir)/, $(FILES)) + +libs:: + $(INSTALL) $(FILES) $(DIST)/bin/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} + +install:: + $(SYSINSTALL) $(IFLAGS1) $(FILES) $(DESTDIR)$(mozappdir)/defaults/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} diff --git a/browser/base/skin/install.rdf b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf similarity index 83% rename from browser/base/skin/install.rdf rename to browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf index e484918c794d..ad133131ebd1 100644 --- a/browser/base/skin/install.rdf +++ b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf @@ -18,6 +18,10 @@ true + Arvid Axelsson + Mozilla Contributors + + classic/1.0 diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 308b38af67b0..0fadc36a1b4b 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -62,6 +62,8 @@ pref("update.app.updateDescription", ""); pref("update.app.updateURL", ""); pref("update.extensions.enabled", true); pref("update.extensions.wsdl", "chrome://mozapps/locale/extensions/extensions.properties"); +pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties"); +pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties"); // Automatically download and install updates to themes and extensions. pref("update.extensions.autoUpdate", false); diff --git a/browser/base/skin/Makefile.in b/browser/base/skin/Makefile.in index 0f01e13f6337..9171566a45c1 100644 --- a/browser/base/skin/Makefile.in +++ b/browser/base/skin/Makefile.in @@ -28,5 +28,3 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -libs:: - $(INSTALL) $(srcdir)/install.rdf $(DIST)/bin/Extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} diff --git a/browser/base/skin/jar.mn b/browser/base/skin/jar.mn index 0ab69a010e29..573485aa0896 100644 --- a/browser/base/skin/jar.mn +++ b/browser/base/skin/jar.mn @@ -18,5 +18,4 @@ classic.jar: skin/classic/browser/Throbber-small.png skin/classic/browser/Throbber-small.gif skin/classic/browser/Toolbar-small.png - skin/classic/browser/Toolbar.png - install.rdf \ No newline at end of file + skin/classic/browser/Toolbar.png \ No newline at end of file diff --git a/browser/extensions/inspector/Makefile.in b/browser/extensions/inspector/Makefile.in index 9341caac165e..e07fb7c964bd 100644 --- a/browser/extensions/inspector/Makefile.in +++ b/browser/extensions/inspector/Makefile.in @@ -28,5 +28,3 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk -libs:: - $(INSTALL) $(srcdir)/install.rdf $(DIST)/bin/Extensions/{641d8d09-7dda-4850-8228-ac0ab65e2ac9} diff --git a/browser/extensions/inspector/content/inspector.gif b/browser/extensions/inspector/content/inspector.gif new file mode 100644 index 0000000000000000000000000000000000000000..29e0bef3e229f30a0bd433a9611999541c20dfea GIT binary patch literal 203 zcmZ?wbhEHbRA5kGSj52ae>21X9)|y=4F4HG;QxOJ&7k;`g^_`Ql|ct23R26!Ji%kv zoqqR4{~Y$(MDs51V;niBr-{X^&C_Py9`wFx(J~3y^G~^%(pw&G=ty}q z>C{|dwH_hP1&=RB&CXhV%Hct4Z|%ZBL(A7sS5-evtI4jdo_k_$gpI_5`Sl4p)r_@` zQAOUoImMked_5}sMXu&OiW3@o<)sDZ%n_PDUwx6r%%zj2t(Y#ncHR1QoD9|gnnzG= literal 0 HcmV?d00001 diff --git a/browser/extensions/inspector/jar.mn b/browser/extensions/inspector/jar.mn index 6a48ff2c6c2d..a7b50949f82b 100644 --- a/browser/extensions/inspector/jar.mn +++ b/browser/extensions/inspector/jar.mn @@ -3,3 +3,4 @@ inspector.jar: + content/inspector/tasksOverlay.xul (content/tasksOverlay.xul) *+ locale/en-US/inspector/contents.rdf (locale/contents.rdf) + locale/en-US/inspector/tasksOverlay.dtd (locale/tasksOverlay.dtd) ++ inspector.gif (content/inspector.gif) \ No newline at end of file diff --git a/toolkit/mozapps/extensions/content/extensions.css b/toolkit/mozapps/extensions/content/extensions.css index 349c7f1435c9..7f5c6008107c 100644 --- a/toolkit/mozapps/extensions/content/extensions.css +++ b/toolkit/mozapps/extensions/content/extensions.css @@ -1,5 +1,6 @@ view { -moz-binding: url("chrome://mozapps/skin/shared/richview.xml#richview"); + width: 20em; } extension { @@ -35,3 +36,11 @@ extension[toBeUninstalled="true"] { -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobeuninstalled"); } +extension[itemType="theme"] { + -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme"); +} + +.themePreviewArea { + width: 0px; +} + diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 5498cc6186c8..dc98475f73d7 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -10,8 +10,12 @@ var gExtensionssView = null; var gWindowState = ""; var gURIPrefix = ""; // extension or theme prefix var gDSRoot = ""; // extension or theme root +var gGetMoreURL = ""; -const PREF_EM_EXTENSIONS_DISABLED = "extensions.safeMode"; +const PREF_APP_ID = "app.id"; +const PREF_EXTENSIONS_GETMORETHEMESURL = "extensions.getMoreThemesURL"; +const PREF_EXTENSIONS_GETMOREEXTENSIONSURL = "extensions.getMoreExtensionsURL"; +const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin"; /////////////////////////////////////////////////////////////////////////////// // Utility Functions @@ -60,8 +64,9 @@ function onExtensionSelect(aEvent) function Startup() { gWindowState = window.arguments[0]; - gURIPrefix = gWindowState == "extensions" ? "urn:mozilla:extension:" : "urn:mozilla:theme:"; - gDSRoot = gWindowState == "extensions" ? "urn:mozilla:extension:root" : "urn:mozilla:theme:root"; + var isExtensions = gWindowState == "extensions"; + gURIPrefix = isExtensions ? "urn:mozilla:extension:" : "urn:mozilla:theme:"; + gDSRoot = isExtensions ? "urn:mozilla:extension:root" : "urn:mozilla:theme:root"; document.documentElement.setAttribute("windowtype", document.documentElement.getAttribute("windowtype") + "-" + gWindowState); @@ -94,10 +99,78 @@ function Startup() document.documentElement.setAttribute("title", extensionsStrings.getString(gWindowState + "Title")); gExtensionsViewController.onCommandUpdate(); + + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + gGetMoreURL = pref.getComplexValue(isExtensions ? PREF_EXTENSIONS_GETMOREEXTENSIONSURL + : PREF_EXTENSIONS_GETMORETHEMESURL, + Components.interfaces.nsIPrefLocalizedString).data; + gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, pref.getCharPref(PREF_APP_ID)); + // Update various pieces of state-dependant UI + var getMore = document.getElementById("getMore"); + getMore.setAttribute("value", getMore.getAttribute(isExtensions ? "valueextensions" : "valuethemes")); + getMore.setAttribute("tooltiptext", getMore.getAttribute(isExtensions ? "tooltiptextextensions" : "tooltiptextthemes")); + + if (!isExtensions) { + var themePreviewArea = document.getElementById("themePreviewArea"); + themePreviewArea.hidden = false; + gExtensionsView.removeAttribute("flex"); + + var win = document.documentElement; + if (!win.hasAttribute("width") || !win.hasAttribute("height")) { + win.setAttribute("width", 500); + win.setAttribute("width", 380); + + gExtensionsView.addEventListener("richview-select", onThemeSelect, false); + } + } } function Shutdown() { + if (gWindowState != "extensions") + gExtensionsView.removeEventListener("richview-select", onThemeSelect, false); +} + +function onViewDoubleClick() +{ + switch (gWindowState) { + case "extensions": + gExtensionsViewController.doCommand('cmd_options'); + break; + case "themes": + if (!gExtensionsView.selected) + return; + var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] + .getService(Components.interfaces.nsIXULChromeRegistry); + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + var internalName = gExtensionsView.selected.getAttribute("internalName"); + var inUse = cr.isSkinSelected(internalName, true); + if (inUse == Components.interfaces.nsIChromeRegistry.FULL) + return; + + pref.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, internalName); + cr.selectSkin(internalName, true); + cr.refreshSkins(); + break; + } +} + +function onThemeSelect(aEvent) +{ + var previewImageDeck = document.getElementById("previewImageDeck"); + if (!gExtensionsView.selected) { + previewImageDeck.setAttribute("index", "0"); + return; + } + var url = gExtensionsView.selected.getAttribute("previewImage"); + if (url) { + previewImageDeck.setAttribute("index", "2"); + previewImage.setAttribute("src", url); + } + else + previewImageDeck.setAttribute("index", "1"); } /////////////////////////////////////////////////////////////////////////////// diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index 7ead4888dfea..b6df8861698c 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -189,5 +189,29 @@ + + + + + + + + + + + + + + + + + + + + "extension-" + + + diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index a8ab19735abd..c046c7ff0ec6 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -118,79 +118,106 @@ - - - + + + + + + - +