File: xulAppInfo.cpp

package info (click to toggle)
mozilla-traybiff 1.2.2-13etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 508 kB
  • ctags: 310
  • sloc: ansic: 1,757; cpp: 1,029; makefile: 226; perl: 123; sh: 112
file content (44 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include "nsXPCOM.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsIComponentRegistrar.h"
#include "nsXULAppAPI.h"
#include "nsIXULRuntime.h"
#include "nsStringAPI.h"

int main(int argc, char **argv)
	{
	nsresult rv;
	
	{
		nsCOMPtr<nsIServiceManager> servMan;
		rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
		if (NS_FAILED(rv))
			return -1;
		{
			nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
			NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
			if (registrar)
				registrar->AutoRegister(nsnull);
		}
		{
			nsCOMPtr<nsIXULRuntime> xulrun = do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv);
			if (xulrun)
			{
				nsCString xpcomAbi;
				if (!NS_FAILED(xulrun->GetXPCOMABI(xpcomAbi)))
				{
					printf("%s\n", xpcomAbi.get());
				}
			}
			else
			{
				printf("No nsIXULRuntime: %x.\n", rv);
			}
		}
	}
	rv = NS_ShutdownXPCOM(nsnull);
	NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
	return 0;
}