mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 149764: changes to quit-application observer topic. r=danm, sr=jst
This commit is contained in:
parent
201f9528cf
commit
16b4006118
@ -216,41 +216,6 @@ function MsgToggleSplitter(id)
|
||||
splitter.setAttribute("state", "collapsed")
|
||||
}
|
||||
|
||||
function NotifyQuitApplication()
|
||||
{
|
||||
var ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService();
|
||||
ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
|
||||
if (ObserverService)
|
||||
{
|
||||
try
|
||||
{
|
||||
ObserverService.notifyObservers(null, "quit-application", null);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
// dump("no observer found \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function LastToClose()
|
||||
{
|
||||
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = windowManagerInterface.getEnumerator( null );
|
||||
var count = 0;
|
||||
|
||||
while ( enumerator.hasMoreElements() && count < 2 )
|
||||
{
|
||||
var windowToClose = enumerator.getNext();
|
||||
count++;
|
||||
}
|
||||
if (count == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function MsgSetFolderCharset()
|
||||
{
|
||||
MsgFolderProperties()
|
||||
|
@ -2140,8 +2140,6 @@ function ComposeCanClose()
|
||||
switch (result)
|
||||
{
|
||||
case 0: //Save
|
||||
if (LastToClose())
|
||||
NotifyQuitApplication();
|
||||
gCloseWindowAfterSave = true;
|
||||
SaveAsDraft();
|
||||
return false;
|
||||
|
@ -583,10 +583,10 @@ nsAppShellService::Quit(PRUint32 aFerocity)
|
||||
if (aFerocity == eForceQuit) {
|
||||
// do it!
|
||||
|
||||
#ifdef MOZ_PHOENIX
|
||||
// No chance of the shutdown being cancelled from here on; tell people
|
||||
// we're shutting down for sure while all services are still available.
|
||||
nsCOMPtr<nsIObserverService> obsService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
obsService->NotifyObservers(nsnull, "quit-application", nsnull);
|
||||
#endif
|
||||
|
||||
// first shutdown native app support; doing this first will prevent new
|
||||
// requests to open additional windows coming in.
|
||||
|
@ -6,7 +6,9 @@ function goQuitApplication()
|
||||
{
|
||||
try
|
||||
{
|
||||
ObserverService.notifyObservers(null, "quit-application", null);
|
||||
// XXX FIX! we should have a way to cancel a requested quit; see
|
||||
// bugzilla bug 149764
|
||||
ObserverService.notifyObservers(null, "quit-application-requested", null);
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user