26 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
27 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
28 }
catch (error) {alert(
"Hide on close: module import error\n\n" + error) }
43 var mainwindow =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation)
44 .QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem
45 .QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);
47 this.xulAppInfo = Components.classes[
"@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
48 this.stringConverter = Components.classes[
'@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
49 this.
wm = Components.classes[
"@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
50 this.mainwindow = this.
wm.getMostRecentWindow(
"Songbird:Main");
51 this.
prefs = Components.classes[
"@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(
"extensions.hide-on-close.");
52 this.
prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
56 this.
ngHideOnClose = Components.classes[
"@getnightingale.com/Nightingale/ngHideOnClose;1"].getService(Components.interfaces.ngIHideOnClose);
58 var windowTitle = mainwindow.document.getElementById(
"mainplayer").getAttribute(
"title");
60 if (this.xulAppInfo.name ==
"Nightingale")
63 alert(
"Hide on close failed to initialize")
69 this.
observerService = Components.classes[
"@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
72 onUnLoad:
function () {
76 registerOnClose:
function (force) {
77 if (this.
prefs.getBoolPref(
"enabled")) {
79 this.mainwindow.onclose =
function () {
80 that.ngHideOnClose.HideWindow();
84 this.mainwindow.onclose =
"";
88 preferencesObserver: {
89 register:
function () {
93 unregister:
function () {
98 if(aTopic !=
"nsPref:changed" && aTopic !=
"needInit")
return;
100 if (
aData ==
"enabled")
107 window.addEventListener(
"unload",
function(e) {
HideOnClose.onUnLoad(); },
false);
static nsCOMPtr< nsIObserverService > observerService
void InitializeFor(in string desktopFileName, in string windowTitle)
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe