g_free(priv->program_name);
g_free(priv->program_info);
g_free(priv->story_name);
+ g_free(priv->styles);
+ g_free(priv->glk_styles);
/* Chain up to parent */
G_OBJECT_CLASS(chimara_glk_parent_class)->finalize(object);
for(i=0; i<style_NUMSTYLES; i++) {
tag = gtk_text_tag_new(GLK_TAG_NAMES[i]);
g_hash_table_insert(glk_text_grid_styles, (gchar*) GLK_TAG_NAMES[i], tag);
+ g_object_ref(tag); /* Add an extra reference since the tag is in two hashtables */
g_hash_table_insert(glk_text_buffer_styles, (gchar*) GLK_TAG_NAMES[i], tag);
}
-export-symbols-regex "^glk_main$$" \
-rpath $(abs_builddir)
-noinst_PROGRAMS = test-multisession glulxercise plugin-loader
+noinst_PROGRAMS = test-multisession glulxercise plugin-loader test-close
test_multisession_SOURCES = test-multisession.c
test_multisession_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS)
plugin_loader_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS)
plugin_loader_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la
+test_close_SOURCES = test-close.c
+test_close_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS)
+test_close_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la
+
noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la styletest.la
first_la_SOURCES = first.c
--- /dev/null
+#include <gtk/gtk.h>
+#include <libchimara/chimara-if.h>
+
+int
+main(int argc, char *argv[])
+{
+ GtkWidget *window, *glk;
+
+ /* Initialize threads and GTK */
+ if(!g_thread_supported())
+ g_thread_init(NULL);
+ gdk_threads_init();
+ gtk_init(&argc, &argv);
+
+ /* Construct the window and its contents. We quit the GTK main loop
+ * when the window's close button is clicked. */
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
+ glk = chimara_glk_new();
+ gtk_container_add(GTK_CONTAINER(window), glk);
+ gtk_widget_show_all(window);
+
+ /* Add a reference to the ChimaraGlk widget, because we want to keep it
+ around after gtk_main() exits */
+ g_object_ref(glk);
+
+ /* Start the GTK main loop */
+ gdk_threads_enter();
+ gtk_main();
+ gdk_threads_leave();
+
+ /* After the GTK main loop exits, signal the Glk program to shut down if
+ * it is still running, and wait for it to exit. */
+ chimara_glk_stop(CHIMARA_GLK(glk));
+ chimara_glk_wait(CHIMARA_GLK(glk));
+ g_object_unref(glk);
+
+ return 0;
+}