This commit is contained in:
foudfou 2012-06-13 22:24:07 +02:00
parent 9b124d237f
commit e0f60f2981
3 changed files with 20 additions and 13 deletions

View File

@ -8,8 +8,6 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ctypes.jsm");
Cu.import("resource://firetray/ctypes/linux/gobject.jsm");
Cu.import("resource://firetray/ctypes/linux/gtk.jsm");
Cu.import("resource://firetray/commons.js");
Cu.import("resource://firetray/PrefListener.jsm");
Cu.import("resource://firetray/VersionChange.jsm");
@ -35,10 +33,6 @@ firetray.Handler = {
FILENAME_NEWMAIL: null,
initialized: false,
appId: (function(){return Services.appinfo.ID;})(),
appName: (function(){return Services.appinfo.name;})(),
runtimeABI: (function(){return Services.appinfo.XPCOMABI;})(),
runtimeOS: (function(){return Services.appinfo.OS;})(), // "WINNT", "Linux", "Darwin"
inMailApp: false,
inBrowserApp: false,
appStarted: false,
@ -46,6 +40,19 @@ firetray.Handler = {
windowsCount: 0,
visibleWindowsCount: 0,
appId: (function(){return Services.appinfo.ID;})(),
appName: (function(){return Services.appinfo.name;})(),
runtimeABI: (function(){return Services.appinfo.XPCOMABI;})(),
runtimeOS: (function(){return Services.appinfo.OS;})(), // "WINNT", "Linux", "Darwin"
addonRootDir: (function(){
let uri = Services.io.newURI(Components.stack.filename, null, null);
if (uri instanceof Ci.nsIFileURL) {
F.LOG("_directory="+uri.file.parent.parent.path);
return uri.file.parent.parent;
}
throw new Error("not resolved");
})(),
init: function() { // does creates icon
firetray.PrefListener.register(false);
@ -121,8 +128,7 @@ firetray.Handler = {
firetray.Messaging.shutdown();
firetray.StatusIcon.shutdown();
firetray.Window.shutdown();
firetray.Utils.tryCloseLibs([gobject, glib, gtk]);
// watchout order and sufficiency of lib closings (tryCloseLibs())
Services.obs.removeObserver(this, this.getAppStartupTopic(this.appId), false);
Services.obs.removeObserver(this, "xpcom-will-shutdown", false);

View File

@ -69,7 +69,8 @@ firetray.StatusIcon = {
},
shutdown: function() {
firetray.Utils.tryCloseLibs([cairo, gobject, gdk, gtk, pango, pangocairo]);
firetray.PopupMenu.shutdown();
firetray.Utils.tryCloseLibs([cairo, gobject, gdk, gio, gtk, pango, pangocairo]);
this.initialized = false;
},

View File

@ -61,7 +61,7 @@ firetray.Window = {
},
shutdown: function() {
firetray.Utils.tryCloseLibs([gobject, gdk, gtk, libc, x11]);
firetray.Utils.tryCloseLibs([gobject, gdk, gtk, libc, x11, glib]);
this.initialized = false;
},
@ -97,9 +97,9 @@ firetray.Window = {
gobject.g_list_foreach(widgets, findGtkWindowByTitleCb, userData);
gobject.g_list_free(widgets);
if (userData.contents.outWindow.isNull()) {
if (userData.contents.outWindow.isNull())
throw new Error("Window not found!");
}
F.LOG("found window: "+userData.contents.outWindow);
} catch (x) {
F.ERROR(x);
@ -154,7 +154,7 @@ firetray.Window = {
return null;
},
/** consider using getXIDFromChromeWindow() if you only need the XID */
/* consider using getXIDFromChromeWindow() if you only need the XID */
getWindowsFromChromeWindow: function(win) {
let gtkWin = firetray.Window.getGtkWindowHandle(win);
let gdkWin = firetray.Window.getGdkWindowFromGtkWindow(gtkWin);