[gnome-chess] No need to manually unparent dialog children after all?



commit d5fefd34334ec53fd2bfa8fb7a99c8c95de02671
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Dec 25 11:10:42 2020 -0600

    No need to manually unparent dialog children after all?
    
    I still don't understand this fully. See:
    https://gitlab.gnome.org/GNOME/vala/-/issues/1121#note_992251

 data/preferences.ui                     |  2 +-
 src/preferences-dialog.vala             | 13 -------------
 src/promotion-type-selector-dialog.vala | 13 +------------
 3 files changed, 2 insertions(+), 26 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index f3f0b3b..0fb1dc7 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -230,7 +230,7 @@
     <property name="destroy-with-parent">1</property>
     <property name="use-header-bar">1</property>
     <child>
-      <object class="GtkBox" id="main_box">
+      <object class="GtkBox">
         <property name="can-focus">0</property>
         <child>
           <object class="GtkNotebook">
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index a386551..619cfa4 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -17,8 +17,6 @@ public class PreferencesDialog : Gtk.Dialog
     private unowned List<AIProfile> ai_profiles;
     private uint save_duration_timeout = 0;
 
-    [GtkChild]
-    private unowned Gtk.Box? main_box;
     [GtkChild]
     private unowned Gtk.CheckButton show_numbering_check;
     [GtkChild]
@@ -117,17 +115,6 @@ public class PreferencesDialog : Gtk.Dialog
         }
     }
 
-    public override void dispose ()
-    {
-        if (main_box != null)
-        {
-            main_box.unparent ();
-            main_box = null;
-        }
-
-        base.dispose ();
-    }
-
     private void set_combo (Gtk.ComboBox combo, int value_index, string value)
     {
         Gtk.TreeIter iter;
diff --git a/src/promotion-type-selector-dialog.vala b/src/promotion-type-selector-dialog.vala
index 73ea536..69ff519 100644
--- a/src/promotion-type-selector-dialog.vala
+++ b/src/promotion-type-selector-dialog.vala
@@ -22,7 +22,7 @@ public class PromotionTypeSelectorDialog : Gtk.Dialog
     }
 
     [GtkChild]
-    private unowned Gtk.Box? button_box;
+    private unowned Gtk.Box button_box;
     [GtkChild]
     private unowned Gtk.Image queen_image;
     [GtkChild]
@@ -54,17 +54,6 @@ public class PromotionTypeSelectorDialog : Gtk.Dialog
         set_piece_image (bishop_image, resource_path);
     }
 
-    public override void dispose ()
-    {
-        if (button_box != null)
-        {
-            button_box.unparent ();
-            button_box = null;
-        }
-
-        base.dispose ();
-    }
-
     private void set_piece_image (Gtk.Image image, string resource_path)
     {
         const int size = 48;


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