1 /* Program for testing multisessionality, i.e. whether two ChimaraGlk widgets
2 can run in the same application. */
6 #include <libchimara/chimara-glk.h>
9 on_started(ChimaraGlk *glk, const gchar *data)
11 g_printerr("%s started!\n", data);
15 on_stopped(ChimaraGlk *glk, const gchar *data)
17 g_printerr("%s stopped!\n", data);
28 main(int argc, char **argv)
30 if( !g_thread_supported() )
33 gtk_init(&argc, &argv);
35 GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
36 gtk_widget_set_size_request(window, 800, 500);
37 g_signal_connect(window, "delete_event", G_CALLBACK(on_delete_event), NULL);
39 GtkWidget *hpaned = gtk_hpaned_new();
40 gtk_paned_set_position(GTK_PANED(hpaned), 400);
42 GtkWidget *frotz = chimara_glk_new();
43 chimara_glk_set_default_font_string(CHIMARA_GLK(frotz), "Lucida Sans 12");
44 chimara_glk_set_monospace_font_string(CHIMARA_GLK(frotz), "Lucida Console 12");
45 g_signal_connect(frotz, "started", G_CALLBACK(on_started), "Frotz");
46 g_signal_connect(frotz, "stopped", G_CALLBACK(on_stopped), "Frotz");
48 GtkWidget *nitfol = chimara_glk_new();
49 chimara_glk_set_default_font_string(CHIMARA_GLK(nitfol), "Bitstream Charter 12");
50 chimara_glk_set_monospace_font_string(CHIMARA_GLK(nitfol), "Luxi Mono 12");
51 g_signal_connect(nitfol, "started", G_CALLBACK(on_started), "Nitfol");
52 g_signal_connect(nitfol, "stopped", G_CALLBACK(on_stopped), "Nitfol");
54 gtk_paned_pack1(GTK_PANED(hpaned), frotz, TRUE, TRUE);
55 gtk_paned_pack2(GTK_PANED(hpaned), nitfol, TRUE, TRUE);
56 gtk_container_add(GTK_CONTAINER(window), hpaned);
58 gtk_widget_show_all(window);
60 if(!chimara_glk_run(CHIMARA_GLK(frotz), "../interpreters/frotz/.libs/frotz.so", argc, argv, NULL))
62 if(!chimara_glk_run(CHIMARA_GLK(nitfol), "../interpreters/nitfol/.libs/nitfol.so", argc, argv, NULL))
69 chimara_glk_stop(CHIMARA_GLK(frotz));
70 chimara_glk_stop(CHIMARA_GLK(nitfol));