2000-08-09 06:52:09 +04:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gtkmozembed.h>
|
2006-01-27 00:26:45 +03:00
|
|
|
#include <stdio.h>
|
2006-01-26 22:10:50 +03:00
|
|
|
#include "nsStringAPI.h"
|
|
|
|
#include "gtkmozembed_glue.cpp"
|
|
|
|
|
2000-08-09 06:52:09 +04:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *mozembed;
|
|
|
|
GtkWidget *container;
|
|
|
|
char *url;
|
|
|
|
|
|
|
|
gtk_init(&argc, &argv);
|
|
|
|
|
2006-01-26 22:10:50 +03:00
|
|
|
static const GREVersionRange greVersion = {
|
|
|
|
"1.9a", PR_TRUE,
|
|
|
|
"2", PR_TRUE
|
|
|
|
};
|
|
|
|
|
|
|
|
char xpcomPath[PATH_MAX];
|
|
|
|
|
|
|
|
nsresult rv =
|
|
|
|
GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
|
|
|
|
xpcomPath, sizeof(xpcomPath));
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
fprintf(stderr, "Couldn't find a compatible GRE.\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = XPCOMGlueStartup(xpcomPath);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
fprintf(stderr, "Couldn't start XPCOM.");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = GTKEmbedGlueStartup();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *lastSlash = strrchr(xpcomPath, '/');
|
|
|
|
if (lastSlash)
|
|
|
|
*lastSlash = '\0';
|
|
|
|
|
|
|
|
gtk_moz_embed_set_path(xpcomPath);
|
|
|
|
|
2000-08-09 06:52:09 +04:00
|
|
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
|
|
|
|
|
|
container = gtk_notebook_new();
|
|
|
|
mozembed = gtk_moz_embed_new();
|
|
|
|
label = gtk_label_new("Can you see this message?\n"
|
|
|
|
"Once you switch to mozembed page "
|
|
|
|
"you never see this message.");
|
|
|
|
|
2009-02-02 20:49:58 +03:00
|
|
|
g_signal_connect(GTK_OBJECT(mozembed), "destroy",
|
|
|
|
G_CALLBACK(gtk_main_quit),
|
2000-08-09 06:52:09 +04:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(window), container);
|
|
|
|
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(container),
|
|
|
|
label,
|
|
|
|
gtk_label_new("gtk label"));
|
|
|
|
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(container),
|
|
|
|
mozembed,
|
|
|
|
gtk_label_new("mozembed"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-02 20:49:58 +03:00
|
|
|
gtk_widget_set_size_request(window, 400, 300);
|
2000-08-09 06:52:09 +04:00
|
|
|
gtk_widget_show(mozembed);
|
|
|
|
gtk_widget_show(label);
|
|
|
|
gtk_widget_show_all(window);
|
|
|
|
|
2000-08-10 23:55:25 +04:00
|
|
|
url = (argc > 1) ? argv[1] : (char *)"localhost";
|
2000-08-09 06:52:09 +04:00
|
|
|
gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed), url);
|
|
|
|
|
|
|
|
gtk_main();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|