[Pkg-mozext-commits] [adblock-plus] 369/464: Allow specifying default icon and popup for browser actions, make the handling identical to page actions

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:34 UTC 2014


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

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

commit cd6cbb43a9110b46ebce4e10c55f6bb6413d65e2
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Feb 22 15:19:16 2013 +0100

    Allow specifying default icon and popup for browser actions, make the handling identical to page actions
---
 manifest.json.tmpl | 16 ++++++++++++----
 packagerChrome.py  | 12 +++++++++++-
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/manifest.json.tmpl b/manifest.json.tmpl
index adf0c55..0932041 100644
--- a/manifest.json.tmpl
+++ b/manifest.json.tmpl
@@ -40,13 +40,21 @@
   {%- if pageAction %}
   "page_action": {
     "default_icon": {{pageAction.icon|json}},
-    "default_title": "__MSG_name__",
-    "default_popup": {{pageAction.popup|json}}
+    {%- if pageAction.popup %}
+    "default_popup": {{pageAction.popup|json}},
+    {%- endif %}
+    "default_title": "__MSG_name__"
   },
   {%- endif %}
 
-  {%- if metadata.has_option('general', 'browserAction') and metadata.get('general', 'browserAction') != '' %}
-  "browser_action": {},
+  {%- if browserAction %}
+  "browser_action": {
+    "default_icon": {{browserAction.icon|json}},
+    {%- if browserAction.popup %}
+    "default_popup": {{browserAction.popup|json}},
+    {%- endif %}
+    "default_title": "__MSG_name__"
+  },
   {%- endif %}
 
   {%- if icons %}
diff --git a/packagerChrome.py b/packagerChrome.py
index 66bf840..60cf62a 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -57,9 +57,19 @@ def createManifest(params):
   metadata = templateData['metadata']
 
   if metadata.has_option('general', 'pageAction') and metadata.get('general', 'pageAction') != '':
-    icon, popup = re.split(r'\s+', metadata.get('general', 'pageAction'), 1)
+    if re.search(r'\s+', metadata.get('general', 'pageAction')):
+      icon, popup = re.split(r'\s+', metadata.get('general', 'pageAction'), 1)
+    else:
+      icon, popup = (metadata.get('general', 'pageAction'), None)
     templateData['pageAction'] = {'icon': icon, 'popup': popup}
 
+  if metadata.has_option('general', 'browserAction') and metadata.get('general', 'browserAction') != '':
+    if re.search(r'\s+', metadata.get('general', 'browserAction')):
+      icon, popup = re.split(r'\s+', metadata.get('general', 'browserAction'), 1)
+    else:
+      icon, popup = (metadata.get('general', 'browserAction'), None)
+    templateData['browserAction'] = {'icon': icon, 'popup': popup}
+
   if metadata.has_option('general', 'icons'):
     icons = {}
     iconsDir = baseDir

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



More information about the Pkg-mozext-commits mailing list