Mozilla embedding in gtk application



Hi

We are embedding mozilla in gtk application. Compiled
that application
using makefiles given in mozilla
/mozilla/embedding/browser/gtk/test/
folder. It doesn't work.

Also when we are trying it from gtk application using
kdeveloper or
anjuta IDE,  It crashes. sample code and errors are
attached. Is this problem of some libraries we are
using or
compilation flags used while compiling? If we are
missing some
libraries please let me know.

We work with this before.  And for fix this problem we
compiled mozilla with default-toolkit option to gtk2. 
In that case we were working with gtk 1.2 in  our
system and gcc 2.96.  Now our system was change to gtk
2 and gcc 3.2.  We proved many things and nothing.  We
will really preaciated your help.

If anyone knows please help us.

Here is the code that we are using for embedding
mozilla.

#include >stdio.h<
#include >gtk/gtk.h<
#include >gtkmozembed.h<
#include >nsEmbedAPI.h<

int main(int argc, char *argv[])
{
        GtkWidget *window;
        GtkWidget *vbox;
        GtkWidget *mozembed;

        gtk_init(&argc, &argv);

        gtk_moz_embed_set_profile_path(".", "mozembed");

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        if (window == NULL)
                printf("\twindow is null\n");
        else
                printf("\twindow is not null\n");

        gtk_widget_set_usize(window, 600, 700);

        vbox = gtk_vbox_new(FALSE, 0);
        if (vbox == NULL)
                printf("\tvbox is null\n");
        else
                printf("\tvbox is not null\n");


        mozembed = gtk_moz_embed_new();
        if (mozembed == NULL)
                printf("\tmozembed is null\n");
        else
                printf("\tmozembed is not null\n");


        gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed),
"file:/usr/share/doc/HTML/index.html");


        printf("\tadding it to vbox\n");
        gtk_box_pack_start(GTK_BOX(vbox), mozembed, TRUE,
TRUE, 0);

        gtk_container_add(GTK_CONTAINER(window), vbox);

        gtk_widget_show(mozembed);
        gtk_widget_show(vbox);
        gtk_widget_show(window);

        gtk_main();

}

When we add given flags  ====  -lgtkembedmoz
-lgtksuperwin -lmozjs
-lxpcom
Output is ---------


window is not null
vbox is not null

(mozilla3:9488): GLib-GObject-WARNING **: specified
instance size for
type `GtkMozEmbed' is smaller than the parent type's
`GtkBin' instance
size

(mozilla3:9488): Gtk-CRITICAL **: file gtktypeutils.c:
line 97
(gtk_type_new): assertion `GTK_TYPE_IS_OBJECT (type)'
failed

(mozilla3:9488): Gtk-WARNING **: invalid cast from
(NULL) pointer to
`(unknown)'     mozembed is null

(mozilla3:9488): GLib-GObject-WARNING **: specified
instance size for
type `GtkMozEmbed' is smaller than the parent type's
`GtkBin' instance
size

** (mozilla3:9488): CRITICAL **: file
gtkmozembed2.cpp: line 722 (void
gtk_moz_embed_load_url (GtkMozEmbed *, const char *)):
assertion
`embed != NULL' failed.
        adding it to vbox

(mozilla3:9488): Gtk-CRITICAL **: file gtkbox.c: line
359
(gtk_box_pack_start): assertion `GTK_IS_WIDGET
(child)' failed

(mozilla3:9488): Gtk-CRITICAL **: file gtkwidget.c:
line 1630
(gtk_widget_show): assertion `GTK_IS_WIDGET (widget)'
failed



When we add given flags ======  -lgtk -lgdk -lgmodule
-lgtkembedmoz
-lgtksuperwin -lmozjs -lxpcom -lplds4 -lplc4 -lnspr4
-lpthread -ldl
-lc  -lXext -lm -lXi

        It gives segmentation fault for any gtk functions
like
gtk_box_pack_start(), gtk_container_add();

What are we doing wrong?

Thanks & Regards.



___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]