On Apr 16, 8:22 pm, [EMAIL PROTECTED] wrote:
> On Mar 12, 1:11 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > //thanks a lot to Torisugari, Benjamin Smedberg, Emil Wikström & all
> > mozilla dev docs, thank you all
>
> > #define XPCOM_GLUE
> > #include <stdlib.h>
> > #include <stdio.h>
> > #include <limits.h>
> > #include <gtk/gtk.h>
> > #include "xpcom-config.h"
> > #include "nsXPCOMGlue.h"
> > #include "nsDebug.h"
> > #include "nsCOMPtr.h"
> > #include "widget/nsIBaseWindow.h"
> > #include "nsILocalFile.h"
> > #include "nsIWebBrowser.h"
> > #include "docshell/nsIWebNavigation.h"
> > #include "nsEmbedCID.h"
> > #include "nsEmbedString.h"
> > #include "xulapp/nsXULAppAPI.h"
> > #include "nsComponentManagerUtils.h"
>
> > XRE_InitEmbeddingType XRE_InitEmbedding;
> > XRE_TermEmbeddingType XRE_TermEmbedding;
>
> > static gboolean delete_event( GtkWidget *widget, GdkEvent *event,
> > gpointer data ) {
> > gtk_main_quit();
> > return FALSE;
>
> > }
>
> > int main(int argc, char** argv) {
> > GtkWidget *window;
> > nsCOMPtr<nsIBaseWindow> baseWindow;
> > nsCOMPtr<nsIWebBrowser> webBrowser;
> > nsCOMPtr<nsILocalFile> libxul;
> > nsCOMPtr<nsIWebNavigation> webNavigation;
> > nsDynamicFunctionLoad nsFuncs[] = {
> > {"XRE_InitEmbedding", (NSFuncPtr*)&XRE_InitEmbedding},
> > {"XRE_TermEmbedding", (NSFuncPtr*)
> > &XRE_TermEmbedding},
> > {0, 0}
> > };
> > nsresult rv;
> > gtk_init (&argc, &argv);
> > window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> > gtk_widget_show(window);
> > rv = XPCOMGlueStartup("/opt/xulrunner/libxpcom.so");
> > if (NS_FAILED(rv)) {
> > printf("XPCOMGlueStartup\n");
> > }
> > rv = XPCOMGlueLoadXULFunctions(nsFuncs);
> > if (NS_FAILED(rv)) {
> > printf("XPCOMGlueLoadXULFunctions\n");
> > }
> > rv = NS_NewNativeLocalFile(nsEmbedCString("/opt/xulrunner"),
> > PR_FALSE, getter_AddRefs(libxul));
> > if (NS_FAILED(rv)) {
> > printf("NS_NewNativeLocalFile\n");
> > }
> > rv = XRE_InitEmbedding(libxul, 0, 0, 0, 0);
> > if (NS_FAILED(rv)) {
> > printf("XRE_InitEmbedding\n");
> > }
> > webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
> > if (NS_FAILED(rv)) {
> > printf("do_CreateInstance webBrowser\n");
> > }
> > baseWindow = do_QueryInterface(webBrowser);
> > rv = baseWindow->InitWindow(window, 0, 0, 0, 300, 400);
> > if (NS_FAILED(rv)) {
> > printf("InitWindow\n");
> > }
> > rv = baseWindow->Create();
> > if (NS_FAILED(rv)) {
> > printf("Create\n");
> > }
> > rv =baseWindow->SetVisibility(PR_TRUE);
> > if (NS_FAILED(rv)) {
> > printf("SetVisibility\n");
> > }
> > webNavigation = do_QueryInterface(webBrowser);
> > rv =
> > webNavigation->LoadURI(NS_ConvertASCIItoUTF16("http://www.google.com").get(),
> > nsIWebNavigation::LOAD_FLAGS_NONE, 0, 0, 0);
> > if (NS_FAILED(rv)) {
> > printf("LoadURI\n");
> > }
> > g_signal_connect(G_OBJECT(window), "delete_event",
> > G_CALLBACK(delete_event), 0);
> > gtk_main();
> > printf("exit...\n");
> > XRE_TermEmbedding();
> > XPCOMGlueShutdown();
> > return 0;
>
> > }- Hide quoted text -
>
> > - Show quoted text -
>
> Hi!
> I could not compile the above piece of code.
> maybe I didn't use the correct options. Can you please let me know how
> you compiled the code?
>
> Regards,
> Vino
g++ -Wall -Wno-non-virtual-dtor -I/home/user/xulrunner-sdk/include -I/
home/user/xulrunner-sdk/sdk/include `pkg-config --cflags gtk+-2.0` -c
-o embed_xul.o embed_xul.cpp
cc embed_xul.o -L/home/user/xulrunner-sdk/lib -lxpcomglue -lstdc++
`pkg-config --libs gtk+-2.0` -o embed_xul
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding