[gnome-maps/wip/mlundblad/remove-more-gtk-widget-destroy: 2/3] osmEditDialog: Stop using gtk_widget_destroy()




commit dce01232a7f259e110f7b99739bcbc33e3c7fe7c
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Apr 23 23:35:07 2021 +0200

    osmEditDialog: Stop using gtk_widget_destroy()
    
    gtk_widget_destroy() will only work for top-levels in GTK 4.
    Prepare by replacing these with container-specific methods to
    remove children.

 src/osmEditDialog.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/osmEditDialog.js b/src/osmEditDialog.js
index 5a7b108c..ccc65cff 100644
--- a/src/osmEditDialog.js
+++ b/src/osmEditDialog.js
@@ -757,12 +757,12 @@ var OSMEditDialog = GObject.registerClass({
     /* update visible items in the "Add Field" popover */
     _updateAddFieldMenu() {
         /* clear old items */
-        let children = this._addFieldPopoverGrid.get_children();
         let hasAllFields = true;
+        let button = this._addFieldPopoverGrid.get_child_at(0, 0);
 
-        for (let i = 0; i < children.length; i++) {
-            let button = children[i];
-            button.destroy();
+        while (button) {
+            this._addFieldPopoverGrid.remove_row(0);
+            button = this._addFieldPopoverGrid.get_child_at(0, 0);
         }
 
         /* add selectable items */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]