Improved Glulxercise test program
authorfliep <fliep@ddfedd41-794f-dd11-ae45-00112f111e67>
Thu, 3 Dec 2009 21:00:31 +0000 (21:00 +0000)
committerfliep <fliep@ddfedd41-794f-dd11-ae45-00112f111e67>
Thu, 3 Dec 2009 21:00:31 +0000 (21:00 +0000)
tests/glulxercise.c
tests/glulxercise.ui

index 6d4b21fecce61d4efd35946a4e0aa56827be7f92..a389d8948d0a16b857b04767c9e6826e7945b731 100644 (file)
@@ -9,13 +9,6 @@ typedef struct {
        GtkWidget *window, *test_picker, *go, *stop, *interp;
 } Widgets;
 
-gboolean
-on_window_delete_event()
-{
-       gtk_main_quit();
-       return TRUE;
-}
-
 void
 on_go_clicked(GtkButton *go, Widgets *w)
 {
@@ -36,7 +29,11 @@ on_go_clicked(GtkButton *go, Widgets *w)
                gtk_main_quit();
        }
        g_free(fullpath);
+}
 
+void
+on_interp_started(ChimaraGlk *glk, Widgets *w)
+{
        gtk_widget_set_sensitive(w->go, FALSE);
        gtk_widget_set_sensitive(w->stop, TRUE);
        gtk_widget_set_sensitive(w->test_picker, FALSE);
@@ -47,7 +44,11 @@ on_stop_clicked(GtkButton *stop, Widgets *w)
 {
        chimara_glk_stop( CHIMARA_GLK(w->interp) );
        chimara_glk_wait( CHIMARA_GLK(w->interp) );
+}
 
+void
+on_interp_stopped(ChimaraGlk *glk, Widgets *w)
+{
        gtk_widget_set_sensitive(w->stop, FALSE);
        gtk_widget_set_sensitive(w->go, TRUE);
        gtk_widget_set_sensitive(w->test_picker, TRUE);
@@ -92,8 +93,11 @@ main(int argc, char *argv[])
        w->go = LOAD_WIDGET("go");
        w->stop = LOAD_WIDGET("stop");
        w->interp = chimara_if_new();
+       gtk_widget_set_size_request(w->interp, 500, 600);
        gtk_box_pack_end_defaults(GTK_BOX(vbox), w->interp);
        gtk_builder_connect_signals(builder, w);
+       g_signal_connect(w->interp, "started", G_CALLBACK(on_interp_started), w);
+       g_signal_connect(w->interp, "stopped", G_CALLBACK(on_interp_stopped), w);
        gtk_widget_show_all(w->window);
 
        gdk_threads_enter();
index 348f44db925b70cc7aaa385267552b72c4354139..934e67791e685c2b4433a502738d37592df00f66 100644 (file)
@@ -3,10 +3,8 @@
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy project-wide -->
   <object class="GtkWindow" id="window">
-    <property name="width_request">500</property>
-    <property name="height_request">600</property>
     <property name="border_width">6</property>
-    <signal name="delete_event" handler="on_window_delete_event"/>
+    <signal name="destroy" handler="gtk_main_quit"/>
     <child>
       <object class="GtkVBox" id="vbox">
         <property name="visible">True</property>