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_css_from_string(CHIMARA_GLK(frotz),
44 "buffer.normal { font-family: 'Lucida Sans'; font-size: 12; }"
45 "grid.normal { font-family: 'Lucida Console'; font-size: 12; }");
46 g_signal_connect(frotz, "started", G_CALLBACK(on_started), "Frotz");
47 g_signal_connect(frotz, "stopped", G_CALLBACK(on_stopped), "Frotz");
49 GtkWidget *nitfol = chimara_glk_new();
50 chimara_glk_set_css_from_string(CHIMARA_GLK(frotz),
51 "buffer.normal { font-family: 'Bitstream Charter'; font-size: 12; }"
52 "grid.normal { font-family: 'Luxi Mono'; font-size: 12; }");
53 g_signal_connect(nitfol, "started", G_CALLBACK(on_started), "Nitfol");
54 g_signal_connect(nitfol, "stopped", G_CALLBACK(on_stopped), "Nitfol");
56 gtk_paned_pack1(GTK_PANED(hpaned), frotz, TRUE, TRUE);
57 gtk_paned_pack2(GTK_PANED(hpaned), nitfol, TRUE, TRUE);
58 gtk_container_add(GTK_CONTAINER(window), hpaned);
60 gtk_widget_show_all(window);
62 if(!chimara_glk_run(CHIMARA_GLK(frotz), "../interpreters/frotz/.libs/frotz.so", argc, argv, NULL))
64 if(!chimara_glk_run(CHIMARA_GLK(nitfol), "../interpreters/nitfol/.libs/nitfol.so", argc, argv, NULL))
71 chimara_glk_stop(CHIMARA_GLK(frotz));
72 chimara_glk_stop(CHIMARA_GLK(nitfol));