[Pkg-mozext-commits] [firetray] 205/399: browser.tabs.warnOnClose set to false temporarily

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:44 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 98cfa3eee170715e0737c59f52656d31d3e90f1c
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Fri Mar 9 09:59:37 2012 +0100

    browser.tabs.warnOnClose set to false temporarily
---
 README.md                         |    2 +-
 src/defaults/preferences/prefs.js |    3 ---
 src/modules/FiretrayHandler.jsm   |   22 ++++++++++++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 6339194..bcc03e3 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Notes
 -----
 
 * requires GTK+ 2.20 and higher.
-* Firetray unsets the `tabs.warnOnClose` built-in preference, which otherwise disrupts the handeling of the close event.
+* Firetray temporarily unsets the `tabs.warnOnClose` built-in preference, which otherwise disrupts the handeling of the close event.
 * Experimental non-customizable keyboard shortcut for hiding all windows set to: `accel-shift-w`
 
 References
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 5ff7d14..bc296a5 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -1,9 +1,6 @@
 // https://developer.mozilla.org/en/Localizing_extension_descriptions
 pref("extensions.{9533f794-00b4-4354-aa15-c2bbda6989f8}.description", "chrome://firetray/locale/overlay.properties");
 
-// Global prefs
-pref("browser.tabs.warnOnClose", false);
-
 // Extension prefs
 pref("extensions.firetray.firstrun", true);
 
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 25ae7e2..90cd538 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -99,6 +99,7 @@ firetray.Handler = {
 
     Services.obs.addObserver(this, this.getAppStartupTopic(this.appName), false);
     Services.obs.addObserver(this, "xpcom-will-shutdown", false);
+    Services.obs.addObserver(this, "profile-change-teardown", false);
 
     let welcome = function(ver) {
       firetray.Handler.openTab(FIRETRAY_SPLASH_PAGE+"#"+ver);
@@ -110,6 +111,8 @@ firetray.Handler = {
     VersionChange.setReinstallHook(welcome);
     VersionChange.watch();
 
+    this.preventWarnOnClose();
+
     this.initialized = true;
     return true;
   },
@@ -126,6 +129,7 @@ firetray.Handler = {
 
     Services.obs.removeObserver(this, this.getAppStartupTopic(this.appName), false);
     Services.obs.removeObserver(this, "xpcom-will-shutdown", false);
+    Services.obs.removeObserver(this, "profile-change-teardown", false);
 
     this.appStarted = false;
     this.initialized = false;
@@ -149,6 +153,10 @@ firetray.Handler = {
       firetray.LOG("xpcom-will-shutdown");
       this.shutdown();
       break;
+    case "profile-change-teardown":
+      if (data === 'shutdown-persist')
+        this.restoreWarnOnClose();
+      break;
     default:
     }
   },
@@ -355,6 +363,20 @@ firetray.Handler = {
         appStartup.quit(Ci.nsIAppStartup.eAttemptQuit);
       }, FIRETRAY_DELAY_NOWAIT_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
     } catch (x) { firetray.ERROR(x); }
+  },
+
+  preventWarnOnClose: function() {
+    if (!this.inBrowserApp) return;
+    let generalTabsPrefs = Services.prefs.getBranch("browser.tabs.");
+    this.warnOnCloseTmp = generalTabsPrefs.getBoolPref('warnOnClose');
+    firetray.LOG("warnOnClose saved. was: "+this.warnOnCloseTmp);
+    generalTabsPrefs.setBoolPref('warnOnClose', false);
+  },
+  restoreWarnOnClose: function() {
+    if (!this.inBrowserApp && !this.warnOnCloseTmp) return;
+    let generalTabsPrefs = Services.prefs.getBranch("browser.tabs.");
+    generalTabsPrefs.setBoolPref('warnOnClose', this.warnOnCloseTmp);
+    firetray.LOG("warnOnClose restored to: "+this.warnOnCloseTmp);
   }
 
 }; // firetray.Handler

-- 
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