[Pkg-mozext-commits] [perspectives-extension] 07/22: Pers_notify - Add new preference to show/hide notification box

David Prévot taffit at moszumanska.debian.org
Wed Feb 26 22:23:48 UTC 2014


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

taffit pushed a commit to branch debian
in repository perspectives-extension.

commit 5e48999c9223265ea26f314e49a8abf6b5ba1351
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Mon Feb 10 20:07:52 2014 -0700

    Pers_notify - Add new preference to show/hide notification box
    
    Not everyone may want to see this box every time.
    You can always us the 'Force query' method to send a query
---
 plugin/chrome/content/notify.js        | 110 +++++++++++++++++----------------
 plugin/chrome/locale/de/dialogs.dtd    |   2 +-
 plugin/chrome/locale/en-US/dialogs.dtd |   1 +
 plugin/chrome/locale/es-MX/dialogs.dtd |   1 +
 plugin/chrome/locale/fi/dialogs.dtd    |   1 +
 plugin/chrome/locale/fr/dialogs.dtd    |   1 +
 plugin/chrome/locale/nl/dialogs.dtd    |   1 +
 plugin/chrome/locale/zh-CN/dialogs.dtd |   1 +
 plugin/defaults/preferences/prefs.js   |   1 +
 9 files changed, 66 insertions(+), 53 deletions(-)

diff --git a/plugin/chrome/content/notify.js b/plugin/chrome/content/notify.js
index c342b5e..b483a76 100644
--- a/plugin/chrome/content/notify.js
+++ b/plugin/chrome/content/notify.js
@@ -127,65 +127,71 @@ var Pers_notify = {
 	// this is the drop down which is shown if preferences indicate
 	// that notaries should only be queried with user permission
 	notifyNeedsPermission: function(ti){
-		var priority = "PRIORITY_WARNING_HIGH";
-		var message = Perspectives.strbundle.getString("needsPermission");  
-		var buttons = null;
-		var buttons = [
-			{
-				label: Perspectives.strbundle.getString("yesContactNotaries"), 
-				accessKey : "", 
-				callback: function() {
-					try { 
-
-						//Happens on requeryAllTabs
-						try{
-							var notificationBox = ti.browser.getNotificationBox();
-							}
-						catch(e){
-							return;
-						}
-	
-						var nbox = ti.browser.getNotificationBox();
-						nbox.removeCurrentNotification();
-					} 
-					catch (err) {
-						// sometimes, this doesn't work.  why?
-						// well, we'll just have to remove them all
+
+		var show_box = Perspectives.root_prefs.
+			getBoolPref("extensions.perspectives.show_permission_reminder");
+
+		if (show_box){
+			var priority = "PRIORITY_WARNING_HIGH";
+			var message = Perspectives.strbundle.getString("needsPermission");
+			var buttons = null;
+			var buttons = [
+				{
+					label: Perspectives.strbundle.getString("yesContactNotaries"),
+					accessKey : "",
+					callback: function() {
 						try { 
-							nbox.removeAllNotifications();
-							Pers_debug.d_print("main", 
-									"successfully removed all notifications\n");
+
+							//Happens on requeryAllTabs
+							try{
+								var notificationBox = ti.browser.getNotificationBox();
+								}
+							catch(e){
+								return;
+							}
+
+							var nbox = ti.browser.getNotificationBox();
+							nbox.removeCurrentNotification();
 						} 
-						catch (err2) { 
+						catch (err) {
+							// sometimes, this doesn't work.  why?
+							// well, we'll just have to remove them all
+							try {
+								nbox.removeAllNotifications();
+								Pers_debug.d_print("main",
+										"successfully removed all notifications\n");
+							}
+							catch (err2) {
+								Pers_debug.d_print("error",
+										"probe_permission error2:" + err2 + "\n");
+							}
 							Pers_debug.d_print("error",
-									"probe_permission error2:" + err2 + "\n"); 
+									"probe_permission error1: " + err + "\n");
+						}
+						try {
+							// run probe
+							Pers_debug.d_print("main", "User gives probe permission\n");
+							ti.has_user_permission = true;
+								Pers_statusbar.setStatus(ti.uri, Pers_statusbar.STATE_QUERY,
+								Perspectives.strbundle.getFormattedString("contactingNotariesAbout",
+								 [ ti.uri.host ]));
+							Perspectives.updateStatus(window,false);
+						} catch (e) {
+							Pers_debug.d_print("main", "Error on UpdateStatus: " + e);
 						} 
-						Pers_debug.d_print("error",
-								"probe_permission error1: " + err + "\n"); 
 					}
-					try {  
-						// run probe
-						Pers_debug.d_print("main", "User gives probe permission\n"); 
-						ti.has_user_permission = true;
-        					Pers_statusbar.setStatus(ti.uri, Pers_statusbar.STATE_QUERY, 
-							Perspectives.strbundle.getFormattedString("contactingNotariesAbout",
-							 [ ti.uri.host ]));
-						Perspectives.updateStatus(window,false); 
-					} catch (e) { 
-						Pers_debug.d_print("main", "Error on UpdateStatus: " + e); 
+				},
+				{
+					label: Perspectives.strbundle.getString("learnMore"),
+					accessKey : "",
+					callback: function() {
+						ti.browser.loadOneTab("chrome://perspectives/content/help.xhtml",
+									 null, null, null, false);
 					} 
 				}
-			},
-			{ 
-				label: Perspectives.strbundle.getString("learnMore"),
-				accessKey : "", 
-				callback: function() {
-					ti.browser.loadOneTab("chrome://perspectives/content/help.xhtml",
-								 null, null, null, false);
-				} 
-			}
-		];
-   		this.notifyGeneric(ti.browser, priority, message, buttons);  
+			];
+			this.notifyGeneric(ti.browser, priority, message, buttons);
+		}
 	},
 
 	// this is the drop down which is shown if we receive no notary replies.  
diff --git a/plugin/chrome/locale/de/dialogs.dtd b/plugin/chrome/locale/de/dialogs.dtd
index 8af4665..d8d0a12 100644
--- a/plugin/chrome/locale/de/dialogs.dtd
+++ b/plugin/chrome/locale/de/dialogs.dtd
@@ -56,4 +56,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
-
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/chrome/locale/en-US/dialogs.dtd b/plugin/chrome/locale/en-US/dialogs.dtd
index c6f1649..4828d70 100755
--- a/plugin/chrome/locale/en-US/dialogs.dtd
+++ b/plugin/chrome/locale/en-US/dialogs.dtd
@@ -19,6 +19,7 @@
 <!ENTITY ContactNotariesforallHTTPSsites "Contact Notaries for all HTTPS sites">
 <!ENTITY ContactNotariesonlywhenawebsitescertificatecausesasecurityerror "Contact Notaries only when a website's certificate causes a security error">
 <!ENTITY AlwaysasktheuserbeforecontactingNotaries "Always ask before contacting Notaries">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
 <!ENTITY Certificates "Certificates">
 <!ENTITY Servers "Notary Servers">
 <!ENTITY Help "Help">
diff --git a/plugin/chrome/locale/es-MX/dialogs.dtd b/plugin/chrome/locale/es-MX/dialogs.dtd
index 68170b9..aaeb64f 100644
--- a/plugin/chrome/locale/es-MX/dialogs.dtd
+++ b/plugin/chrome/locale/es-MX/dialogs.dtd
@@ -56,3 +56,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/chrome/locale/fi/dialogs.dtd b/plugin/chrome/locale/fi/dialogs.dtd
index e98fa52..5ffc4ba 100644
--- a/plugin/chrome/locale/fi/dialogs.dtd
+++ b/plugin/chrome/locale/fi/dialogs.dtd
@@ -56,3 +56,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/chrome/locale/fr/dialogs.dtd b/plugin/chrome/locale/fr/dialogs.dtd
index e13b113..4c7ddb8 100644
--- a/plugin/chrome/locale/fr/dialogs.dtd
+++ b/plugin/chrome/locale/fr/dialogs.dtd
@@ -56,3 +56,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/chrome/locale/nl/dialogs.dtd b/plugin/chrome/locale/nl/dialogs.dtd
index c6f1649..ab1cffd 100644
--- a/plugin/chrome/locale/nl/dialogs.dtd
+++ b/plugin/chrome/locale/nl/dialogs.dtd
@@ -55,3 +55,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/chrome/locale/zh-CN/dialogs.dtd b/plugin/chrome/locale/zh-CN/dialogs.dtd
index 0c8cb9d..ea5f61b 100755
--- a/plugin/chrome/locale/zh-CN/dialogs.dtd
+++ b/plugin/chrome/locale/zh-CN/dialogs.dtd
@@ -56,3 +56,4 @@
 <!ENTITY TranslatorSubTitle "(listed alphabetically by locale code)">
 <!ENTITY TranslatorText "Many thanks to the following people who contributed translations">
 <!ENTITY ClickToVisitWebsite "Click to visit the Perspectives website">
+<!ENTITY DisplayPermissionReminder "Display a notification reminder">
diff --git a/plugin/defaults/preferences/prefs.js b/plugin/defaults/preferences/prefs.js
index c08443a..e6e2da0 100755
--- a/plugin/defaults/preferences/prefs.js
+++ b/plugin/defaults/preferences/prefs.js
@@ -5,6 +5,7 @@ pref("perspectives.exceptions.permanent", false);
 pref("perspectives.exceptions.enabled", true);
 pref("perspectives.check_good_certificates", true);
 pref("perspectives.require_user_permission", false);
+pref("extensions.perspectives.show_permission_reminder", true);
 pref("perspectives.show_label", true);
 pref("perspectives.svg", "");
 pref("perspectives.max_timespan_for_inconsistency_test", 7);

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



More information about the Pkg-mozext-commits mailing list