aboutsummaryrefslogtreecommitdiffstats
path: root/embed/xulrunner/tests/TestGtkEmbedNotebook.cpp
blob: 1891ca06bd9ba17a519d385e1f294a8519461516 (plain) (blame)
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
45
46
47
48
49
#include <gtk/gtk.h>
#include <gtkmozembed.h>
int main(int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *label;
    GtkWidget *mozembed;
    GtkWidget *container;
    char *url;

    gtk_init(&argc, &argv);
    
    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.");

    gtk_signal_connect(GTK_OBJECT(mozembed), "destroy",
                     GTK_SIGNAL_FUNC(gtk_main_quit),
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"));




    gtk_widget_set_usize(window, 400, 300);
    gtk_widget_show(mozembed);
    gtk_widget_show(label);
    gtk_widget_show_all(window);

    url = (argc > 1) ? argv[1] : (char *)"localhost";
    gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed), url);

    gtk_main();
    
    return 0;
}