From 70a31df9f14345ada5282c0c932705b79ed71660 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Mon, 5 Apr 2021 17:50:02 +0100 Subject: [PATCH] Gtk: handle WM close on About box. Previously this would prevent the About box ever being opened again. --- unix/gtkdlg.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 76b50ffc..7641e788 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -3755,6 +3755,11 @@ void nonfatal(const char *p, ...) static GtkWidget *aboutbox = NULL; +static void about_window_destroyed(GtkWidget *widget, gpointer data) +{ + aboutbox = NULL; +} + static void about_close_clicked(GtkButton *button, gpointer data) { gtk_widget_destroy(aboutbox); @@ -3800,6 +3805,9 @@ void about_box(void *window) gtk_window_set_title(GTK_WINDOW(aboutbox), title); sfree(title); + g_signal_connect(G_OBJECT(aboutbox), "destroy", + G_CALLBACK(about_window_destroyed), NULL); + w = gtk_button_new_with_label("Close"); gtk_widget_set_can_default(w, true); gtk_window_set_default(GTK_WINDOW(aboutbox), w);