mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Implemented Exit menu item.
This commit is contained in:
parent
bf82500ce5
commit
cc444a085e
@ -48,6 +48,9 @@ class nsIDOMMsgAppCore : public nsIDOMBaseAppCore {
|
|||||||
/* void GetRDFResourceForMessage (in string str); */
|
/* void GetRDFResourceForMessage (in string str); */
|
||||||
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree, nsIDOMNodeList *nodeList, nsISupports **_retval) = 0;
|
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree, nsIDOMNodeList *nodeList, nsISupports **_retval) = 0;
|
||||||
|
|
||||||
|
/* void exit(); */
|
||||||
|
NS_IMETHOD Exit()= 0;
|
||||||
|
|
||||||
#ifdef XPIDL_JS_STUBS
|
#ifdef XPIDL_JS_STUBS
|
||||||
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
|
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
|
||||||
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIDOMMsgAppCore *priv);
|
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIDOMMsgAppCore *priv);
|
||||||
|
@ -51,6 +51,7 @@ interface nsIDOMMsgAppCore : nsIDOMBaseAppCore {
|
|||||||
void OpenURL(in string str);
|
void OpenURL(in string str);
|
||||||
void DeleteMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
|
void DeleteMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
|
||||||
nsISupports GetRDFResourceForMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
|
nsISupports GetRDFResourceForMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
|
||||||
|
void Exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* hack to make MsgAppCore visible from AppCore */
|
/* hack to make MsgAppCore visible from AppCore */
|
||||||
|
@ -383,7 +383,33 @@ MsgAppCoreGetRDFResourceForMessage(JSContext *cx, JSObject *obj, uintN argc, jsv
|
|||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Native method Exit
|
||||||
|
//
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
MsgAppCoreExit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
nsIDOMMsgAppCore *nativeThis = (nsIDOMMsgAppCore*)JS_GetPrivate(cx, obj);
|
||||||
|
JSBool rBool = JS_FALSE;
|
||||||
|
nsIDOMNodeList *nodeList;
|
||||||
|
nsIDOMXULTreeElement *tree;
|
||||||
|
nsISupports *nativeRet;
|
||||||
|
const nsString typeName;
|
||||||
|
|
||||||
|
*rval = JSVAL_NULL;
|
||||||
|
|
||||||
|
// If there's no private data, this must be the prototype, so ignore
|
||||||
|
if (nsnull == nativeThis) {
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_OK != nativeThis->Exit())
|
||||||
|
{
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
//
|
//
|
||||||
// class for MsgAppCore
|
// class for MsgAppCore
|
||||||
@ -422,6 +448,7 @@ static JSFunctionSpec MsgAppCoreMethods[] =
|
|||||||
{"OpenURL", MsgAppCoreOpenURL, 1},
|
{"OpenURL", MsgAppCoreOpenURL, 1},
|
||||||
{"DeleteMessage", MsgAppCoreDeleteMessage, 2},
|
{"DeleteMessage", MsgAppCoreDeleteMessage, 2},
|
||||||
{"GetRDFResourceForMessage", MsgAppCoreGetRDFResourceForMessage, 2},
|
{"GetRDFResourceForMessage", MsgAppCoreGetRDFResourceForMessage, 2},
|
||||||
|
{"exit", MsgAppCoreExit, 0},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,6 +51,10 @@
|
|||||||
#include "nsIRDFResource.h"
|
#include "nsIRDFResource.h"
|
||||||
#include "nsIRDFService.h"
|
#include "nsIRDFService.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
|
#include "nsIAppShell.h"
|
||||||
|
#include "nsIAppShellService.h"
|
||||||
|
#include "nsAppShellCIDs.h"
|
||||||
|
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||||
static NS_DEFINE_CID(kCMailboxServiceCID, NS_MAILBOXSERVICE_CID);
|
static NS_DEFINE_CID(kCMailboxServiceCID, NS_MAILBOXSERVICE_CID);
|
||||||
@ -58,6 +62,8 @@ static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
|||||||
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
|
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
|
||||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||||
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
|
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
|
||||||
|
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
|
||||||
|
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
NS_BEGIN_EXTERN_C
|
||||||
|
|
||||||
@ -94,6 +100,7 @@ public:
|
|||||||
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
|
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
|
||||||
nsIDOMNodeList *nodeList, nsISupports
|
nsIDOMNodeList *nodeList, nsISupports
|
||||||
**aSupport);
|
**aSupport);
|
||||||
|
NS_IMETHOD Exit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -571,6 +578,23 @@ nsMsgAppCore::GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsMsgAppCore::Exit()
|
||||||
|
{
|
||||||
|
nsIAppShellService* appShell = nsnull;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the Application Shell instance...
|
||||||
|
*/
|
||||||
|
nsresult rv = nsServiceManager::GetService(kAppShellServiceCID,
|
||||||
|
nsIAppShellService::GetIID(),
|
||||||
|
(nsISupports**)&appShell);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
appShell->Shutdown();
|
||||||
|
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// to load the webshell!
|
// to load the webshell!
|
||||||
// mWebShell->LoadURL(nsAutoString("http://www.netscape.com"),
|
// mWebShell->LoadURL(nsAutoString("http://www.netscape.com"),
|
||||||
|
Loading…
Reference in New Issue
Block a user