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)
31 gtk_init(&argc, &argv);
33 GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
34 gtk_widget_set_size_request(window, 800, 500);
35 g_signal_connect(window, "delete_event", G_CALLBACK(on_delete_event), NULL);
37 GtkWidget *hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
38 gtk_paned_set_position(GTK_PANED(hpaned), 400);
40 GtkWidget *frotz = chimara_glk_new();
41 chimara_glk_set_css_from_string(CHIMARA_GLK(frotz),
42 "buffer.normal { font-family: 'Lucida Sans'; font-size: 12; }"
43 "grid.normal { font-family: 'Lucida Console'; font-size: 12; }");
44 g_signal_connect(frotz, "started", G_CALLBACK(on_started), "Frotz");
45 g_signal_connect(frotz, "stopped", G_CALLBACK(on_stopped), "Frotz");
47 GtkWidget *nitfol = chimara_glk_new();
48 chimara_glk_set_css_from_string(CHIMARA_GLK(frotz),
49 "buffer.normal { font-family: 'Bitstream Charter'; font-size: 12; }"
50 "grid.normal { font-family: 'Luxi Mono'; font-size: 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));