[Pkg-mozext-commits] [firetray] 28/399: * refactor handeling of 'close_hides': eventListeners("close") never removed from windows. Pros: reads much simpler. Cons: unnecessary eventListeners (but not harmful either). * experimental kb shortcut for hiding all windows (whatever the value of 'close_hises') * bumped to version 8.* (FF, TB)

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 f5b279298e09bc42e2f598f96643e19507ff4ea5
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Aug 28 03:35:55 2011 +0200

    * refactor handeling of 'close_hides': eventListeners("close") never removed
      from windows. Pros: reads much simpler. Cons: unnecessary eventListeners (but
      not harmful either).
    * experimental kb shortcut for hiding all windows (whatever the value of
      'close_hises')
    * bumped to version 8.* (FF, TB)
---
 README.md                         |   27 +++++++++++++++++++++++++--
 TODO                              |    2 --
 src/chrome/content/overlay.js     |   35 ++++++++++++-----------------------
 src/chrome/content/overlay.xul    |    6 ++++++
 src/defaults/preferences/prefs.js |    3 +++
 src/install.rdf                   |    4 ++--
 src/modules/MoztHandler.jsm       |    2 +-
 7 files changed, 49 insertions(+), 30 deletions(-)

diff --git a/README.md b/README.md
index 7a69868..dfffa09 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,28 @@
-rewrite of **Firetray** with js-ctypes
+Moztray
+=======
 
-## KNOWN BUGS ##
+Overview
+--------
+
+Rewrite attempt of **Firetray** with js-ctypes, with focus on message count display.
+
+Notes
+-----
+
+* Moztray 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`
+
+* if you're looking for other mozilla-desktop integration:
+  * Paul Neulinger's [Gnome-shell-Thunderbird integration](https://github.com/tanwald/gnome-shell-extension-thunderbird-integration "gnome-shell-thunderbird integration")
+  * Mike Conley's [Unity-Thunderbird integration](http://mozillalabs.com/messaging/messaging-menu/ "Unity-Thunderbird integration")
+
+KNOWN BUGS
+----------
 
 * windows aren't restored with the same z-order, but there is [no means to correct that under Linux](https://bugzilla.mozilla.org/show_bug.cgi?id=156333 "GetZOrderDOMWindowEnumerator is broken on Linux")
+
+Acknowledgment
+--------------
+
+* Some code borrowed from [Mike Conley](http://mzl.la/messagingmenu "Thanks Mike").
+* kind support from Neil Deaking
diff --git a/TODO b/TODO
index 0a67368..fdec45b 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-* fix 'close_hides' option behavior
-
 * add 'quit' to icon menu + add option UI for close_all_tabs
 
 * make multi-platform. At least have js-ctypes library call dependant on OS detection. (best would be to have the OS-dependant modules loaded at startup) 
diff --git a/src/chrome/content/overlay.js b/src/chrome/content/overlay.js
index 7ff8979..ec754cb 100644
--- a/src/chrome/content/overlay.js
+++ b/src/chrome/content/overlay.js
@@ -30,11 +30,10 @@ mozt.Main = {
     let init = mozt.Handler.initialized || mozt.Handler.init();
 
     // prevent window closing.
-    if (mozt.Utils.prefService.getBoolPref('close_hides')) {
-      mozt.Debug.debug('close_hides set');
-      let that = this;
-      window.addEventListener('close', that.onClose, true);
-    }
+    let that = this;
+    window.addEventListener('close', that.onClose, true);
+    // NOTE: each new window gets a new mozt.Main, and hence listens to pref
+    // changes
 
     mozt.Debug.debug('Moztray LOADED: ' + init);
     return true;
@@ -53,32 +52,22 @@ mozt.Main = {
   },
 
   // TODO: prevent preceding warning about closing multiple tabs
+  // (browser.tabs.warnOnClose)
   onClose: function(event) {
     mozt.Debug.debug('Moztray CLOSE');
-    mozt.Handler.showHideToTray();
-    event.preventDefault();
+    let close_hides = mozt.Utils.prefService.getBoolPref('close_hides');
+    mozt.Debug.debug('close_hides: '+close_hides);
+    if (close_hides) {
+      mozt.Handler.showHideToTray();
+      event && event.preventDefault(); // no event when called directly (xul)
+    }
   },
 
-  // 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;
     mozt.Debug.debug('Pref changed: '+data);
-
-    switch(data) {
-    case 'close_hides':         // prevent window closing.
-      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;
-    }
+    // switch(data) { ...
   }
 
 };
diff --git a/src/chrome/content/overlay.xul b/src/chrome/content/overlay.xul
index ca04a59..2109910 100644
--- a/src/chrome/content/overlay.xul
+++ b/src/chrome/content/overlay.xul
@@ -8,4 +8,10 @@
     <stringbundle id="moztray-strings" src="chrome://moztray/locale/overlay.properties"/>
   </stringbundleset>
 
+  <keyset>
+    <!-- otherwide window.addEventListener("keypress", mozt.Main.onKeyPress, true);
+         see https://addons.mozilla.org/en-US/firefox/addon/move-tabs/ -->
+    <key id="key_close" key="W" modifiers="shift meta" oncommand="mozt.Handler.showHideToTray();" /> <!-- mozt.Main.onKeyClose(); -->
+  </keyset>
+
 </overlay>
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 37ca7ea..e9b0426 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -3,3 +3,6 @@ pref("extensions.moztray at foudil.fr.description", "chrome://moztray/locale/overla
 
 // Extension prefs
 pref("extensions.moztray.close_hides", true);
+
+// Global prefs
+pref("browser.tabs.warnOnClose", false);
diff --git a/src/install.rdf b/src/install.rdf
index 3cf30ff..4e04e3a 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -19,7 +19,7 @@
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
         <em:minVersion>4.0</em:minVersion>
-        <em:maxVersion>6.*</em:maxVersion>
+        <em:maxVersion>8.*</em:maxVersion>
       </Description>
     </em:targetApplication>
 
@@ -27,7 +27,7 @@
       <Description>
         <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
         <em:minVersion>3.0</em:minVersion>
-        <em:maxVersion>5.*</em:maxVersion>
+        <em:maxVersion>8.*</em:maxVersion>
       </Description>
     </em:targetApplication>
 
diff --git a/src/modules/MoztHandler.jsm b/src/modules/MoztHandler.jsm
index 5b507ee..9791e6f 100644
--- a/src/modules/MoztHandler.jsm
+++ b/src/modules/MoztHandler.jsm
@@ -151,7 +151,7 @@ mozt.Handler = {
     mozt.Debug.debug("OS=" + runtimeOS + ", XULrunner=" + xulVer);
     if (runtimeOS != "Linux") {
       Components.utils.reportError("MOZTRAY: only Linux platform supported at this time. Moztray not loaded");
-      return;
+      return false;
       // Cu.import("resource://moztray/MoztHandler-Linux.jsm");
     }
 

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