From cbcc4f62a83fd101c9c75f5ebfb9a07d33b4a43b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 20 Nov 2021 04:44:21 +0200 Subject: [PATCH 33/34] gtk3x: Work around gtk_widget_destroy() in citydlg unit tables handling See osdn #43246 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/citydlg.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/gui-gtk-4.0/citydlg.c b/client/gui-gtk-4.0/citydlg.c index 8f3f011e14..a00c68b5ce 100644 --- a/client/gui-gtk-4.0/citydlg.c +++ b/client/gui-gtk-4.0/citydlg.c @@ -1056,8 +1056,7 @@ static void create_and_append_overview_page(struct city_dialog *pdialog) sw); - table = gtk_grid_new(); - gtk_grid_set_column_spacing(GTK_GRID(table), 2); + table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_widget_set_size_request(table, -1, unit_height); gtk_container_add(GTK_CONTAINER(sw), table); @@ -1072,8 +1071,7 @@ static void create_and_append_overview_page(struct city_dialog *pdialog) gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), FALSE); gtk_container_add(GTK_CONTAINER(pdialog->overview.present_units_frame), sw); - table = gtk_grid_new(); - gtk_grid_set_column_spacing(GTK_GRID(table), 2); + table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_widget_set_size_request(table, -1, unit_height); gtk_container_add(GTK_CONTAINER(sw), table); @@ -2121,7 +2119,8 @@ static void city_dialog_update_supported_units(struct city_dialog *pdialog) i = 0; unit_node_vector_iterate(nodes, elt) { if (i++ >= n) { - gtk_widget_destroy(elt->cmd); + gtk_box_remove(GTK_BOX(pdialog->overview.supported_unit_table), + elt->cmd); } } unit_node_vector_iterate_end; @@ -2142,8 +2141,8 @@ static void city_dialog_update_supported_units(struct city_dialog *pdialog) gtk_container_add(GTK_CONTAINER(cmd), pix); - gtk_grid_attach(GTK_GRID(pdialog->overview.supported_unit_table), - cmd, i, 0, 1, 1); + gtk_box_append(GTK_BOX(pdialog->overview.supported_unit_table), + cmd); unit_node_vector_append(nodes, node); } } @@ -2224,7 +2223,8 @@ static void city_dialog_update_present_units(struct city_dialog *pdialog) i = 0; unit_node_vector_iterate(nodes, elt) { if (i++ >= n) { - gtk_widget_destroy(elt->cmd); + gtk_box_remove(GTK_BOX(pdialog->overview.present_unit_table), + elt->cmd); } } unit_node_vector_iterate_end; @@ -2245,8 +2245,8 @@ static void city_dialog_update_present_units(struct city_dialog *pdialog) gtk_container_add(GTK_CONTAINER(cmd), pix); - gtk_grid_attach(GTK_GRID(pdialog->overview.present_unit_table), - cmd, i, 0, 1, 1); + gtk_box_append(GTK_BOX(pdialog->overview.present_unit_table), + cmd); unit_node_vector_append(nodes, node); } } -- 2.33.0