* 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
This commit is contained in:
foudfou 2012-01-15 20:47:47 +01:00
parent 0952430996
commit ec57aa0c8c
12 changed files with 53 additions and 27 deletions

View File

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

8
TODO
View File

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

View File

@ -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;"

View File

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

View File

@ -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:
}
},

View File

@ -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); }
}
};

View File

@ -61,6 +61,8 @@ function ctypes_library(name, abis, defines) {
}
}
this.name = name;
this.close = function() {
library.close();
this.ABI = -1;

View File

@ -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 ];

View File

@ -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");
};

View File

@ -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 ];

View File

@ -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;
},

View File

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