[Pkg-mozext-commits] [firetray] 138/399: * fix pref pane (UIOptions) * addon shutdown (close ctypes libs) on xpcom-will-shutdown * ctypes libs that import glib also export it so it can be closed later
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:29 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 ec57aa0c8cf2bb3cfc36df27bfa3e60bf806d8c9
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sun Jan 15 20:47:47 2012 +0100
* fix pref pane (UIOptions)
* addon shutdown (close ctypes libs) on xpcom-will-shutdown
* ctypes libs that import glib also export it so it can be closed later
---
README.md | 14 ++++++++++++++
TODO | 8 ++------
src/chrome/content/options.xul | 4 ++--
src/install.rdf | 4 ++--
src/modules/FiretrayHandler.jsm | 17 +++++++++--------
src/modules/commons.js | 10 ++++++++++
src/modules/ctypes/ctypes-utils.jsm | 2 ++
src/modules/ctypes/gdk.jsm | 2 +-
src/modules/ctypes/glib.jsm | 1 -
src/modules/ctypes/gobject.jsm | 2 +-
src/modules/gtk2/FiretrayStatusIcon.jsm | 7 +------
src/modules/gtk2/FiretrayWindow.jsm | 9 +++++++++
12 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index c7ed96a..535c2ce 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,20 @@ Overview
Js-ctypes rewrite of the binary XPCOM version of **Firetray**.
+Features
+--------
+
+* for all applications:
+ * show/hide a single or all windows
+ * a window restored to its previous state, position, size, virtual desktop
+ * ability to hide to tray on minimize
+ * ability to start minimized to tray
+
+* for mail applications:
+ * display unread messages count in tray icon
+ * customizable tray icon for mail biff
+ * include/exclude mail accounts and folders types to/from unread messages count
+
Notes
-----
diff --git a/TODO b/TODO
index 95d7fa0..56e2b8d 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,6 @@
TODO
----
-* use for (var i = 0; myArray[i++];) instead of i<myArray.length
-
* add entry to popup menu when registering
WONTFIX
@@ -38,10 +36,8 @@ NEXT FEATURES
-------------
* mouse scrolls on tray icon hides/shows
-* hide to tray on minimize
-* ability to start minimized to tray
-* when restoring if the window is iconified, deiconify it
-* custom tray icon
+* when restoring, if the window is iconified, deiconify it
* keyboard shortcut hide/show
+* show icon only when hidden to tray
[Vote](https://docs.google.com/spreadsheet/viewform?hl=fr&formkey=dFJqUC1pLTQzNkJYQldFdzdSV1BaSkE6MQ#gid=0)
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index 1d9d47a..73bc75e 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -44,11 +44,11 @@
<checkbox id="ui_hides_on_close" preference="pref_bool_hides_on_close"
label="&bool_hides_on_close.label;"
accesskey="&bool_hides_on_close.accesskey;"
- oncommand="firetrayUIOptions.updateHidesOptions();"/>
+ oncommand="firetrayUIOptions.updateWindowAndIconOptions();"/>
<checkbox id="ui_hides_on_minimize" preference="pref_bool_hides_on_minimize"
label="&bool_hides_on_minimize.label;"
accesskey="&bool_hides_on_minimize.accesskey;"
- oncommand="firetrayUIOptions.updateHidesOptions();"/>
+ oncommand="firetrayUIOptions.updateWindowAndIconOptions();"/>
<checkbox id="ui_hides_single_window" preference="pref_bool_hides_single_window"
label="&bool_hides_single_window.label;"
accesskey="&bool_hides_single_window.accesskey;"
diff --git a/src/install.rdf b/src/install.rdf
index cc219c0..68fa7dc 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>10.*</em:maxVersion>
+ <em:maxVersion>11.*</em:maxVersion>
</Description>
</em:targetApplication>
@@ -27,7 +27,7 @@
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>3.3a1pre</em:minVersion>
- <em:maxVersion>10.*</em:maxVersion>
+ <em:maxVersion>11.*</em:maxVersion>
</Description>
</em:targetApplication>
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index b9bf8af..bc6cf30 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -92,6 +92,7 @@ firetray.Handler = {
}
Services.obs.addObserver(this, this.getAppStartupTopic(this.mozAppId), false);
+ Services.obs.addObserver(this, "xpcom-will-shutdown", false);
this.initialized = true;
return true;
@@ -100,17 +101,13 @@ firetray.Handler = {
shutdown: function() {
if (this.inMailApp)
firetray.Messaging.shutdown();
+ firetray.StatusIcon.shutdown();
+ firetray.Window.shutdown();
- switch (this.runtimeOS) {
- case "Linux":
- firetray.StatusIcon.shutdown();
- break;
- default:
- ERROR("runtimeOS unknown or undefined.");
- return false;
- }
+ firetray.Utils.tryCloseLibs([gobject, glib, gtk]);
Services.obs.removeObserver(this, this.getAppStartupTopic(this.mozAppId), false);
+ Services.obs.removeObserver(this, "xpcom-will-shutdown", false);
return true;
},
@@ -129,6 +126,10 @@ firetray.Handler = {
LOG("*** appStarted ***");
}, FIRETRAY_BROWSER_STARTUP_DELAY_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
break;
+ case "xpcom-will-shutdown":
+ LOG("xpcom-will-shutdown");
+ this.shutdown();
+ break;
default:
}
},
diff --git a/src/modules/commons.js b/src/modules/commons.js
index e5d1906..e9b08b8 100644
--- a/src/modules/commons.js
+++ b/src/modules/commons.js
@@ -169,6 +169,16 @@ firetray.Utils = {
}
return list;
+ },
+
+ tryCloseLibs: function(libs) {
+ try {
+ libs.forEach(function(lib) {
+ LOG("try closing "+lib.name);
+ if (lib.available())
+ lib.close();
+ });
+ } catch(x) { ERROR(x); }
}
};
diff --git a/src/modules/ctypes/ctypes-utils.jsm b/src/modules/ctypes/ctypes-utils.jsm
index 4f80b42..7cf8f7f 100644
--- a/src/modules/ctypes/ctypes-utils.jsm
+++ b/src/modules/ctypes/ctypes-utils.jsm
@@ -61,6 +61,8 @@ function ctypes_library(name, abis, defines) {
}
}
+ this.name = name;
+
this.close = function() {
library.close();
this.ABI = -1;
diff --git a/src/modules/ctypes/gdk.jsm b/src/modules/ctypes/gdk.jsm
index 5e5e600..ebd8cef 100644
--- a/src/modules/ctypes/gdk.jsm
+++ b/src/modules/ctypes/gdk.jsm
@@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
-var EXPORTED_SYMBOLS = [ "gdk" ];
+var EXPORTED_SYMBOLS = [ "gdk", "glib" ];
const GDK_LIBNAME = "gdk-x11-2.0";
const GDK_ABIS = [ 0 ];
diff --git a/src/modules/ctypes/glib.jsm b/src/modules/ctypes/glib.jsm
index 409a08f..67b2c50 100644
--- a/src/modules/ctypes/glib.jsm
+++ b/src/modules/ctypes/glib.jsm
@@ -15,7 +15,6 @@ Cu.import("resource://firetray/ctypes/ctypes-utils.jsm");
function glib_defines(lib) {
/* mutual inclusion not possible */
this.GQuark = ctypes.uint32_t; // this.GQuark = gobject.guint32;
-
this.GError = ctypes.StructType("GError");
};
diff --git a/src/modules/ctypes/gobject.jsm b/src/modules/ctypes/gobject.jsm
index 7d29cb6..ac33fec 100644
--- a/src/modules/ctypes/gobject.jsm
+++ b/src/modules/ctypes/gobject.jsm
@@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
-var EXPORTED_SYMBOLS = [ "gobject" ];
+var EXPORTED_SYMBOLS = [ "gobject", "glib" ];
const GOBJECT_LIBNAME = "gobject-2.0";
const GOBJECT_ABIS = [ 0 ];
diff --git a/src/modules/gtk2/FiretrayStatusIcon.jsm b/src/modules/gtk2/FiretrayStatusIcon.jsm
index 14d39b2..5dcbb1f 100644
--- a/src/modules/gtk2/FiretrayStatusIcon.jsm
+++ b/src/modules/gtk2/FiretrayStatusIcon.jsm
@@ -55,12 +55,7 @@ firetray.StatusIcon = {
},
shutdown: function() {
- cairo.close();
- gobject.close();
- gdk.close();
- gtk.close();
- pango.close();
-
+ firetray.Utils.tryCloseLibs([cairo, gobject, gdk, gtk, pango]);
this.initialized = false;
},
diff --git a/src/modules/gtk2/FiretrayWindow.jsm b/src/modules/gtk2/FiretrayWindow.jsm
index b7c1004..1fa5a49 100644
--- a/src/modules/gtk2/FiretrayWindow.jsm
+++ b/src/modules/gtk2/FiretrayWindow.jsm
@@ -49,6 +49,15 @@ var _find_data_t = ctypes.StructType("_find_data_t", [
firetray.Window = {
+ init: function() {
+ this.initialized = true;
+ },
+
+ shutdown: function() {
+ firetray.Utils.tryCloseLibs([gobject, gdk, gtk, libc, x11]);
+ this.initialized = false;
+ },
+
/**
* Iterate over all Gtk toplevel windows to find a window. We rely on
* Service.wm to watch windows correctly: we should find only one window.
--
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