From: Matt Birkholz Date: Fri, 13 Jul 2012 02:02:12 +0000 (-0700) Subject: gtk: Add delete_event signal handler to the time-slice window. X-Git-Tag: mit-scheme-pucked-9.2.12~586 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=dd507592fe89f741b9a9a6c1fbf6352fe656cb29;p=mit-scheme.git gtk: Add delete_event signal handler to the time-slice window. --- diff --git a/src/gtk/gtkio.c.stay b/src/gtk/gtkio.c.stay index bb276953c..de5f52719 100644 --- a/src/gtk/gtkio.c.stay +++ b/src/gtk/gtkio.c.stay @@ -86,6 +86,7 @@ static GtkWidget * slice_label; static GtkWidget * status_label; static void open_slice_window (void); static void close_slice_window (void); +static gboolean slice_window_delete_event (GtkWidget *window, GdkEvent *event, gpointer *data); static gchar * gpollfds_string (GSList * gpollfds); void @@ -526,6 +527,8 @@ open_slice_window (void) GtkWidget * vbox = gtk_vbox_new (FALSE, 5); status_label = gtk_label_new ("Channels:"); slice_label = gtk_label_new ("Scheme time-slice: 0"); + g_signal_connect (slice_window, "delete_event", + G_CALLBACK (slice_window_delete_event), NULL); gtk_container_add (GTK_CONTAINER (slice_window), vbox); gtk_box_pack_start (GTK_BOX (vbox), status_label, FALSE, FALSE, 2); gtk_box_pack_end (GTK_BOX (vbox), slice_label, FALSE, FALSE, 2); @@ -541,10 +544,23 @@ close_slice_window (void) { gtk_widget_destroy (GTK_WIDGET (slice_window)); slice_window = NULL; + gtk_widget_destroy (GTK_WIDGET (status_label)); status_label = NULL; + gtk_widget_destroy (GTK_WIDGET (slice_label)); slice_label = NULL; } +static gboolean +slice_window_delete_event (GtkWidget *window, GdkEvent *event, gpointer *data) +{ + slice_window = NULL; + gtk_widget_destroy (GTK_WIDGET (status_label)); + status_label = NULL; + gtk_widget_destroy (GTK_WIDGET (slice_label)); + slice_label = NULL; + return (FALSE); /* not handled here */ +} + gboolean gtk_time_slice_window_p (void) {