[Pkg-mozext-commits] [requestpolicy] 228/257: [imp] context menu entry to open RP's menu
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 88c26b5d51decad30a5d752b86f1b4ded01502ec
Author: Martin Kimmerle <dev at 256k.de>
Date: Sun Dec 20 18:01:33 2015 +0100
[imp] context menu entry to open RP's menu
Fixes #353
Other changes:
* `AUTHOR_SHEET` must be used instead of `USER_SHEET`
---
src/content/lib/default-preferences.js | 2 +-
src/content/main/window-manager.jsm | 6 +++---
src/content/ui/overlay.js | 29 +++++++++--------------------
src/content/ui/xul-trees.js | 9 +++++++++
src/skin/requestpolicy.css | 21 +++++++++++++++++++++
src/skin/toolbarbutton.css | 22 ----------------------
6 files changed, 43 insertions(+), 46 deletions(-)
diff --git a/src/content/lib/default-preferences.js b/src/content/lib/default-preferences.js
index 6f5b463..6cf8bb8 100644
--- a/src/content/lib/default-preferences.js
+++ b/src/content/lib/default-preferences.js
@@ -21,6 +21,7 @@ pref("extensions.requestpolicy.prefetch.link.restoreDefaultOnUninstall", true);
pref("extensions.requestpolicy.prefetch.dns.disableOnStartup", false);
pref("extensions.requestpolicy.prefetch.dns.restoreDefaultOnUninstall", true);
+pref("extensions.requestpolicy.contextMenu", true);
pref("extensions.requestpolicy.menu.sorting", "numRequests");
pref("extensions.requestpolicy.menu.info.showNumRequests", true);
@@ -35,6 +36,5 @@ pref("extensions.requestpolicy.unitTesting.errorCount", 0);
//pref("extensions.requestpolicy.allowedOrigins", "");
//pref("extensions.requestpolicy.allowedDestinations", "");
//pref("extensions.requestpolicy.allowedOriginsToDestinations", "");
-//pref("extensions.requestpolicy.contextMenu", true);
//pref("extensions.requestpolicy.statusbarIcon", "standard");
//pref("extensions.requestpolicy.initialSetupDialogShown", false);
diff --git a/src/content/main/window-manager.jsm b/src/content/main/window-manager.jsm
index 608a6ed..6778e52 100644
--- a/src/content/main/window-manager.jsm
+++ b/src/content/main/window-manager.jsm
@@ -189,7 +189,7 @@ var rpWindowManager = (function() {
for (let i = 0, len = styleSheets.length; i < len; i++) {
let styleSheetURI = Services.io.newURI(styleSheets[i], null, null);
styleSheetService.loadAndRegisterSheet(styleSheetURI,
- styleSheetService.USER_SHEET);
+ styleSheetService.AUTHOR_SHEET);
}
}
function unloadStyleSheets() {
@@ -200,9 +200,9 @@ var rpWindowManager = (function() {
for (let i = 0, len = styleSheets.length; i < len; i++) {
let styleSheetURI = Services.io.newURI(styleSheets[i], null, null);
if (styleSheetService.sheetRegistered(styleSheetURI,
- styleSheetService.USER_SHEET)) {
+ styleSheetService.AUTHOR_SHEET)) {
styleSheetService.unregisterSheet(styleSheetURI,
- styleSheetService.USER_SHEET);
+ styleSheetService.AUTHOR_SHEET);
}
}
}
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index b20811d..9965159 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -78,10 +78,6 @@ window.rpcontinued.overlay = (function() {
//let statusbar = null;
- // TODO: get back entry in context menu
- // https://github.com/RequestPolicyContinued/requestpolicy/issues/353
- //let rpContextMenu = null;
-
let toolbox = null;
let isFennec = false;
@@ -111,7 +107,6 @@ window.rpcontinued.overlay = (function() {
popupElement = $id("rpc-popup");
//statusbar = $id("status-bar");
- //rpContextMenu = $id("rpcontinuedContextMenu");
toolbox = $id("navigator-toolbox");
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
@@ -130,7 +125,7 @@ window.rpcontinued.overlay = (function() {
// object's observerBlockedRequests() method will be called.
RequestProcessor.addRequestObserver(self);
- //self.setContextMenuEnabled(rpPrefBranch.getBoolPref("contextMenu"));
+ setContextMenuEntryEnabled(rpPrefBranch.getBoolPref("contextMenu"));
OverlayEnvironment.shutdownOnUnload(window);
OverlayEnvironment.startup();
@@ -152,9 +147,10 @@ window.rpcontinued.overlay = (function() {
}
};
- //setContextMenuEnabled : function(isEnabled) {
- // rpContextMenu.setAttribute("hidden", !isEnabled);
- //},
+ function setContextMenuEntryEnabled(isEnabled) {
+ let contextMenuEntry = $id("rpcontinuedContextMenuEntry");
+ contextMenuEntry.setAttribute("hidden", !isEnabled);
+ }
OverlayEnvironment.addShutdownFunction(
Environment.LEVELS.INTERFACE,
@@ -208,10 +204,6 @@ window.rpcontinued.overlay = (function() {
addContextMenuListener);
function addTabContainerTabSelectListener() {
- // We consider the default place for the popup to be attached to the
- // context menu, so attach it there.
- //self._attachPopupToContextMenu();
-
// Listen for the user changing tab so we can update any notification or
// indication of blocked requests.
if (!isFennec) {
@@ -613,8 +605,10 @@ window.rpcontinued.overlay = (function() {
*/
self._setContentBlockedState = function(isContentBlocked) {
var button = $id(toolbarButtonId);
+ let contextMenuEntry = $id("rpcontinuedContextMenuEntry");
if (button) {
button.setAttribute("rpcontinuedBlocked", isContentBlocked);
+ contextMenuEntry.setAttribute("rpcontinuedBlocked", isContentBlocked);
}
};
@@ -623,9 +617,11 @@ window.rpcontinued.overlay = (function() {
*/
function updatePermissiveStatus() {
var button = $id(toolbarButtonId);
+ let contextMenuEntry = $id("rpcontinuedContextMenuEntry");
if (button) {
let isPermissive = Prefs.isBlockingDisabled();
button.setAttribute("rpcontinuedPermissive", isPermissive);
+ contextMenuEntry.setAttribute("rpcontinuedPermissive", isPermissive);
}
}
/**
@@ -718,7 +714,6 @@ window.rpcontinued.overlay = (function() {
*/
self._contextMenuOnPopupShowing = function() {
rpcontinued.overlay._wrapOpenLink();
- /*rpcontinued.overlay._attachPopupToContextMenu();*/
};
/**
@@ -937,12 +932,6 @@ window.rpcontinued.overlay = (function() {
}
}
self._needsReloadOnMenuClose = false;
- // if (event.currentTarget != event.originalTarget) {
- // return;
- // }
- // Leave the popup attached to the context menu, as we consider that the
- // default location for it.
- //self._attachPopupToContextMenu();
};
/**
diff --git a/src/content/ui/xul-trees.js b/src/content/ui/xul-trees.js
index 2325c30..87abde1 100644
--- a/src/content/ui/xul-trees.js
+++ b/src/content/ui/xul-trees.js
@@ -83,6 +83,15 @@ exports.mainTree = [
},
{
+ parent: {id: "contentAreaContextMenu"},
+
+ tag: "menuitem",
+ attributes: {id: "rpcontinuedContextMenuEntry",
+ label: "RequestPolicy Continued"},
+ events: {command: ["overlay", "openMenu"]}
+ },
+
+ {
parent: {special: {type: "__window__"}},
tag: "keyset",
diff --git a/src/skin/requestpolicy.css b/src/skin/requestpolicy.css
index 830813c..b0189da 100644
--- a/src/skin/requestpolicy.css
+++ b/src/skin/requestpolicy.css
@@ -268,6 +268,27 @@
}
/*********************************************
+ * Context menu entry
+ *********************************************/
+
+#rpcontinuedContextMenuEntry {
+ list-style-image:
+ url(chrome://rpcontinued/skin/requestpolicy-icon-allowed.png);
+}
+
+#rpcontinuedContextMenuEntry[rpcontinuedBlocked="true"] {
+ list-style-image:
+ url(chrome://rpcontinued/skin/requestpolicy-icon-blocked.png);
+ color: #a00;
+}
+
+#rpcontinuedContextMenuEntry[rpcontinuedPermissive="true"] {
+ list-style-image:
+ url(chrome://rpcontinued/skin/requestpolicy-icon-disabled.png);
+ color: #d07100;
+}
+
+/*********************************************
* Request Log
*********************************************/
#rpcontinued-requestLog-close {
diff --git a/src/skin/toolbarbutton.css b/src/skin/toolbarbutton.css
index de52509..87e2b0c 100644
--- a/src/skin/toolbarbutton.css
+++ b/src/skin/toolbarbutton.css
@@ -1,27 +1,5 @@
/*********************************************
- * Context menu
- *********************************************/
-/*
-#rpcontinuedContextMenu {
- list-style-image:
- url(chrome://rpcontinued/skin/requestpolicy-icon-allowed.png);
-}
-
-#rpcontinuedContextMenu[rpcontinuedBlocked="true"] {
- list-style-image:
- url(chrome://rpcontinued/skin/requestpolicy-icon-blocked.png);
- color: #a00;
-}
-
-#rpcontinuedContextMenu[rpcontinuedPermissive="true"] {
- list-style-image:
- url(chrome://rpcontinued/skin/requestpolicy-icon-disabled.png);
- color: #d07100;
-}
-*/
-
-/*********************************************
* ________________ Overview _________________
*
* The menu icon. To be distinguished:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list