From dd507592fe89f741b9a9a6c1fbf6352fe656cb29 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 12 Jul 2012 19:02:12 -0700 Subject: [PATCH] gtk: Add delete_event signal handler to the time-slice window. --- src/gtk/gtkio.c.stay | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) { -- 2.25.1