[Pkg-mozext-commits] [firetray] 27/399: attempt to stabilize options' behaviour ('close_hides' for now)
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:08 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch dfsg-clean
in repository firetray.
commit 18e555d10d6d4de88b9a7fc7f40ac2747462f782
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sat Aug 27 21:48:56 2011 +0200
attempt to stabilize options' behaviour ('close_hides' for now)
Damn js refs ! Anyway, almost there... still have to get around the "about
closing multiple tabs"
---
src/chrome/content/options.js | 10 ++++++--
src/chrome/content/overlay.js | 48 ++++++++++++++++++++++++-------------
src/defaults/preferences/prefs.js | 4 ----
3 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index e17fe80..e2edaa2 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -5,9 +5,15 @@ Components.utils.import("resource://moztray/commons.js");
const Cc = Components.classes;
const Ci = Components.interfaces;
+/**
+ * mozt namespace.
+ */
+if ("undefined" == typeof(mozt)) {
+ var mozt = {};
+};
+
mozt.UIOptions = {
- onLoad: function() {
- },
+ onLoad: function() {}
};
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 4b90288..7ff8979 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -3,6 +3,13 @@
Components.utils.import("resource://moztray/commons.js");
Components.utils.import("resource://moztray/MoztHandler.jsm");
+/**
+ * mozt namespace.
+ */
+if ("undefined" == typeof(mozt)) {
+ var mozt = {};
+};
+
mozt.Main = {
onLoad: function(e) {
@@ -12,29 +19,31 @@ mozt.Main = {
try {
// Set up preference change observer
mozt.Utils.prefService.QueryInterface(Ci.nsIPrefBranch2);
- mozt.Utils.prefService.addObserver("", this, false);
+ let that = this;
+ mozt.Utils.prefService.addObserver("", that, false);
}
catch (ex) {
Components.utils.reportError(ex);
return false;
}
- if (!mozt.Handler.initialized)
- var initOK = mozt.Handler.init();
+ let init = mozt.Handler.initialized || mozt.Handler.init();
// prevent window closing.
- if (mozt.Utils.prefService.getBoolPref('close_hides'))
- window.addEventListener(
- 'close', function(event){mozt.Main.onClose(event);}, true);
+ if (mozt.Utils.prefService.getBoolPref('close_hides')) {
+ mozt.Debug.debug('close_hides set');
+ let that = this;
+ window.addEventListener('close', that.onClose, true);
+ }
- mozt.Debug.debug('Moztray LOADED: ' + initOK);
+ mozt.Debug.debug('Moztray LOADED: ' + init);
return true;
},
onQuit: function(e) {
// Remove observer
- mozt.Utils.prefService.removeObserver("", this);
-
+ let that = this;
+ mozt.Utils.prefService.removeObserver("", that);
mozt.Debug.debug('Moztray UNLOADED !');
/*
* NOTE: don't mozt.Handler.initialized=false here, otherwise after a
@@ -43,12 +52,15 @@ mozt.Main = {
*/
},
+ // TODO: prevent preceding warning about closing multiple tabs
onClose: function(event) {
mozt.Debug.debug('Moztray CLOSE');
mozt.Handler.showHideToTray();
event.preventDefault();
},
+ // NOTE: each new window gets a new mozt.Main, and hence listens to pref
+ // changes
observe: function(subject, topic, data) {
// Observer for pref changes
if (topic != "nsPref:changed") return;
@@ -56,16 +68,18 @@ mozt.Main = {
switch(data) {
case 'close_hides': // prevent window closing.
- // TODO: apply to all windows !!
- if (mozt.Utils.prefService.getBoolPref('close_hides'))
- window.addEventListener(
- 'close', function(event){mozt.Main.onClose(event);}, true);
- else
- window.removeEventListener(
- 'close', function(event){mozt.Main.onClose(event);}, true);
+ let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
+ let that = this;
+ if (close_hides) {
+ mozt.Debug.debug('close_hides: '+close_hides);
+ window.addEventListener('close', that.onClose, true); // mozt.Main.onClose;
+ } else {
+ mozt.Debug.debug('close_hides: '+close_hides);
+ window.removeEventListener('close', that.onClose, true);
+ }
break;
}
- },
+ }
};
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 00bf151..37ca7ea 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -3,7 +3,3 @@ pref("extensions.moztray at foudil.fr.description", "chrome://moztray/locale/overla
// Extension prefs
pref("extensions.moztray.close_hides", true);
-
-// Set the environment settings
-pref("browser.ssl_override_behavior", 2);
-pref("browser.xul.error_pages.expert_bad_cert", true);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list