On 5/3/26 15:35, Philippe Michel wrote:
The patch doesn't look right. After it, with GTK3, the dialog after an
error in tutor mode shows only a Play Anyway button instead of four
(Play Anyway / Rethink / End Tutor Mode / Hint).

Moreover, it triggers 3 GTK warnings:
Gtk-CRITICAL **: 19:59:29.804: gtk_container_add: assertion 'GTK_IS_CONTAINER 
(container)' failed
(possibly one per missing button)


I see - yes I was unaware of tutor mode, and this patch did have a problem. Please see the following updated patch file against current git master for gnubg.
From 1468b55735cef4e7dc3dbc64bec47aab187724a3 Mon Sep 17 00:00:00 2001
From: Nikolas Nyby <[email protected]>
Date: Sun, 3 May 2026 00:36:20 -0400
Subject: [PATCH] Update DialogArea()

1. Callers on GTK 3 should not use DA_BUTTONS, so emit a warning to help
   us migrate this code.
2. DA_OK can be simplified with gtk_dialog_get_widget_for_response().
---
 gtkwindows.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/gtkwindows.c b/gtkwindows.c
index 9b3859f8..2a5df239 100644
--- a/gtkwindows.c
+++ b/gtkwindows.c
@@ -237,29 +237,25 @@ GTKCreateDialog(const char *szTitle, const dialogtype dt,
 extern GtkWidget *
 DialogArea(GtkWidget * pw, dialogarea da)
 {
-    GList *pl, *pl_org;
+    GList *pl;
     GtkWidget *pwChild = NULL;
 
     switch (da) {
     case DA_MAIN:
         pl = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(pw))));
-        pwChild = pl->data;
+        if (pl)
+            pwChild = pl->data;
         g_list_free(pl);
         return pwChild;
 
     case DA_BUTTONS:
+#if GTK_CHECK_VERSION(3, 12, 0)
+        g_warning("DialogArea(..., DA_BUTTONS) is deprecated");
+#endif
         return gtk_dialog_get_action_area(GTK_DIALOG(pw));
 
     case DA_OK:
-        pl = pl_org = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(pw))));
-        while (pl) {
-            pwChild = pl->data;
-            if (!strcmp(gtk_button_get_label(GTK_BUTTON(pwChild)), _("OK")))
-                break;
-            pl = pl->next;
-        }
-        g_list_free(pl_org);
-        return pwChild;
+        return gtk_dialog_get_widget_for_response(GTK_DIALOG(pw), GTK_RESPONSE_OK);
     }
 
     g_assert_not_reached();
-- 
2.51.0

Reply via email to