[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 268/483: About dialog: Show localized extension name and homepage

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.

commit 1315cff7ff01cedccb7dd595025b43c5e77950b6
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed Oct 27 12:20:40 2010 +0200

    About dialog: Show localized extension name and homepage
---
 chrome/content/about.js | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/chrome/content/about.js b/chrome/content/about.js
index ac19142..2363e25 100644
--- a/chrome/content/about.js
+++ b/chrome/content/about.js
@@ -44,19 +44,36 @@ function init()
   {
     let addon = AddonManager.getAddonByID(addonID, function(addon)
     {
-      loadInstallManifest(addon.getResourceURI("install.rdf"));
+      loadInstallManifest(addon.getResourceURI("install.rdf"), addon.name, addon.homepageURL);
     });
   }
   else
   {
     let extensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
+    let rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
+    let root = rdf.GetResource("urn:mozilla:item:" + addonID);
+
+    function emResource(prop)
+    {
+      return rdf.GetResource("http://www.mozilla.org/2004/em-rdf#" + prop);
+    }
+  
+    function getTarget(prop)
+    {
+      let target = extensionManager.datasource.GetTarget(root, emResource(prop), true);
+      if (target)
+        return target.QueryInterface(Ci.nsIRDFLiteral).Value;
+      else
+        return null;
+    }
+    
     let installLocation = extensionManager.getInstallLocation(addonID);
     let installManifestFile = installLocation.getItemFile(addonID, "install.rdf");
-    loadInstallManifest(ioService.newFileURI(installManifestFile));
+    loadInstallManifest(ioService.newFileURI(installManifestFile), getTarget("name"), getTarget("homepageURL"));
   }
 }
 
-function loadInstallManifest(installManifestURI)
+function loadInstallManifest(installManifestURI, name, homepage)
 {
   let rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
   let ds = rdf.GetDataSource(installManifestURI.spec);
@@ -78,8 +95,8 @@ function loadInstallManifest(installManifestURI)
 
   function dataSourceLoaded()
   {
-    setExtensionData(getTargets("name")[0], getTargets("version")[0],
-                     getTargets("homepageURL")[0], getTargets("creator"),
+    setExtensionData(name, getTargets("version")[0],
+                     homepage, getTargets("creator"),
                      getTargets("contributor"), getTargets("translator"));
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git



More information about the Pkg-mozext-commits mailing list