[gtk/bin-removal: 13/40] Use gtk_window_set_child throughout



commit f59f3551902268600090c0382068103a09184df0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 2 17:26:54 2020 -0400

    Use gtk_window_set_child throughout
    
    Replace all uses of gtk_container_add on windows
    by gtk_window_set_child.

 demos/constraint-editor/constraint-editor-window.c |  4 +-
 demos/gtk-demo/clipboard.c                         |  2 +-
 demos/gtk-demo/combobox.c                          |  2 +-
 demos/gtk-demo/constraints.c                       |  2 +-
 demos/gtk-demo/constraints2.c                      |  2 +-
 demos/gtk-demo/constraints3.c                      |  2 +-
 demos/gtk-demo/css_accordion.c                     |  2 +-
 demos/gtk-demo/css_basics.c                        |  2 +-
 demos/gtk-demo/css_multiplebgs.c                   |  2 +-
 demos/gtk-demo/css_pixbufs.c                       |  2 +-
 demos/gtk-demo/css_shadows.c                       |  2 +-
 demos/gtk-demo/dialog.c                            |  2 +-
 demos/gtk-demo/dnd.c                               |  2 +-
 demos/gtk-demo/drawingarea.c                       |  2 +-
 demos/gtk-demo/editable_cells.c                    |  2 +-
 demos/gtk-demo/entry_completion.c                  |  2 +-
 demos/gtk-demo/entry_undo.c                        |  2 +-
 demos/gtk-demo/fixed.c                             |  2 +-
 demos/gtk-demo/flowbox.c                           |  2 +-
 demos/gtk-demo/gears.c                             |  2 +-
 demos/gtk-demo/gestures.c                          |  2 +-
 demos/gtk-demo/glarea.c                            |  2 +-
 demos/gtk-demo/headerbar.c                         |  2 +-
 demos/gtk-demo/hypertext.c                         |  2 +-
 demos/gtk-demo/iconview.c                          |  2 +-
 demos/gtk-demo/iconview_edit.c                     |  2 +-
 demos/gtk-demo/images.c                            |  2 +-
 demos/gtk-demo/infobar.c                           |  2 +-
 demos/gtk-demo/links.c                             |  2 +-
 demos/gtk-demo/list_store.c                        |  2 +-
 demos/gtk-demo/listbox.c                           |  2 +-
 demos/gtk-demo/markup.c                            |  2 +-
 demos/gtk-demo/overlay.c                           |  2 +-
 demos/gtk-demo/overlay2.c                          |  2 +-
 demos/gtk-demo/paint.c                             |  2 +-
 demos/gtk-demo/paintable.c                         |  2 +-
 demos/gtk-demo/paintable_animated.c                |  2 +-
 demos/gtk-demo/paintable_mediastream.c             |  2 +-
 demos/gtk-demo/panes.c                             |  2 +-
 demos/gtk-demo/password_entry.c                    |  2 +-
 demos/gtk-demo/peg_solitaire.c                     |  2 +-
 demos/gtk-demo/pickers.c                           |  2 +-
 demos/gtk-demo/pixbufs.c                           |  2 +-
 demos/gtk-demo/rotated_text.c                      |  2 +-
 demos/gtk-demo/search_entry.c                      |  2 +-
 demos/gtk-demo/search_entry2.c                     |  2 +-
 demos/gtk-demo/shortcut_triggers.c                 |  2 +-
 demos/gtk-demo/sidebar.c                           |  2 +-
 demos/gtk-demo/sizegroup.c                         |  2 +-
 demos/gtk-demo/sliding_puzzle.c                    |  2 +-
 demos/gtk-demo/tabs.c                              |  2 +-
 demos/gtk-demo/tagged_entry.c                      |  2 +-
 demos/gtk-demo/textmask.c                          |  2 +-
 demos/gtk-demo/textscroll.c                        |  2 +-
 demos/gtk-demo/textundo.c                          |  2 +-
 demos/gtk-demo/textview.c                          |  4 +-
 demos/gtk-demo/theming_style_classes.c             |  2 +-
 demos/gtk-demo/transparent.c                       |  2 +-
 demos/gtk-demo/tree_store.c                        |  2 +-
 demos/gtk-demo/video_player.c                      |  2 +-
 docs/tools/widgets.c                               |  2 +-
 examples/action-namespace.c                        |  2 +-
 examples/bp/bloatpad.c                             |  2 +-
 examples/drawing.c                                 |  2 +-
 examples/grid-packing.c                            |  2 +-
 examples/hello-world.c                             |  2 +-
 examples/plugman.c                                 |  2 +-
 examples/search-bar.c                              |  2 +-
 examples/sunny.c                                   |  2 +-
 gtk/a11y/gtkwindowaccessible.c                     |  8 ----
 gtk/gtkradiobutton.c                               |  2 +-
 gtk/gtkspinbutton.c                                |  4 +-
 gtk/gtktogglebutton.c                              |  2 +-
 gtk/inspector/fpsoverlay.c                         |  2 +-
 gtk/tools/gtk-builder-tool-preview.c               |  2 +-
 tests/animated-resizing.c                          |  2 +-
 tests/animated-revealing.c                         |  2 +-
 tests/gdkgears.c                                   |  2 +-
 tests/listmodel.c                                  |  2 +-
 tests/motion-compression.c                         |  2 +-
 tests/overlayscroll.c                              |  2 +-
 tests/scrolling-performance.c                      |  2 +-
 tests/showrendernode.c                             |  4 +-
 tests/simple.c                                     |  2 +-
 tests/syncscroll.c                                 |  2 +-
 tests/testaccel.c                                  |  2 +-
 tests/testadjustsize.c                             | 10 ++--
 tests/testassistant.c                              |  2 +-
 tests/testbaseline.c                               |  2 +-
 tests/testblur.c                                   |  2 +-
 tests/testborderdrawing.c                          |  2 +-
 tests/testbox.c                                    |  2 +-
 tests/testbuttons.c                                |  2 +-
 tests/testcairo.c                                  |  2 +-
 tests/testcalendar.c                               |  2 +-
 tests/testcellarea.c                               |  6 +--
 tests/testcellrenderertext.c                       |  2 +-
 tests/testcenterbox.c                              |  2 +-
 tests/testclipboard2.c                             |  2 +-
 tests/testcombo.c                                  |  2 +-
 tests/testdialog.c                                 |  2 +-
 tests/testdnd.c                                    |  2 +-
 tests/testdnd2.c                                   |  2 +-
 tests/testdnd3.c                                   |  2 +-
 tests/testellipsise.c                              |  2 +-
 tests/testemblems.c                                |  2 +-
 tests/testentrycompletion.c                        |  2 +-
 tests/testentryicons.c                             |  2 +-
 tests/testexpand.c                                 |  4 +-
 tests/testflowbox.c                                |  2 +-
 tests/testfontchooser.c                            |  2 +-
 tests/testfontchooserdialog.c                      |  2 +-
 tests/testfontoptions.c                            |  2 +-
 tests/testframe.c                                  |  2 +-
 tests/testfullscreen.c                             |  2 +-
 tests/testgaction.c                                |  2 +-
 tests/testglarea.c                                 |  2 +-
 tests/testglblending.c                             |  2 +-
 tests/testgmenu.c                                  |  2 +-
 tests/testgrid.c                                   | 18 ++++----
 tests/testgridbaseline.c                           |  2 +-
 tests/testgrouping.c                               |  2 +-
 tests/testgtk.c                                    | 54 +++++++++++-----------
 tests/testheaderbar.c                              |  2 +-
 tests/testheightforwidth.c                         |  2 +-
 tests/testhover.c                                  |  8 ++--
 tests/testicontheme.c                              |  2 +-
 tests/testiconview-keynav.c                        |  2 +-
 tests/testiconview.c                               |  2 +-
 tests/testinfobar.c                                |  2 +-
 tests/testinhibitshortcuts.c                       |  2 +-
 tests/testkineticscrolling.c                       |  2 +-
 tests/testlevelbar.c                               |  2 +-
 tests/testlist.c                                   |  2 +-
 tests/testlist2.c                                  |  2 +-
 tests/testlist3.c                                  |  2 +-
 tests/testlist4.c                                  |  2 +-
 tests/testlockbutton.c                             |  2 +-
 tests/testlogout.c                                 |  2 +-
 tests/testmenubutton.c                             |  2 +-
 tests/testnoscreen.c                               |  2 +-
 tests/testnotebookdnd.c                            |  4 +-
 tests/testorientable.c                             |  2 +-
 tests/testoutsetshadowdrawing.c                    |  2 +-
 tests/testoverlay.c                                | 14 +++---
 tests/testoverlaystyleclass.c                      |  2 +-
 tests/testpixbuf-scale.c                           |  2 +-
 tests/testplacesview.c                             |  2 +-
 tests/testpopover.c                                |  2 +-
 tests/testrevealer.c                               |  2 +-
 tests/testrevealer2.c                              |  2 +-
 tests/testscale.c                                  |  2 +-
 tests/testscrolledge.c                             |  2 +-
 tests/testscrolledwindow.c                         |  2 +-
 tests/testscrolltofocus.c                          |  2 +-
 tests/testsensitive.c                              |  2 +-
 tests/testsounds.c                                 |  2 +-
 tests/testspinbutton.c                             |  2 +-
 tests/teststack.c                                  |  2 +-
 tests/testswitch.c                                 |  2 +-
 tests/testtexture.c                                |  2 +-
 tests/testtextview.c                               |  2 +-
 tests/testtextview2.c                              |  2 +-
 tests/testtoolbar2.c                               |  2 +-
 tests/testtooltips.c                               |  2 +-
 tests/testtreechanging.c                           |  2 +-
 tests/testtreecolumns.c                            |  6 +--
 tests/testtreecolumnsizing.c                       |  2 +-
 tests/testtreednd.c                                |  2 +-
 tests/testtreeedit.c                               |  2 +-
 tests/testtreeflow.c                               |  2 +-
 tests/testtreefocus.c                              |  4 +-
 tests/testtreelistmodel.c                          |  2 +-
 tests/testtreepos.c                                |  2 +-
 tests/testtreesort.c                               |  6 +--
 tests/testtreeview.c                               |  2 +-
 tests/testverticalcells.c                          |  2 +-
 tests/testvolumebutton.c                           |  2 +-
 tests/testwidgetfocus.c                            |  2 +-
 tests/testwidgettransforms.c                       |  2 +-
 tests/testwindowdrag.c                             |  2 +-
 tests/testwindowsize.c                             |  2 +-
 tests/treestoretest.c                              |  2 +-
 tests/video-timer.c                                |  2 +-
 testsuite/gtk/action.c                             |  4 +-
 testsuite/gtk/builder.c                            | 18 +++++---
 testsuite/gtk/displayclose.c                       |  2 +-
 testsuite/gtk/filtermodel.c                        |  4 +-
 testsuite/gtk/grid-layout.c                        | 10 ++--
 testsuite/gtk/popover.c                            |  2 +-
 testsuite/gtk/propertylookuplistmodel.c            |  2 +-
 testsuite/gtk/regression-tests.c                   |  4 +-
 testsuite/gtk/treeview.c                           |  2 +-
 testsuite/gtk/window.c                             |  4 +-
 testsuite/reftests/set-default-direction.c         |  5 +-
 195 files changed, 272 insertions(+), 279 deletions(-)
---
diff --git a/demos/constraint-editor/constraint-editor-window.c 
b/demos/constraint-editor/constraint-editor-window.c
index cf2c11e2fd..1a78092994 100644
--- a/demos/constraint-editor/constraint-editor-window.c
+++ b/demos/constraint-editor/constraint-editor-window.c
@@ -426,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
 
   editor = constraint_editor_new (model, constraint);
 
-  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
+  gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
 
   g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
 
@@ -460,7 +460,7 @@ edit_guide (ConstraintEditorWindow *win,
   gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
 
   editor = guide_editor_new (guide);
-  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
+  gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
 
   g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
   gtk_widget_show (window);
diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c
index ca8ca07670..801baaa173 100644
--- a/demos/gtk-demo/clipboard.c
+++ b/demos/gtk-demo/clipboard.c
@@ -118,7 +118,7 @@ do_clipboard (GtkWidget *do_widget)
       gtk_widget_set_margin_top (vbox, 8);
       gtk_widget_set_margin_bottom (vbox, 8);
 
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
 
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c
index e2e9d11f95..1fd1d7bcb9 100644
--- a/demos/gtk-demo/combobox.c
+++ b/demos/gtk-demo/combobox.c
@@ -324,7 +324,7 @@ do_combobox (GtkWidget *do_widget)
     gtk_widget_set_margin_end (vbox, 10);
     gtk_widget_set_margin_top (vbox, 10);
     gtk_widget_set_margin_bottom (vbox, 10);
-    gtk_container_add (GTK_CONTAINER (window), vbox);
+    gtk_window_set_child (GTK_WINDOW (window), vbox);
 
     /* A combobox demonstrating cell renderers, separators and
      *  insensitive rows
diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c
index 57c5554cc4..f2f9076fa3 100644
--- a/demos/gtk-demo/constraints.c
+++ b/demos/gtk-demo/constraints.c
@@ -266,7 +266,7 @@ do_constraints (GtkWidget *do_widget)
                        G_CALLBACK (gtk_widget_destroyed), &window);
 
      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-     gtk_container_add (GTK_CONTAINER (window), box);
+     gtk_window_set_child (GTK_WINDOW (window), box);
 
      grid = g_object_new (simple_grid_get_type (), NULL);
      gtk_widget_set_hexpand (grid, TRUE);
diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints2.c
index db8a75b88f..cdaaa85088 100644
--- a/demos/gtk-demo/constraints2.c
+++ b/demos/gtk-demo/constraints2.c
@@ -222,7 +222,7 @@ do_constraints2 (GtkWidget *do_widget)
                        G_CALLBACK (gtk_widget_destroyed), &window);
 
      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-     gtk_container_add (GTK_CONTAINER (window), box);
+     gtk_window_set_child (GTK_WINDOW (window), box);
 
      grid = g_object_new (interactive_grid_get_type (), NULL);
      gtk_widget_set_hexpand (grid, TRUE);
diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints3.c
index 2c7566b422..01d81a48d2 100644
--- a/demos/gtk-demo/constraints3.c
+++ b/demos/gtk-demo/constraints3.c
@@ -142,7 +142,7 @@ do_constraints3 (GtkWidget *do_widget)
                        G_CALLBACK (gtk_widget_destroyed), &window);
 
      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-     gtk_container_add (GTK_CONTAINER (window), box);
+     gtk_window_set_child (GTK_WINDOW (window), box);
 
      grid = g_object_new (vfl_grid_get_type (), NULL);
      gtk_widget_set_hexpand (grid, TRUE);
diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c
index 648393a506..d28262def0 100644
--- a/demos/gtk-demo/css_accordion.c
+++ b/demos/gtk-demo/css_accordion.c
@@ -34,7 +34,7 @@ do_css_accordion (GtkWidget *do_widget)
       container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
       gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
-      gtk_container_add (GTK_CONTAINER (window), container);
+      gtk_window_set_child (GTK_WINDOW (window), container);
 
       child = gtk_button_new_with_label ("This");
       gtk_container_add (GTK_CONTAINER (container), child);
diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c
index 83e408dd68..2f46c4f38b 100644
--- a/demos/gtk-demo/css_basics.c
+++ b/demos/gtk-demo/css_basics.c
@@ -92,7 +92,7 @@ do_css_basics (GtkWidget *do_widget)
       provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
 
       container = gtk_scrolled_window_new (NULL, NULL);
-      gtk_container_add (GTK_CONTAINER (window), container);
+      gtk_window_set_child (GTK_WINDOW (window), container);
       child = gtk_text_view_new_with_buffer (text);
       gtk_container_add (GTK_CONTAINER (container), child);
       g_signal_connect (text, "changed",
diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c
index 056b647e69..5e29060d85 100644
--- a/demos/gtk-demo/css_multiplebgs.c
+++ b/demos/gtk-demo/css_multiplebgs.c
@@ -94,7 +94,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       container = gtk_overlay_new ();
-      gtk_container_add (GTK_CONTAINER (window), container);
+      gtk_window_set_child (GTK_WINDOW (window), container);
 
       child = gtk_drawing_area_new ();
       gtk_widget_set_name (child, "canvas");
diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c
index e60a7d4e87..9d88ef76fa 100644
--- a/demos/gtk-demo/css_pixbufs.c
+++ b/demos/gtk-demo/css_pixbufs.c
@@ -80,7 +80,7 @@ do_css_pixbufs (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-      gtk_container_add (GTK_CONTAINER (window), paned);
+      gtk_window_set_child (GTK_WINDOW (window), paned);
 
       /* Need a filler so we get a handle */
       child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c
index 6457d43efa..de21cfae29 100644
--- a/demos/gtk-demo/css_shadows.c
+++ b/demos/gtk-demo/css_shadows.c
@@ -99,7 +99,7 @@ do_css_shadows (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-      gtk_container_add (GTK_CONTAINER (window), paned);
+      gtk_window_set_child (GTK_WINDOW (window), paned);
 
       child = create_toolbar ();
       gtk_container_add (GTK_CONTAINER (paned), child);
diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c
index 92a4e3371c..6b965b9d84 100644
--- a/demos/gtk-demo/dialog.c
+++ b/demos/gtk-demo/dialog.c
@@ -118,7 +118,7 @@ do_dialog (GtkWidget *do_widget)
       gtk_widget_set_margin_end (frame, 8);
       gtk_widget_set_margin_top (frame, 8);
       gtk_widget_set_margin_bottom (frame, 8);
-      gtk_container_add (GTK_CONTAINER (window), frame);
+      gtk_window_set_child (GTK_WINDOW (window), frame);
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
       gtk_widget_set_margin_start (vbox, 8);
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c
index b2c1a307da..30bae48e17 100644
--- a/demos/gtk-demo/dnd.c
+++ b/demos/gtk-demo/dnd.c
@@ -443,7 +443,7 @@ do_dnd (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_container_add (GTK_CONTAINER (box), box2);
diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c
index 845b414834..dd7380b63c 100644
--- a/demos/gtk-demo/drawingarea.c
+++ b/demos/gtk-demo/drawingarea.c
@@ -202,7 +202,7 @@ do_drawingarea (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 16);
       gtk_widget_set_margin_top (vbox, 16);
       gtk_widget_set_margin_bottom (vbox, 16);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       /*
        * Create the checkerboard area
diff --git a/demos/gtk-demo/editable_cells.c b/demos/gtk-demo/editable_cells.c
index 5a559a674c..cb0ff0abfa 100644
--- a/demos/gtk-demo/editable_cells.c
+++ b/demos/gtk-demo/editable_cells.c
@@ -360,7 +360,7 @@ do_editable_cells (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 5);
       gtk_widget_set_margin_top (vbox, 5);
       gtk_widget_set_margin_bottom (vbox, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       gtk_container_add (GTK_CONTAINER (vbox),
                           gtk_label_new ("Shopping list (you can edit the cells!)"));
diff --git a/demos/gtk-demo/entry_completion.c b/demos/gtk-demo/entry_completion.c
index 9cd193b2f8..d371afc451 100644
--- a/demos/gtk-demo/entry_completion.c
+++ b/demos/gtk-demo/entry_completion.c
@@ -59,7 +59,7 @@ do_entry_completion (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 5);
       gtk_widget_set_margin_top (vbox, 5);
       gtk_widget_set_margin_bottom (vbox, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       label = gtk_label_new (NULL);
       gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> 
for example.");
diff --git a/demos/gtk-demo/entry_undo.c b/demos/gtk-demo/entry_undo.c
index 1c8babfd3f..9d069aeafb 100644
--- a/demos/gtk-demo/entry_undo.c
+++ b/demos/gtk-demo/entry_undo.c
@@ -33,7 +33,7 @@ do_entry_undo (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 5);
       gtk_widget_set_margin_top (vbox, 5);
       gtk_widget_set_margin_bottom (vbox, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       label = gtk_label_new (NULL);
       gtk_label_set_markup (GTK_LABEL (label),
diff --git a/demos/gtk-demo/fixed.c b/demos/gtk-demo/fixed.c
index 7c739030a6..dcdf253596 100644
--- a/demos/gtk-demo/fixed.c
+++ b/demos/gtk-demo/fixed.c
@@ -131,7 +131,7 @@ create_demo_window (GtkWidget *do_widget)
   g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
 
   fixed = gtk_fixed_new ();
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), fixed);
diff --git a/demos/gtk-demo/flowbox.c b/demos/gtk-demo/flowbox.c
index 901b78cb6a..fd87463b89 100644
--- a/demos/gtk-demo/flowbox.c
+++ b/demos/gtk-demo/flowbox.c
@@ -736,7 +736,7 @@ do_flowbox (GtkWidget *do_widget)
       gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (flowbox), GTK_SELECTION_NONE);
 
       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), flowbox);
-      gtk_container_add (GTK_CONTAINER (window), scrolled);
+      gtk_window_set_child (GTK_WINDOW (window), scrolled);
 
       for (i = 0; colors[i]; i++)
         gtk_container_add (GTK_CONTAINER (flowbox), color_swatch_new (colors[i]));
diff --git a/demos/gtk-demo/gears.c b/demos/gtk-demo/gears.c
index 66fb2b420f..f6237da494 100644
--- a/demos/gtk-demo/gears.c
+++ b/demos/gtk-demo/gears.c
@@ -93,7 +93,7 @@ do_gears (GtkWidget *do_widget)
       gtk_widget_set_margin_top (overlay, 12);
       gtk_widget_set_margin_bottom (overlay, 12);
 
-      gtk_container_add (GTK_CONTAINER (window), overlay);
+      gtk_window_set_child (GTK_WINDOW (window), overlay);
 
       frame = gtk_frame_new (NULL);
       gtk_widget_set_halign (frame, GTK_ALIGN_START);
diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c
index d50eb34b99..f238da1666 100644
--- a/demos/gtk-demo/gestures.c
+++ b/demos/gtk-demo/gestures.c
@@ -153,7 +153,7 @@ do_gestures (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       drawing_area = gtk_drawing_area_new ();
-      gtk_container_add (GTK_CONTAINER (window), drawing_area);
+      gtk_window_set_child (GTK_WINDOW (window), drawing_area);
 
       gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
                                       drawing_area_draw,
diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c
index a72cf7c376..0a5f965a07 100644
--- a/demos/gtk-demo/glarea.c
+++ b/demos/gtk-demo/glarea.c
@@ -401,7 +401,7 @@ create_glarea_window (GtkWidget *do_widget)
   gtk_widget_set_margin_top (box, 12);
   gtk_widget_set_margin_bottom (box, 12);
   gtk_box_set_spacing (GTK_BOX (box), 6);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   gl_area = gtk_gl_area_new ();
   gtk_widget_set_hexpand (gl_area, TRUE);
diff --git a/demos/gtk-demo/headerbar.c b/demos/gtk-demo/headerbar.c
index a1ddf97511..e8a0ead1a9 100644
--- a/demos/gtk-demo/headerbar.c
+++ b/demos/gtk-demo/headerbar.c
@@ -52,7 +52,7 @@ do_headerbar (GtkWidget *do_widget)
 
       gtk_window_set_titlebar (GTK_WINDOW (window), header);
 
-      gtk_container_add (GTK_CONTAINER (window), gtk_text_view_new ());
+      gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/hypertext.c b/demos/gtk-demo/hypertext.c
index 81a19e3305..9191cabe49 100644
--- a/demos/gtk-demo/hypertext.c
+++ b/demos/gtk-demo/hypertext.c
@@ -266,7 +266,7 @@ do_hypertext (GtkWidget *do_widget)
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-      gtk_container_add (GTK_CONTAINER (window), sw);
+      gtk_window_set_child (GTK_WINDOW (window), sw);
       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
 
       show_page (buffer, 1);
diff --git a/demos/gtk-demo/iconview.c b/demos/gtk-demo/iconview.c
index 8a6372d119..0b80aafae1 100644
--- a/demos/gtk-demo/iconview.c
+++ b/demos/gtk-demo/iconview.c
@@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
       load_pixbufs ();
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
diff --git a/demos/gtk-demo/iconview_edit.c b/demos/gtk-demo/iconview_edit.c
index a9b4f890b7..6e5c52d2a6 100644
--- a/demos/gtk-demo/iconview_edit.c
+++ b/demos/gtk-demo/iconview_edit.c
@@ -146,7 +146,7 @@ do_iconview_edit (GtkWidget *do_widget)
                                       "text", COL_TEXT,
                                       NULL);
 
-      gtk_container_add (GTK_CONTAINER (window), icon_view);
+      gtk_window_set_child (GTK_WINDOW (window), icon_view);
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c
index 455343a933..b0efca8a1b 100644
--- a/demos/gtk-demo/images.c
+++ b/demos/gtk-demo/images.c
@@ -346,7 +346,7 @@ do_images (GtkWidget *do_widget)
       gtk_widget_set_margin_end (base_vbox, 16);
       gtk_widget_set_margin_top (base_vbox, 16);
       gtk_widget_set_margin_bottom (base_vbox, 16);
-      gtk_container_add (GTK_CONTAINER (window), base_vbox);
+      gtk_window_set_child (GTK_WINDOW (window), base_vbox);
 
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
       gtk_container_add (GTK_CONTAINER (base_vbox), hbox);
diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c
index c6f744c2ab..92fc46b26c 100644
--- a/demos/gtk-demo/infobar.c
+++ b/demos/gtk-demo/infobar.c
@@ -66,7 +66,7 @@ do_infobar (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 8);
       gtk_widget_set_margin_top (vbox, 8);
       gtk_widget_set_margin_bottom (vbox, 8);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       bar = gtk_info_bar_new ();
       gtk_container_add (GTK_CONTAINER (vbox), bar);
diff --git a/demos/gtk-demo/links.c b/demos/gtk-demo/links.c
index 4917176581..219f096346 100644
--- a/demos/gtk-demo/links.c
+++ b/demos/gtk-demo/links.c
@@ -81,7 +81,7 @@ do_links (GtkWidget *do_widget)
       gtk_widget_set_margin_end (label, 20);
       gtk_widget_set_margin_top (label, 20);
       gtk_widget_set_margin_bottom (label, 20);
-      gtk_container_add (GTK_CONTAINER (window), label);
+      gtk_window_set_child (GTK_WINDOW (window), label);
       gtk_widget_show (label);
     }
 
diff --git a/demos/gtk-demo/list_store.c b/demos/gtk-demo/list_store.c
index 27815802ca..941548318c 100644
--- a/demos/gtk-demo/list_store.c
+++ b/demos/gtk-demo/list_store.c
@@ -266,7 +266,7 @@ do_list_store (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 8);
       gtk_widget_set_margin_top (vbox, 8);
       gtk_widget_set_margin_bottom (vbox, 8);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a 
nice ODBC interface to bugzilla or so, though).");
       gtk_container_add (GTK_CONTAINER (vbox), label);
diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c
index d988ec5e65..fe9c3e2fd3 100644
--- a/demos/gtk-demo/listbox.c
+++ b/demos/gtk-demo/listbox.c
@@ -360,7 +360,7 @@ do_listbox (GtkWidget *do_widget)
                         &window);
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
       label = gtk_label_new ("Messages from GTK and friends");
       gtk_container_add (GTK_CONTAINER (vbox), label);
       scrolled = gtk_scrolled_window_new (NULL, NULL);
diff --git a/demos/gtk-demo/markup.c b/demos/gtk-demo/markup.c
index a9a0eaf11b..7b23ec9252 100644
--- a/demos/gtk-demo/markup.c
+++ b/demos/gtk-demo/markup.c
@@ -63,7 +63,7 @@ do_markup (GtkWidget *do_widget)
 
       stack = gtk_stack_new ();
       gtk_widget_show (stack);
-      gtk_container_add (GTK_CONTAINER (window), stack);
+      gtk_window_set_child (GTK_WINDOW (window), stack);
 
       show_source = gtk_check_button_new_with_label ("Source");
       gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
diff --git a/demos/gtk-demo/overlay.c b/demos/gtk-demo/overlay.c
index afc7c534df..be3c2e1696 100644
--- a/demos/gtk-demo/overlay.c
+++ b/demos/gtk-demo/overlay.c
@@ -78,7 +78,7 @@ do_overlay (GtkWidget *do_widget)
       gtk_widget_set_margin_bottom (entry, 8);
       gtk_container_add (GTK_CONTAINER (vbox), entry);
 
-      gtk_container_add (GTK_CONTAINER (window), overlay);
+      gtk_window_set_child (GTK_WINDOW (window), overlay);
 
       g_signal_connect (window, "destroy",
                         G_CALLBACK (gtk_widget_destroyed), &window);
diff --git a/demos/gtk-demo/overlay2.c b/demos/gtk-demo/overlay2.c
index b990701944..8d491faea8 100644
--- a/demos/gtk-demo/overlay2.c
+++ b/demos/gtk-demo/overlay2.c
@@ -57,7 +57,7 @@ do_overlay2 (GtkWidget *do_widget)
       gtk_text_iter_forward_word_end (&end);
       gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
 
-      gtk_container_add (GTK_CONTAINER (window), overlay);
+      gtk_window_set_child (GTK_WINDOW (window), overlay);
       gtk_container_add (GTK_CONTAINER (overlay), sw);
       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
 
diff --git a/demos/gtk-demo/paint.c b/demos/gtk-demo/paint.c
index f392ea2769..a13750801e 100644
--- a/demos/gtk-demo/paint.c
+++ b/demos/gtk-demo/paint.c
@@ -389,7 +389,7 @@ do_paint (GtkWidget *toplevel)
       window = gtk_window_new ();
 
       draw_area = drawing_area_new ();
-      gtk_container_add (GTK_CONTAINER (window), draw_area);
+      gtk_window_set_child (GTK_WINDOW (window), draw_area);
 
       headerbar = gtk_header_bar_new ();
       gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
diff --git a/demos/gtk-demo/paintable.c b/demos/gtk-demo/paintable.c
index c4c31b61ca..63fef5d5c8 100644
--- a/demos/gtk-demo/paintable.c
+++ b/demos/gtk-demo/paintable.c
@@ -164,7 +164,7 @@ do_paintable (GtkWidget *do_widget)
 
       nuclear = gtk_nuclear_icon_new (0.0);
       image = gtk_image_new_from_paintable (nuclear);
-      gtk_container_add (GTK_CONTAINER (window), image);
+      gtk_window_set_child (GTK_WINDOW (window), image);
       g_object_unref (nuclear);
     }
 
diff --git a/demos/gtk-demo/paintable_animated.c b/demos/gtk-demo/paintable_animated.c
index e81d9d2f94..4c71512b1e 100644
--- a/demos/gtk-demo/paintable_animated.c
+++ b/demos/gtk-demo/paintable_animated.c
@@ -196,7 +196,7 @@ do_paintable_animated (GtkWidget *do_widget)
 
       nuclear = gtk_nuclear_animation_new ();
       image = gtk_image_new_from_paintable (nuclear);
-      gtk_container_add (GTK_CONTAINER (window), image);
+      gtk_window_set_child (GTK_WINDOW (window), image);
       g_object_unref (nuclear);
     }
 
diff --git a/demos/gtk-demo/paintable_mediastream.c b/demos/gtk-demo/paintable_mediastream.c
index a666b3d3e0..4b1cde9e2d 100644
--- a/demos/gtk-demo/paintable_mediastream.c
+++ b/demos/gtk-demo/paintable_mediastream.c
@@ -298,7 +298,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
       gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
 
       video = gtk_video_new_for_media_stream (nuclear);
-      gtk_container_add (GTK_CONTAINER (window), video);
+      gtk_window_set_child (GTK_WINDOW (window), video);
 
       g_object_unref (nuclear);
     }
diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c
index 98ce0fd664..6a5c9bc59e 100644
--- a/demos/gtk-demo/panes.c
+++ b/demos/gtk-demo/panes.c
@@ -159,7 +159,7 @@ do_panes (GtkWidget *do_widget)
       gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
       gtk_widget_set_margin_start (vpaned, 5);
diff --git a/demos/gtk-demo/password_entry.c b/demos/gtk-demo/password_entry.c
index 56310d23a5..f8246dd4a4 100644
--- a/demos/gtk-demo/password_entry.c
+++ b/demos/gtk-demo/password_entry.c
@@ -53,7 +53,7 @@ do_password_entry (GtkWidget *do_widget)
       gtk_widget_set_margin_end (box, 18);
       gtk_widget_set_margin_top (box, 18);
       gtk_widget_set_margin_bottom (box, 18);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       entry = gtk_password_entry_new ();
       gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);
diff --git a/demos/gtk-demo/peg_solitaire.c b/demos/gtk-demo/peg_solitaire.c
index f4f3fc4e26..00fdca3d56 100644
--- a/demos/gtk-demo/peg_solitaire.c
+++ b/demos/gtk-demo/peg_solitaire.c
@@ -294,7 +294,7 @@ do_peg_solitaire (GtkWidget *do_widget)
       gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
       gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
       gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
-      gtk_container_add (GTK_CONTAINER (window), grid);
+      gtk_window_set_child (GTK_WINDOW (window), grid);
 
       for (x = 0; x < 7; x++)
         {
diff --git a/demos/gtk-demo/pickers.c b/demos/gtk-demo/pickers.c
index e17620022b..5f6b3f8497 100644
--- a/demos/gtk-demo/pickers.c
+++ b/demos/gtk-demo/pickers.c
@@ -29,7 +29,7 @@ do_pickers (GtkWidget *do_widget)
     gtk_widget_set_margin_bottom (table, 20);
     gtk_grid_set_row_spacing (GTK_GRID (table), 3);
     gtk_grid_set_column_spacing (GTK_GRID (table), 10);
-    gtk_container_add (GTK_CONTAINER (window), table);
+    gtk_window_set_child (GTK_WINDOW (window), table);
 
     label = gtk_label_new ("Color:");
     gtk_widget_set_halign (label, GTK_ALIGN_START);
diff --git a/demos/gtk-demo/pixbufs.c b/demos/gtk-demo/pixbufs.c
index eab22a464e..aece1dfb4a 100644
--- a/demos/gtk-demo/pixbufs.c
+++ b/demos/gtk-demo/pixbufs.c
@@ -212,7 +212,7 @@ do_pixbufs (GtkWidget *do_widget)
           gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
           gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
 
-          gtk_container_add (GTK_CONTAINER (window), da);
+          gtk_window_set_child (GTK_WINDOW (window), da);
 
           gtk_widget_add_tick_callback (da, on_tick, NULL, NULL);
         }
diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c
index eef6f7ca35..b86a5e6944 100644
--- a/demos/gtk-demo/rotated_text.c
+++ b/demos/gtk-demo/rotated_text.c
@@ -185,7 +185,7 @@ do_rotated_text (GtkWidget *do_widget)
 
       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       /* Add a drawing area */
       drawing_area = gtk_drawing_area_new ();
diff --git a/demos/gtk-demo/search_entry.c b/demos/gtk-demo/search_entry.c
index d9999eea5e..a072aa0962 100644
--- a/demos/gtk-demo/search_entry.c
+++ b/demos/gtk-demo/search_entry.c
@@ -269,7 +269,7 @@ do_search_entry (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 5);
       gtk_widget_set_margin_top (vbox, 5);
       gtk_widget_set_margin_bottom (vbox, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       label = gtk_label_new (NULL);
       gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c
index 68a9de3faa..de8c577b91 100644
--- a/demos/gtk-demo/search_entry2.c
+++ b/demos/gtk-demo/search_entry2.c
@@ -78,7 +78,7 @@ do_search_entry2 (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       entry = gtk_search_entry_new ();
       container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
diff --git a/demos/gtk-demo/shortcut_triggers.c b/demos/gtk-demo/shortcut_triggers.c
index c57edea5fc..509a7f5514 100644
--- a/demos/gtk-demo/shortcut_triggers.c
+++ b/demos/gtk-demo/shortcut_triggers.c
@@ -65,7 +65,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
       gtk_widget_set_margin_bottom (list, 6);
       gtk_widget_set_margin_start (list, 6);
       gtk_widget_set_margin_end (list, 6);
-      gtk_container_add (GTK_CONTAINER (window), list);
+      gtk_window_set_child (GTK_WINDOW (window), list);
 
       for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
         {
diff --git a/demos/gtk-demo/sidebar.c b/demos/gtk-demo/sidebar.c
index 2b64ec2264..420861f225 100644
--- a/demos/gtk-demo/sidebar.c
+++ b/demos/gtk-demo/sidebar.c
@@ -74,7 +74,7 @@ do_sidebar (GtkWidget *do_widget)
           g_object_set (gtk_stack_get_page (GTK_STACK (stack), widget), "title", c, NULL);
         }
 
-       gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c
index edbf9e9cf2..9d12dd3551 100644
--- a/demos/gtk-demo/sizegroup.c
+++ b/demos/gtk-demo/sizegroup.c
@@ -112,7 +112,7 @@ do_sizegroup (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 5);
       gtk_widget_set_margin_top (vbox, 5);
       gtk_widget_set_margin_bottom (vbox, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
       g_object_set_data_full (G_OBJECT (window), "size-group", size_group, g_object_unref);
diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c
index 00c2a765e4..03ac047e6a 100644
--- a/demos/gtk-demo/sliding_puzzle.c
+++ b/demos/gtk-demo/sliding_puzzle.c
@@ -463,7 +463,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), 
FALSE);
-      gtk_container_add (GTK_CONTAINER (window), frame);
+      gtk_window_set_child (GTK_WINDOW (window), frame);
 
       start_puzzle (puzzle);
     }
diff --git a/demos/gtk-demo/tabs.c b/demos/gtk-demo/tabs.c
index 034b60a566..0a046a594e 100644
--- a/demos/gtk-demo/tabs.c
+++ b/demos/gtk-demo/tabs.c
@@ -46,7 +46,7 @@ do_tabs (GtkWidget *do_widget)
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-      gtk_container_add (GTK_CONTAINER (window), sw);
+      gtk_window_set_child (GTK_WINDOW (window), sw);
       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
     }
 
diff --git a/demos/gtk-demo/tagged_entry.c b/demos/gtk-demo/tagged_entry.c
index c7b0816c4a..26795421bc 100644
--- a/demos/gtk-demo/tagged_entry.c
+++ b/demos/gtk-demo/tagged_entry.c
@@ -80,7 +80,7 @@ do_tagged_entry (GtkWidget *do_widget)
       gtk_widget_set_margin_end (box, 18);
       gtk_widget_set_margin_top (box, 18);
       gtk_widget_set_margin_bottom (box, 18);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       entry = demo_tagged_entry_new ();
       gtk_container_add (GTK_CONTAINER (box), entry);
diff --git a/demos/gtk-demo/textmask.c b/demos/gtk-demo/textmask.c
index 6457be2857..ff66ce2961 100644
--- a/demos/gtk-demo/textmask.c
+++ b/demos/gtk-demo/textmask.c
@@ -69,7 +69,7 @@ do_textmask (GtkWidget *do_widget)
 
       da = gtk_drawing_area_new ();
 
-      gtk_container_add (GTK_CONTAINER (window), da);
+      gtk_window_set_child (GTK_WINDOW (window), da);
       gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_text, NULL, NULL);
     }
 
diff --git a/demos/gtk-demo/textscroll.c b/demos/gtk-demo/textscroll.c
index ccd5d521b1..02df96c7a9 100644
--- a/demos/gtk-demo/textscroll.c
+++ b/demos/gtk-demo/textscroll.c
@@ -188,7 +188,7 @@ do_textscroll (GtkWidget *do_widget)
 
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
       gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
-      gtk_container_add (GTK_CONTAINER (window), hbox);
+      gtk_window_set_child (GTK_WINDOW (window), hbox);
 
       create_text_view (hbox, TRUE);
       create_text_view (hbox, FALSE);
diff --git a/demos/gtk-demo/textundo.c b/demos/gtk-demo/textundo.c
index fb3a03e442..d7e35e0851 100644
--- a/demos/gtk-demo/textundo.c
+++ b/demos/gtk-demo/textundo.c
@@ -53,7 +53,7 @@ do_textundo (GtkWidget *do_widget)
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-      gtk_container_add (GTK_CONTAINER (window), sw);
+      gtk_window_set_child (GTK_WINDOW (window), sw);
       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
     }
 
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index 0acc03e9e2..68e0b35c20 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -486,7 +486,7 @@ do_textview (GtkWidget *do_widget)
       gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
 
       vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-      gtk_container_add (GTK_CONTAINER (window), vpaned);
+      gtk_window_set_child (GTK_WINDOW (window), vpaned);
 
       /* For convenience, we just use the autocreated buffer from
        * the first text view; you could also create the buffer
@@ -594,7 +594,7 @@ easter_egg_callback (GtkWidget *button,
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
 
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
 
   window_ptr = &window;
diff --git a/demos/gtk-demo/theming_style_classes.c b/demos/gtk-demo/theming_style_classes.c
index f67660678e..db91d92c5c 100644
--- a/demos/gtk-demo/theming_style_classes.c
+++ b/demos/gtk-demo/theming_style_classes.c
@@ -31,7 +31,7 @@ do_theming_style_classes (GtkWidget *do_widget)
       builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
 
       grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
-      gtk_container_add (GTK_CONTAINER (window), grid);
+      gtk_window_set_child (GTK_WINDOW (window), grid);
       g_object_unref (builder);
     }
 
diff --git a/demos/gtk-demo/transparent.c b/demos/gtk-demo/transparent.c
index 5422cb14ea..65a7152c11 100644
--- a/demos/gtk-demo/transparent.c
+++ b/demos/gtk-demo/transparent.c
@@ -29,7 +29,7 @@ do_transparent (GtkWidget *do_widget)
       gtk_window_set_title (GTK_WINDOW (window), "Transparency");
 
       overlay = blur_overlay_new ();
-      gtk_container_add (GTK_CONTAINER (window), overlay);
+      gtk_window_set_child (GTK_WINDOW (window), overlay);
 
       button = gtk_button_new_with_label ("Don't click this button!");
       label = gtk_button_get_child (GTK_BUTTON (button));
diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c
index f404fcc757..f39b409718 100644
--- a/demos/gtk-demo/tree_store.c
+++ b/demos/gtk-demo/tree_store.c
@@ -402,7 +402,7 @@ do_tree_store (GtkWidget *do_widget)
       gtk_widget_set_margin_end (vbox, 8);
       gtk_widget_set_margin_top (vbox, 8);
       gtk_widget_set_margin_bottom (vbox, 8);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       gtk_container_add (GTK_CONTAINER (vbox),
                           gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c
index 848c28ab48..6a40204c24 100644
--- a/demos/gtk-demo/video_player.c
+++ b/demos/gtk-demo/video_player.c
@@ -71,7 +71,7 @@ do_video_player (GtkWidget *do_widget)
                         G_CALLBACK (gtk_widget_destroyed), &window);
 
       video = gtk_video_new ();
-      gtk_container_add (GTK_CONTAINER (window), video);
+      gtk_window_set_child (GTK_WINDOW (window), video);
 
       title = gtk_header_bar_new ();
       gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 08f43062ce..442349672b 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -1126,7 +1126,7 @@ create_headerbar (void)
   view = gtk_text_view_new ();
   gtk_widget_show (view);
   gtk_widget_set_size_request (window, 220, 150);
-  gtk_container_add (GTK_CONTAINER (window), view);
+  gtk_window_set_child (GTK_WINDOW (window), view);
   bar = gtk_header_bar_new ();
   gtk_window_set_titlebar (GTK_WINDOW (window), bar);
   button = gtk_button_new ();
diff --git a/examples/action-namespace.c b/examples/action-namespace.c
index da18e7828b..642b7c8fca 100644
--- a/examples/action-namespace.c
+++ b/examples/action-namespace.c
@@ -113,7 +113,7 @@ activate (GApplication *app,
   gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (button_menu));
   gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_CENTER);
   gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (win), button);
+  gtk_window_set_child (GTK_WINDOW (window), button);
   gtk_widget_show (win);
 
   g_object_unref (button_menu);
diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c
index 3cb619eb8f..be6bee5aa6 100644
--- a/examples/bp/bloatpad.c
+++ b/examples/bp/bloatpad.c
@@ -222,7 +222,7 @@ new_window (GApplication *app,
   gtk_window_set_title (GTK_WINDOW (window), "Bloatpad");
 
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   button = gtk_toggle_button_new ();
diff --git a/examples/drawing.c b/examples/drawing.c
index e00460889f..be45149e5c 100644
--- a/examples/drawing.c
+++ b/examples/drawing.c
@@ -143,7 +143,7 @@ activate (GtkApplication *app,
   g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
 
   frame = gtk_frame_new (NULL);
-  gtk_container_add (GTK_CONTAINER (window), frame);
+  gtk_window_set_child (GTK_WINDOW (window), frame);
 
   drawing_area = gtk_drawing_area_new ();
   /* set a minimum size */
diff --git a/examples/grid-packing.c b/examples/grid-packing.c
index b6cb0ba334..dcee10f712 100644
--- a/examples/grid-packing.c
+++ b/examples/grid-packing.c
@@ -23,7 +23,7 @@ activate (GtkApplication *app,
   grid = gtk_grid_new ();
 
   /* Pack the container in the window */
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   button = gtk_button_new_with_label ("Button 1");
   g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
diff --git a/examples/hello-world.c b/examples/hello-world.c
index 4005d66ca9..ebafc735c6 100644
--- a/examples/hello-world.c
+++ b/examples/hello-world.c
@@ -20,7 +20,7 @@ activate (GtkApplication *app,
   gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   button = gtk_button_new_with_label ("Hello World");
   g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
diff --git a/examples/plugman.c b/examples/plugman.c
index 1b33f0eeb4..752e2b9649 100644
--- a/examples/plugman.c
+++ b/examples/plugman.c
@@ -83,7 +83,7 @@ new_window (GApplication *app,
   gtk_window_set_title (GTK_WINDOW (window), "Plugman");
 
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   scrolled = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_set_hexpand (scrolled, TRUE);
diff --git a/examples/search-bar.c b/examples/search-bar.c
index 0a42a925ce..1657b2b874 100644
--- a/examples/search-bar.c
+++ b/examples/search-bar.c
@@ -15,7 +15,7 @@ activate_cb (GtkApplication *app,
 
   search_bar = gtk_search_bar_new ();
   gtk_widget_set_valign (search_bar, GTK_ALIGN_START);
-  gtk_container_add (GTK_CONTAINER (window), search_bar);
+  gtk_window_set_child (GTK_WINDOW (window), search_bar);
   gtk_widget_show (search_bar);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
diff --git a/examples/sunny.c b/examples/sunny.c
index 86d4d73fc0..bd67831451 100644
--- a/examples/sunny.c
+++ b/examples/sunny.c
@@ -19,7 +19,7 @@ new_window (GApplication *app,
   gtk_window_set_titlebar (GTK_WINDOW (window), header);
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (window), overlay);
+  gtk_window_set_child (GTK_WINDOW (window), overlay);
 
   scrolled = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_set_hexpand (scrolled, TRUE);
diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c
index 19a4da9798..742cfd2776 100644
--- a/gtk/a11y/gtkwindowaccessible.c
+++ b/gtk/a11y/gtkwindowaccessible.c
@@ -122,14 +122,6 @@ gtk_window_accessible_get_name (AtkObject *accessible)
       GtkWindow *window = GTK_WINDOW (widget);
 
       name = gtk_window_get_title (window);
-      if (name == NULL && accessible->role == ATK_ROLE_TOOL_TIP)
-        {
-          GtkWidget *child;
-
-          child = find_label_child (GTK_CONTAINER (window));
-          if (GTK_IS_LABEL (child))
-            name = gtk_label_get_text (GTK_LABEL (child));
-        }
     }
   return name;
 }
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 4f1416826e..dac7a04b59 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -114,7 +114,7 @@
  *    // Pack them into a box, then show all the widgets
  *    gtk_container_add (GTK_CONTAINER (box), radio1);
  *    gtk_container_add (GTK_CONTAINER (box), radio2);
- *    gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window),box);
  *    gtk_widget_show (window);
  *    return;
  * }
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index c59ef30ab8..0c790a6fff 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -144,7 +144,7 @@
  *
  *   // creates the spinbutton, with no decimal places
  *   button = gtk_spin_button_new (adjustment, 1.0, 0);
- *   gtk_container_add (GTK_CONTAINER (window), button);
+ *   gtk_window_set_child (GTK_WINDOW (window), button);
  *
  *   gtk_widget_show (window);
  * }
@@ -175,7 +175,7 @@
  *
  *   // creates the spinbutton, with three decimal places
  *   button = gtk_spin_button_new (adjustment, 0.001, 3);
- *   gtk_container_add (GTK_CONTAINER (window), button);
+ *   gtk_window_set_child (GTK_WINDOW (window), button);
  *
  *   gtk_widget_show (window);
  * }
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 32e8f31223..da5de35ae5 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -93,7 +93,7 @@
  *                     NULL);
  *   gtk_container_add (GTK_CONTAINER (box), toggle2);
  *
- *   gtk_container_add (GTK_CONTAINER (window), box);
+ *   gtk_window_set_child (GTK_WINDOW (window), box);
  *   gtk_widget_show (window);
  * }
  * ]|
diff --git a/gtk/inspector/fpsoverlay.c b/gtk/inspector/fpsoverlay.c
index a659c1dcdd..a1a4168e89 100644
--- a/gtk/inspector/fpsoverlay.c
+++ b/gtk/inspector/fpsoverlay.c
@@ -203,7 +203,7 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
 
   if (GTK_IS_WINDOW (widget))
     {
-      GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
+      GtkWidget *child = gtk_window_get_child (GTK_WINDOW (widget));
       if (!child ||
           !gtk_widget_compute_bounds (child, widget, &bounds))
         has_bounds = gtk_widget_compute_bounds (widget, widget, &bounds);
diff --git a/gtk/tools/gtk-builder-tool-preview.c b/gtk/tools/gtk-builder-tool-preview.c
index c1f6157570..70ca1fac28 100644
--- a/gtk/tools/gtk-builder-tool-preview.c
+++ b/gtk/tools/gtk-builder-tool-preview.c
@@ -137,7 +137,7 @@ preview_file (const char *filename,
       g_object_ref (widget);
       if (gtk_widget_get_parent (widget) != NULL)
         gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
-      gtk_container_add (GTK_CONTAINER (window), widget);
+      gtk_window_set_child (GTK_WINDOW (window), widget);
       g_object_unref (widget);
     }
 
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index 6ec091264d..b64559f439 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -203,7 +203,7 @@ main(int argc, char **argv)
 
   da = gtk_drawing_area_new ();
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), da);
+  gtk_window_set_child (GTK_WINDOW (window), da);
 
   g_signal_connect (window, "destroy",
                     G_CALLBACK (quit_cb), NULL);
diff --git a/tests/animated-revealing.c b/tests/animated-revealing.c
index a7a4d57674..73c890977b 100644
--- a/tests/animated-revealing.c
+++ b/tests/animated-revealing.c
@@ -60,7 +60,7 @@ main(int argc, char **argv)
   gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE);
   g_signal_connect_after (revealer, "map", G_CALLBACK (toggle_reveal), NULL);
   g_signal_connect_after (revealer, "notify::child-revealed", G_CALLBACK (toggle_reveal), NULL);
-  gtk_container_add (GTK_CONTAINER (window), revealer);
+  gtk_window_set_child (GTK_WINDOW (window), revealer);
 
   grid = gtk_grid_new ();
   gtk_container_add (GTK_CONTAINER (revealer), grid);
diff --git a/tests/gdkgears.c b/tests/gdkgears.c
index 4c5bb0725d..eba165b595 100644
--- a/tests/gdkgears.c
+++ b/tests/gdkgears.c
@@ -141,7 +141,7 @@ main (int argc, char *argv[])
   gtk_widget_set_margin_top (overlay, 12);
   gtk_widget_set_margin_bottom (overlay, 12);
 
-  gtk_container_add (GTK_CONTAINER (window), overlay);
+  gtk_window_set_child (GTK_WINDOW (window), overlay);
   gtk_widget_show (overlay);
 
   revealer = gtk_revealer_new ();
diff --git a/tests/listmodel.c b/tests/listmodel.c
index f4d88fe477..aaaabab9d1 100644
--- a/tests/listmodel.c
+++ b/tests/listmodel.c
@@ -192,7 +192,7 @@ main (int argc, char *argv[])
 
   window = gtk_window_new ();
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                   GTK_POLICY_AUTOMATIC,
diff --git a/tests/motion-compression.c b/tests/motion-compression.c
index b528395bb8..caba2bca3f 100644
--- a/tests/motion-compression.c
+++ b/tests/motion-compression.c
@@ -62,7 +62,7 @@ main (int argc, char **argv)
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   da = gtk_drawing_area_new ();
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
diff --git a/tests/overlayscroll.c b/tests/overlayscroll.c
index 4cb8e18f46..2aaabb3710 100644
--- a/tests/overlayscroll.c
+++ b/tests/overlayscroll.c
@@ -70,7 +70,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
diff --git a/tests/scrolling-performance.c b/tests/scrolling-performance.c
index db2fae820e..96fc298542 100644
--- a/tests/scrolling-performance.c
+++ b/tests/scrolling-performance.c
@@ -132,7 +132,7 @@ main (int argc, char **argv)
   gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), scrolled_window);
+  gtk_window_set_child (GTK_WINDOW (window), scrolled_window);
 
   viewport = gtk_viewport_new (NULL, NULL);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), viewport);
diff --git a/tests/showrendernode.c b/tests/showrendernode.c
index 02e30e7ca2..1f54217073 100644
--- a/tests/showrendernode.c
+++ b/tests/showrendernode.c
@@ -218,7 +218,7 @@ main (int argc, char **argv)
 
       gtk_container_add (GTK_CONTAINER (box), nodeview);
       gtk_container_add (GTK_CONTAINER (box), image);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       gsk_renderer_unrealize (renderer);
       g_object_unref (texture);
@@ -227,7 +227,7 @@ main (int argc, char **argv)
     }
   else
     {
-      gtk_container_add (GTK_CONTAINER (window), nodeview);
+      gtk_window_set_child (GTK_WINDOW (window), nodeview);
     }
 
   gsk_render_node_get_bounds (GTK_NODE_VIEW (nodeview)->node, &node_bounds);
diff --git a/tests/simple.c b/tests/simple.c
index 5cabb59cf5..2bf39223bc 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
   gtk_button_set_label (GTK_BUTTON (button), "hello world");
   g_signal_connect (button, "clicked", G_CALLBACK (hello), NULL);
 
-  gtk_container_add (GTK_CONTAINER (window), button);
+  gtk_window_set_child (GTK_WINDOW (window), button);
 
   gtk_widget_show (window);
 
diff --git a/tests/syncscroll.c b/tests/syncscroll.c
index aae3487413..4a0a8c6103 100644
--- a/tests/syncscroll.c
+++ b/tests/syncscroll.c
@@ -26,7 +26,7 @@ main (int argc, char *argv[])
   gtk_window_set_default_size (GTK_WINDOW (win), 640, 480);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
-  gtk_container_add (GTK_CONTAINER (win), box);
+  gtk_window_set_child (GTK_WINDOW (win), box);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
diff --git a/tests/testaccel.c b/tests/testaccel.c
index 0dc121d7b5..5a7ddd140c 100644
--- a/tests/testaccel.c
+++ b/tests/testaccel.c
@@ -74,7 +74,7 @@ key_test (void)
         gtk_widget_set_hexpand (sw, TRUE);
         box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
         gtk_widget_show (box);
-       gtk_container_add (GTK_CONTAINER (window), box);
+        gtk_window_set_child (GTK_WINDOW (window), box);
         gtk_container_add (GTK_CONTAINER (box), sw);
 
        store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT);
diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c
index bdb506ee86..2f5c227ef0 100644
--- a/tests/testadjustsize.c
+++ b/tests/testadjustsize.c
@@ -89,7 +89,7 @@ open_test_window (void)
 
   grid = gtk_grid_new ();
 
-  gtk_container_add (GTK_CONTAINER (test_window), grid);
+  gtk_window_set_child (GTK_WINDOW (test_window), grid);
 
   for (i = 0; i < TEST_WIDGET_LAST; ++i)
     {
@@ -146,7 +146,7 @@ open_control_window (void)
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   toggle =
     gtk_toggle_button_new_with_label ("Set small size requests");
@@ -253,7 +253,7 @@ open_alignment_window (void)
   gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
   gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
 
-  gtk_container_add (GTK_CONTAINER (test_window), grid);
+  gtk_window_set_child (GTK_WINDOW (test_window), grid);
 
   for (i = 0; i < align_class->n_values; ++i)
     {
@@ -308,7 +308,7 @@ open_margin_window (void)
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
-  gtk_container_add (GTK_CONTAINER (test_window), box);
+  gtk_window_set_child (GTK_WINDOW (test_window), box);
 
   for (i = 0; i < (int) G_N_ELEMENTS (margins); ++i)
     {
@@ -332,7 +332,7 @@ open_valigned_label_window (void)
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_widget_show (box);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   label = gtk_label_new ("Both labels expand");
   gtk_widget_show (label);
diff --git a/tests/testassistant.c b/tests/testassistant.c
index 365e8bd9f3..2d010753d3 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -719,7 +719,7 @@ main (int argc, gchar *argv[])
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quit_cb), &done);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   for (i = 0; i < G_N_ELEMENTS (buttons); i++)
     {
diff --git a/tests/testbaseline.c b/tests/testbaseline.c
index 7d9551ea3a..ba1129d4cc 100644
--- a/tests/testbaseline.c
+++ b/tests/testbaseline.c
@@ -103,7 +103,7 @@ main (int    argc,
   g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quit_cb), &done);
 
   notebook = gtk_notebook_new ();
-  gtk_container_add (GTK_CONTAINER (window), notebook);
+  gtk_window_set_child (GTK_WINDOW (window), notebook);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
diff --git a/tests/testblur.c b/tests/testblur.c
index 6baf0b01f9..21fa7774ae 100644
--- a/tests/testblur.c
+++ b/tests/testblur.c
@@ -124,7 +124,7 @@ main (int argc, char **argv)
   g_signal_connect (scale, "value-changed", G_CALLBACK (value_changed_cb2), value_label);
 
   gtk_container_add (GTK_CONTAINER (blur_box), scale);
-  gtk_container_add (GTK_CONTAINER (window), blur_box);
+  gtk_window_set_child (GTK_WINDOW (window), blur_box);
 
   gtk_widget_show (window);
 
diff --git a/tests/testborderdrawing.c b/tests/testborderdrawing.c
index 9456649d2c..68bba95902 100644
--- a/tests/testborderdrawing.c
+++ b/tests/testborderdrawing.c
@@ -164,7 +164,7 @@ main (int argc, char **argv)
 
   gtk_container_add (GTK_CONTAINER (box), top);
   gtk_container_add (GTK_CONTAINER (box), bottom);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   gtk_widget_show (window);
 
diff --git a/tests/testbox.c b/tests/testbox.c
index db28fdd4e1..1d91d6714d 100644
--- a/tests/testbox.c
+++ b/tests/testbox.c
@@ -89,7 +89,7 @@ main (int argc, char *argv[])
   window = gtk_window_new ();
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_container_add (GTK_CONTAINER (box), test_widget ("1"));
diff --git a/tests/testbuttons.c b/tests/testbuttons.c
index 417db54230..08f4418e29 100644
--- a/tests/testbuttons.c
+++ b/tests/testbuttons.c
@@ -33,7 +33,7 @@ int main (int argc, char *argv[])
 
        box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
-       gtk_container_add (GTK_CONTAINER (window), box);
+        gtk_window_set_child (GTK_WINDOW (window), box);
 
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        gtk_container_add (GTK_CONTAINER (box), hbox);
diff --git a/tests/testcairo.c b/tests/testcairo.c
index a6d661d678..4939738057 100644
--- a/tests/testcairo.c
+++ b/tests/testcairo.c
@@ -209,7 +209,7 @@ main (int argc, char **argv)
   gtk_window_set_title (GTK_WINDOW (window), "cairo: Knockout Groups");
 
   darea = gtk_drawing_area_new ();
-  gtk_container_add (GTK_CONTAINER (window), darea);
+  gtk_window_set_child (GTK_WINDOW (window), darea);
 
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), on_draw, NULL, NULL);
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index c453f7bec3..978316d88d 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -303,7 +303,7 @@ create_calendar(void)
   gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
   gtk_container_add (GTK_CONTAINER (vbox), bbox);
 
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   gtk_window_set_default_widget (GTK_WINDOW (window), button);
 
diff --git a/tests/testcellarea.c b/tests/testcellarea.c
index 9e538ac53a..1726b15807 100644
--- a/tests/testcellarea.c
+++ b/tests/testcellarea.c
@@ -252,7 +252,7 @@ simple_cell_area (void)
   g_signal_connect (G_OBJECT (widget), "toggled",
                     G_CALLBACK (expand_cell_3_toggled), iconview);
 
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
 
   gtk_widget_show (window);
 }
@@ -462,7 +462,7 @@ focus_cell_area (void)
   g_signal_connect (G_OBJECT (widget), "toggled",
                     G_CALLBACK (focus_sibling_toggled), iconview);
 
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
 
   gtk_widget_show (window);
 }
@@ -517,7 +517,7 @@ background_area (void)
   main_vbox  = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
   gtk_widget_show (hbox);
   gtk_widget_show (main_vbox);
-  gtk_container_add (GTK_CONTAINER (window), main_vbox);
+  gtk_window_set_child (GTK_WINDOW (window), main_vbox);
 
   gtk_window_set_title (GTK_WINDOW (window), "Background Area");
 
diff --git a/tests/testcellrenderertext.c b/tests/testcellrenderertext.c
index c5ec0a08ce..87f424330c 100644
--- a/tests/testcellrenderertext.c
+++ b/tests/testcellrenderertext.c
@@ -273,7 +273,7 @@ main (int argc, char **argv)
                    G_CALLBACK (quit_cb), &done);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   /* LTR */
 
diff --git a/tests/testcenterbox.c b/tests/testcenterbox.c
index 9c3412795b..0b420baea4 100644
--- a/tests/testcenterbox.c
+++ b/tests/testcenterbox.c
@@ -26,7 +26,7 @@ main (int argc, char *argv[])
 
   window = gtk_window_new ();
   box = gtk_center_box_new ();
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   child = gtk_label_new ("Start Start Start Start Start");
   gtk_label_set_ellipsize (GTK_LABEL (child), PANGO_ELLIPSIZE_END);
diff --git a/tests/testclipboard2.c b/tests/testclipboard2.c
index 7ea34e9bf7..7c93c302df 100644
--- a/tests/testclipboard2.c
+++ b/tests/testclipboard2.c
@@ -448,7 +448,7 @@ main (int argc, char **argv)
 
   window = gtk_window_new ();
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
-  gtk_container_add (GTK_CONTAINER (window),
+  gtk_window_set_child (GTK_WINDOW (window),
                      get_window_contents (gtk_widget_get_display (window),
                                           alt_display));
 
diff --git a/tests/testcombo.c b/tests/testcombo.c
index cdcb1d41a0..51aae6a300 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -954,7 +954,7 @@ main (int argc, char **argv)
         g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
         mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-        gtk_container_add (GTK_CONTAINER (window), mainbox);
+        gtk_window_set_child (GTK_WINDOW (window), mainbox);
 
         /* GtkCellView */
         tmp = gtk_frame_new ("GtkCellView");
diff --git a/tests/testdialog.c b/tests/testdialog.c
index 7b68f8a15d..57b99a8690 100644
--- a/tests/testdialog.c
+++ b/tests/testdialog.c
@@ -335,7 +335,7 @@ main (int argc, char *argv[])
   gtk_widget_set_halign (vbox, GTK_ALIGN_FILL);
   gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
   gtk_widget_show (vbox);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
   
   box = gtk_flow_box_new ();
   gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_NONE);
diff --git a/tests/testdnd.c b/tests/testdnd.c
index 7f4f1626cb..f6659a54c4 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -538,7 +538,7 @@ main (int argc, char **argv)
 
   
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   drag_icon = gdk_pixbuf_new_from_xpm_data (drag_icon_xpm);
   texture = gdk_texture_new_for_pixbuf (drag_icon);
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index e2b3bb6d30..e02dea97a4 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -415,7 +415,7 @@ main (int argc, char *Argv[])
                 "row-spacing", 20,
                 "column-spacing", 20,
                 NULL);
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_grid_attach (GTK_GRID (grid), make_image ("dialog-warning", TOP_LEFT), 0, 0, 1, 1);
   gtk_grid_attach (GTK_GRID (grid), make_image ("process-stop", BOTTOM_RIGHT), 1, 0, 1, 1);
 
diff --git a/tests/testdnd3.c b/tests/testdnd3.c
index 6234799b00..06f8c77bc0 100644
--- a/tests/testdnd3.c
+++ b/tests/testdnd3.c
@@ -272,7 +272,7 @@ int main (int argc, char *argv[])
   gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_container_add (GTK_CONTAINER (box), box2);
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index 616caf3969..0e2301625c 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   combo = gtk_combo_box_text_new ();
   scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
diff --git a/tests/testemblems.c b/tests/testemblems.c
index a98193c0a4..d94b56cafa 100644
--- a/tests/testemblems.c
+++ b/tests/testemblems.c
@@ -15,7 +15,7 @@ int main (int argc, char **argv)
        grid = gtk_grid_new ();
        gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
        gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
-       gtk_container_add (GTK_CONTAINER (window), grid);
+        gtk_window_set_child (GTK_WINDOW (window), grid);
 
         icon = g_themed_icon_new ("folder");
         button = gtk_image_new_from_gicon (icon);
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index 39bd22719d..2f726b53ef 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -314,7 +314,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
     
   label = gtk_label_new (NULL);
 
diff --git a/tests/testentryicons.c b/tests/testentryicons.c
index 5856f48fd9..3d6a4fdbea 100644
--- a/tests/testentryicons.c
+++ b/tests/testentryicons.c
@@ -111,7 +111,7 @@ main (int argc, char **argv)
                    G_CALLBACK (quit_cb), &done);
 
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
   gtk_widget_set_margin_start (grid, 10);
diff --git a/tests/testexpand.c b/tests/testexpand.c
index a6d20d8044..131eea5b2d 100644
--- a/tests/testexpand.c
+++ b/tests/testexpand.c
@@ -101,7 +101,7 @@ create_box_window (void)
   gtk_container_add (GTK_CONTAINER (box3),
                      gtk_label_new ("VBox 3 Bottom"));
 
-  gtk_container_add (GTK_CONTAINER (window), box1);
+  gtk_window_set_child (GTK_WINDOW (window), box1);
   gtk_widget_show (window);
 }
 
@@ -153,7 +153,7 @@ create_grid_window (void)
 
   gtk_grid_attach (GTK_GRID (grid), colorbox, 1, 2, 1, 1); 
 
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_widget_show (window);
 }
 
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index 9421409f3d..30ae1c0b90 100644
--- a/tests/testflowbox.c
+++ b/tests/testflowbox.c
@@ -386,7 +386,7 @@ create_window (void)
 
   gtk_widget_show (vbox);
   gtk_widget_show (hbox);
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
   gtk_container_add (GTK_CONTAINER (hbox), vbox);
 
   swindow = gtk_scrolled_window_new (NULL, NULL);
diff --git a/tests/testfontchooser.c b/tests/testfontchooser.c
index f48651941c..dedb011f9b 100644
--- a/tests/testfontchooser.c
+++ b/tests/testfontchooser.c
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
   window = gtk_window_new ();
   gtk_widget_set_size_request (window, 600, 600);
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_container_add (GTK_CONTAINER (box), fontchooser);
 
   gtk_widget_show (window);
diff --git a/tests/testfontchooserdialog.c b/tests/testfontchooserdialog.c
index 9468953d73..318baeb5b9 100644
--- a/tests/testfontchooserdialog.c
+++ b/tests/testfontchooserdialog.c
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
   gtk_font_button_set_use_font (GTK_FONT_BUTTON (font_button), TRUE);
 
   window = gtk_window_new ();
-  gtk_container_add (GTK_CONTAINER (window), font_button);
+  gtk_window_set_child (GTK_WINDOW (window), font_button);
   gtk_widget_show (window);
 
   g_signal_connect (font_button, "notify::font",
diff --git a/tests/testfontoptions.c b/tests/testfontoptions.c
index fdcd4bf6ea..e47d89c391 100644
--- a/tests/testfontoptions.c
+++ b/tests/testfontoptions.c
@@ -38,7 +38,7 @@ main (int argc, char *argv[])
   grid = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   label = gtk_label_new ("Default font options");
   gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 2, 1);
   demo = gtk_label_new ("Custom font options");
diff --git a/tests/testframe.c b/tests/testframe.c
index 45d4a51315..f52e0caeba 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -75,7 +75,7 @@ int main (int argc, char **argv)
   gtk_widget_set_margin_end (GTK_WIDGET (vbox), 12);
   gtk_widget_set_margin_top (GTK_WIDGET (vbox), 12);
   gtk_widget_set_margin_bottom (GTK_WIDGET (vbox), 12);
-  gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (vbox));
+  gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (vbox));
 
   frame = GTK_FRAME (gtk_frame_new ("Test GtkFrame"));
   gtk_widget_set_vexpand (GTK_WIDGET (frame), TRUE);
diff --git a/tests/testfullscreen.c b/tests/testfullscreen.c
index e22d190ce5..4a1e2ec2ec 100644
--- a/tests/testfullscreen.c
+++ b/tests/testfullscreen.c
@@ -74,7 +74,7 @@ main (int argc, char *argv[])
   gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
   gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
   gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   button = gtk_button_new_with_label ("Fullscreen on current monitor");
   g_signal_connect (button, "clicked", G_CALLBACK (set_fullscreen_monitor_cb), GINT_TO_POINTER 
(GDK_FULLSCREEN_ON_CURRENT_MONITOR));
diff --git a/tests/testgaction.c b/tests/testgaction.c
index 0800a15eb0..616fee0bf6 100644
--- a/tests/testgaction.c
+++ b/tests/testgaction.c
@@ -142,7 +142,7 @@ int main (int argc, char **argv)
   gtk_actionable_set_action_name (GTK_ACTIONABLE (button1), "win.change-label-button");
   gtk_container_add (GTK_CONTAINER (box), button1);
 
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   gtk_widget_show (window);
   while (TRUE)
diff --git a/tests/testglarea.c b/tests/testglarea.c
index 637e54488d..b32aa2cab0 100644
--- a/tests/testglarea.c
+++ b/tests/testglarea.c
@@ -422,7 +422,7 @@ main (int argc, char *argv[])
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
   gtk_box_set_spacing (GTK_BOX (box), 6);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_widget_show (box);
 
   gl_area = gtk_gl_area_new ();
diff --git a/tests/testglblending.c b/tests/testglblending.c
index a20c18eb63..01fb874bed 100644
--- a/tests/testglblending.c
+++ b/tests/testglblending.c
@@ -28,7 +28,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   fixed = gtk_fixed_new ();
-  gtk_container_add (GTK_CONTAINER (window), fixed);
+  gtk_window_set_child (GTK_WINDOW (window), fixed);
 
   spinner = gtk_spinner_new ();
   gtk_spinner_start (GTK_SPINNER (spinner));
diff --git a/tests/testgmenu.c b/tests/testgmenu.c
index 87134a124c..f435560967 100644
--- a/tests/testgmenu.c
+++ b/tests/testgmenu.c
@@ -644,7 +644,7 @@ main (int argc, char *argv[])
   window = gtk_window_new ();
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
 
diff --git a/tests/testgrid.c b/tests/testgrid.c
index c3c33a9f82..ba007a89b8 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -53,7 +53,7 @@ simple_grid (void)
   window = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window), "Orientation");
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   gesture = gtk_gesture_click_new ();
   g_signal_connect (gesture, "pressed", G_CALLBACK (toggle_orientation), grid);
@@ -98,7 +98,7 @@ text_grid (void)
   window = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window), "Height-for-Width");
   paned1 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-  gtk_container_add (GTK_CONTAINER (window), paned1);
+  gtk_window_set_child (GTK_WINDOW (window), paned1);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_paned_pack1 (GTK_PANED (paned1), box, TRUE, FALSE);
@@ -140,7 +140,7 @@ box_comparison (void)
   window = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window), "Grid vs. Box");
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Above"));
   gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
@@ -203,7 +203,7 @@ empty_line (void)
   window = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window), "Empty row");
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
@@ -231,7 +231,7 @@ empty_grid (void)
   window = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window), "Empty grid");
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
@@ -262,7 +262,7 @@ scrolling (void)
   viewport = gtk_viewport_new (NULL, NULL);
   grid = gtk_grid_new ();
 
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), viewport);
   gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid);
 
@@ -301,7 +301,7 @@ insert_cb (GtkButton *button, GtkWidget *window)
   GtkWidget *child;
   gboolean inserted;
 
-  g = GTK_GRID (gtk_bin_get_child (GTK_BIN (window)));
+  g = GTK_GRID (gtk_window_get_child (GTK_WINDOW (window)));
   g1 = GTK_GRID (gtk_grid_get_child_at (g, 0, 0));
   g2 = GTK_GRID (gtk_grid_get_child_at (g, 1, 0));
   g3 = GTK_GRID (gtk_grid_get_child_at (g, 0, 1));
@@ -358,7 +358,7 @@ insert (void)
   g = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (g), 10);
   gtk_grid_set_column_spacing (GTK_GRID (g), 10);
-  gtk_container_add (GTK_CONTAINER (window), g);
+  gtk_window_set_child (GTK_WINDOW (window), g);
 
   grid = gtk_grid_new ();
   gtk_grid_attach (GTK_GRID (g), grid, 0, 0, 1, 1);
@@ -421,7 +421,7 @@ spanning_grid (void)
   gtk_window_set_title (GTK_WINDOW (window), "Spanning");
 
   g = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), g);
+  gtk_window_set_child (GTK_WINDOW (window), g);
 
   c = test_widget ("0", "blue");
   gtk_widget_set_hexpand (c, TRUE);
diff --git a/tests/testgridbaseline.c b/tests/testgridbaseline.c
index db4e01b9d6..e96b5fd612 100644
--- a/tests/testgridbaseline.c
+++ b/tests/testgridbaseline.c
@@ -19,7 +19,7 @@ main (int argc, char *argv[])
   grid = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (grid), 30);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 30);
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   label1 = gtk_label_new ("Some Text");
   label2 = gtk_label_new ("QQQQQQQQQ");
diff --git a/tests/testgrouping.c b/tests/testgrouping.c
index a1d44468e5..01bfc3b3f5 100644
--- a/tests/testgrouping.c
+++ b/tests/testgrouping.c
@@ -126,7 +126,7 @@ main (int argc, char **argv)
   gtk_window_set_default_size (GTK_WINDOW (window), 320, 480);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
 
   tv = gtk_tree_view_new_with_model (model);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index f123ed07b1..697b4b0b35 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -279,7 +279,7 @@ create_buttons (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "GtkButton");
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       grid = gtk_grid_new ();
       gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
@@ -354,7 +354,7 @@ create_toggle_buttons (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "GtkToggleButton");
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
       gtk_container_add (GTK_CONTAINER (box1), box2);
@@ -725,7 +725,7 @@ create_statusbar (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "statusbar");
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
       gtk_container_add (GTK_CONTAINER (box1), box2);
@@ -941,7 +941,7 @@ static void create_labels (GtkWidget *widget)
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
 
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
 
       button = create_sensitivity_control (hbox);
@@ -1235,7 +1235,7 @@ create_pixbuf (GtkWidget *widget)
       gtk_widget_realize(window);
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
       gtk_container_add (GTK_CONTAINER (box1), box2);
@@ -1310,7 +1310,7 @@ create_tooltips (GtkWidget *widget)
                              gtk_widget_get_display (widget));
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
       gtk_container_add (GTK_CONTAINER (box1), box2);
@@ -1418,7 +1418,7 @@ create_image (GtkWidget *widget)
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
 
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       pack_image (vbox, "Stock Warning Dialog", gtk_image_new_from_icon_name ("dialog-warning"));
 
@@ -1541,7 +1541,7 @@ create_listbox (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "listbox");
 
       hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), hbox);
+      gtk_window_set_child (GTK_WINDOW (window), hbox);
 
       scrolled = gtk_scrolled_window_new (NULL, NULL);
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, 
GTK_POLICY_AUTOMATIC);
@@ -1786,7 +1786,7 @@ create_modal_window (GtkWidget *widget)
   btnClose = gtk_button_new_with_label ("Close");
 
   /* Pack widgets */
-  gtk_container_add (GTK_CONTAINER (window), box1);
+  gtk_window_set_child (GTK_WINDOW (window), box1);
   gtk_container_add (GTK_CONTAINER (box1), frame1);
   gtk_frame_set_child (GTK_FRAME (frame1), box2);
   gtk_container_add (GTK_CONTAINER (box2), btnColor);
@@ -2130,7 +2130,7 @@ create_entry (GtkWidget *widget)
 
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
 
       box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
@@ -2226,7 +2226,7 @@ create_expander (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "expander");
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       expander = gtk_expander_new ("The Hidden");
 
@@ -2621,7 +2621,7 @@ create_spins (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "GtkSpinButton");
 
       main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-      gtk_container_add (GTK_CONTAINER (window), main_vbox);
+      gtk_window_set_child (GTK_WINDOW (window), main_vbox);
 
       frame = gtk_frame_new ("Not accelerated");
       gtk_container_add (GTK_CONTAINER (main_vbox), frame);
@@ -3063,7 +3063,7 @@ create_cursors (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "Cursors");
 
       main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-      gtk_container_add (GTK_CONTAINER (window), main_vbox);
+      gtk_window_set_child (GTK_WINDOW (window), main_vbox);
 
       vbox = g_object_new (GTK_TYPE_BOX,
                            "orientation", GTK_ORIENTATION_VERTICAL,
@@ -3190,7 +3190,7 @@ create_color_selection (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "GtkColorButton");
 
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
-      gtk_container_add (GTK_CONTAINER (window), hbox);
+      gtk_window_set_child (GTK_WINDOW (window), hbox);
       
       label = gtk_label_new ("Pick a color");
       gtk_container_add (GTK_CONTAINER (hbox), label);
@@ -3367,7 +3367,7 @@ create_font_selection (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "GtkFontButton");
 
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
-      gtk_container_add (GTK_CONTAINER (window), hbox);
+      gtk_window_set_child (GTK_WINDOW (window), hbox);
       
       label = gtk_label_new ("Pick a font");
       gtk_container_add (GTK_CONTAINER (hbox), label);
@@ -3553,7 +3553,7 @@ create_display_screen (GtkWidget *widget)
                    G_CALLBACK (gtk_widget_destroy), NULL);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
   
   frame = gtk_frame_new ("Select display");
   gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -3637,7 +3637,7 @@ create_range_controls (GtkWidget *widget)
 
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
       gtk_widget_show (box1);
 
 
@@ -4017,7 +4017,7 @@ create_notebook (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "notebook");
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       sample_notebook = gtk_notebook_new ();
       g_signal_connect (sample_notebook, "switch_page",
@@ -4216,7 +4216,7 @@ create_panes (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "Panes");
 
       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), vbox);
+      gtk_window_set_child (GTK_WINDOW (window), vbox);
 
       vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
       gtk_container_add (GTK_CONTAINER (vbox), vpaned);
@@ -4296,7 +4296,7 @@ paned_keyboard_window1 (GtkWidget *widget)
                          gtk_widget_get_display (widget));
 
   hpaned1 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-  gtk_container_add (GTK_CONTAINER (window1), hpaned1);
+  gtk_window_set_child (GTK_WINDOW (window1), hpaned1);
 
   frame1 = gtk_frame_new (NULL);
   gtk_paned_pack1 (GTK_PANED (hpaned1), frame1, FALSE, TRUE);
@@ -4377,7 +4377,7 @@ paned_keyboard_window2 (GtkWidget *widget)
                          gtk_widget_get_display (widget));
 
   hpaned2 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-  gtk_container_add (GTK_CONTAINER (window2), hpaned2);
+  gtk_window_set_child (GTK_WINDOW (window2), hpaned2);
 
   frame6 = gtk_frame_new (NULL);
   gtk_paned_pack1 (GTK_PANED (hpaned2), frame6, FALSE, TRUE);
@@ -4436,7 +4436,7 @@ paned_keyboard_window3 (GtkWidget *widget)
 
 
   vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window3), vbox2);
+  gtk_window_set_child (GTK_WINDOW (window3), vbox2);
 
   label1 = gtk_label_new ("Three panes nested inside each other");
   gtk_container_add (GTK_CONTAINER (vbox2), label1);
@@ -4506,7 +4506,7 @@ paned_keyboard_window4 (GtkWidget *widget)
                         gtk_widget_get_display (widget));
 
   vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window4), vbox3);
+  gtk_window_set_child (GTK_WINDOW (window4), vbox3);
 
   label2 = gtk_label_new ("Widget tree:\n\nhpaned \n - vpaned\n - hbox\n    - vpaned\n    - vpaned\n    - 
vpaned\n");
   gtk_container_add (GTK_CONTAINER (vbox3), label2);
@@ -4669,7 +4669,7 @@ create_wmhints (GtkWidget *widget)
       g_object_unref (pixbuf);
 
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
       gtk_widget_show (box1);
 
       label = gtk_label_new ("Try iconizing me!");
@@ -4901,7 +4901,7 @@ create_surface_states (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (window), "Window states");
       
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), box1);
+      gtk_window_set_child (GTK_WINDOW (window), box1);
 
       iconified = gtk_window_new ();
 
@@ -5885,7 +5885,7 @@ create_native_dialogs (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW(window), "Native dialog parent");
 
       box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-      gtk_container_add (GTK_CONTAINER (window), box);
+      gtk_window_set_child (GTK_WINDOW (window), box);
 
       label = gtk_label_new ("");
       gtk_container_add (GTK_CONTAINER (box), label);
@@ -6043,7 +6043,7 @@ create_main_window (void)
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box1);
+  gtk_window_set_child (GTK_WINDOW (window), box1);
 
   if (gtk_get_micro_version () > 0)
     sprintf (buffer,
diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c
index 8fea9d36ac..539ed3bbae 100644
--- a/tests/testheaderbar.c
+++ b/tests/testheaderbar.c
@@ -139,7 +139,7 @@ main (int argc, char *argv[])
   change_header (NULL, window);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   content = gtk_image_new_from_icon_name ("start-here-symbolic");
   gtk_image_set_pixel_size (GTK_IMAGE (content), 512);
diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c
index ae4ae9cc13..41c62f24b6 100644
--- a/tests/testheightforwidth.c
+++ b/tests/testheightforwidth.c
@@ -816,7 +816,7 @@ create_window (void)
   gtk_widget_set_margin_top (vbox, 8);
   gtk_widget_set_margin_bottom (vbox, 8);
 
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   for (i = 0; i < G_N_ELEMENTS (interfaces); i++)
     {
diff --git a/tests/testhover.c b/tests/testhover.c
index 7b846b6b29..daf4c1cb07 100644
--- a/tests/testhover.c
+++ b/tests/testhover.c
@@ -109,7 +109,7 @@ test1 (void)
   gtk_window_set_title (GTK_WINDOW (win), "add/remove");
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
-  gtk_container_add (GTK_CONTAINER (win), box);
+  gtk_window_set_child (GTK_WINDOW (win), box);
   controller = annoying_event_controller_motion_new ();
   g_signal_connect (controller, "enter", G_CALLBACK (enter1_cb), NULL);
   g_signal_connect (controller, "leave", G_CALLBACK (leave1_cb), NULL);
@@ -153,7 +153,7 @@ test2 (void)
   gtk_window_set_title (GTK_WINDOW (win), "show/hide");
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
-  gtk_container_add (GTK_CONTAINER (win), box);
+  gtk_window_set_child (GTK_WINDOW (win), box);
   controller = annoying_event_controller_motion_new ();
   g_signal_connect (controller, "enter", G_CALLBACK (enter2_cb), NULL);
   g_signal_connect (controller, "leave", G_CALLBACK (leave2_cb), NULL);
@@ -197,7 +197,7 @@ test3 (void)
   gtk_window_set_title (GTK_WINDOW (win), "child-visible");
 
   stack = gtk_stack_new ();
-  gtk_container_add (GTK_CONTAINER (win), stack);
+  gtk_window_set_child (GTK_WINDOW (win), stack);
   controller = annoying_event_controller_motion_new ();
   g_signal_connect (controller, "enter", G_CALLBACK (enter3_cb), NULL);
   g_signal_connect (controller, "leave", G_CALLBACK (leave3_cb), NULL);
@@ -243,7 +243,7 @@ test4 (void)
   gtk_window_set_title (GTK_WINDOW (win), "move");
 
   fixed = gtk_fixed_new ();
-  gtk_container_add (GTK_CONTAINER (win), fixed);
+  gtk_window_set_child (GTK_WINDOW (win), fixed);
   controller = annoying_event_controller_motion_new ();
   g_signal_connect (controller, "enter", G_CALLBACK (enter4_cb), NULL);
   g_signal_connect (controller, "leave", G_CALLBACK (leave4_cb), NULL);
diff --git a/tests/testicontheme.c b/tests/testicontheme.c
index 03495125bb..ae88684b97 100644
--- a/tests/testicontheme.c
+++ b/tests/testicontheme.c
@@ -106,7 +106,7 @@ main (int argc, char *argv[])
       image = gtk_image_new ();
       gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (icon));
       g_object_unref (icon);
-      gtk_container_add (GTK_CONTAINER (window), image);
+      gtk_window_set_child (GTK_WINDOW (window), image);
       g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
       gtk_widget_show (window);
 
diff --git a/tests/testiconview-keynav.c b/tests/testiconview-keynav.c
index 50277502d2..5c4dcdbac5 100644
--- a/tests/testiconview-keynav.c
+++ b/tests/testiconview-keynav.c
@@ -234,7 +234,7 @@ main (int argc, char *argv[])
 
   window = gtk_window_new ();
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   views.header1 = g_object_new (GTK_TYPE_LABEL,
                                 "label", "<b>Group 1</b>",
diff --git a/tests/testiconview.c b/tests/testiconview.c
index cd40c6e63b..102eed4d33 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -417,7 +417,7 @@ main (gint argc, gchar **argv)
   gtk_window_set_default_size (GTK_WINDOW (window), 700, 400);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_widget_set_vexpand (paned, TRUE);
diff --git a/tests/testinfobar.c b/tests/testinfobar.c
index 874db9cc52..9145aba9c2 100644
--- a/tests/testinfobar.c
+++ b/tests/testinfobar.c
@@ -86,7 +86,7 @@ on_activate (GApplication *application,
                     G_CALLBACK (on_info_bar_response), widget);
 
   widget = gtk_window_new ();
-  gtk_container_add (GTK_CONTAINER (widget), box);
+  gtk_window_set_child (GTK_WINDOW (widget), box);
   gtk_widget_show (widget);
   gtk_application_add_window (GTK_APPLICATION (application),
                               GTK_WINDOW (widget));
diff --git a/tests/testinhibitshortcuts.c b/tests/testinhibitshortcuts.c
index 6de7a89cfe..abdf232569 100644
--- a/tests/testinhibitshortcuts.c
+++ b/tests/testinhibitshortcuts.c
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
   surface = gtk_native_get_surface (gtk_widget_get_native (window));
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   text_view = gtk_text_view_new ();
   gtk_widget_set_hexpand (text_view, TRUE);
diff --git a/tests/testkineticscrolling.c b/tests/testkineticscrolling.c
index 90944de2f9..e5355e3aa9 100644
--- a/tests/testkineticscrolling.c
+++ b/tests/testkineticscrolling.c
@@ -131,7 +131,7 @@ kinetic_scrolling (void)
   gtk_widget_set_vexpand (swindow, TRUE);
   gtk_widget_show (swindow);
 
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_widget_show (grid);
 
   gtk_widget_show (window);
diff --git a/tests/testlevelbar.c b/tests/testlevelbar.c
index 0d9cb34d44..e9fd02df91 100644
--- a/tests/testlevelbar.c
+++ b/tests/testlevelbar.c
@@ -97,7 +97,7 @@ main (int argc, char *argv[])
   gtk_widget_set_margin_top (box, 20);
   gtk_widget_set_margin_bottom (box, 20);
   bar = create_level_bar ();
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_container_add (GTK_CONTAINER (box), bar);
   box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
   gtk_container_add (GTK_CONTAINER (box), box2);
diff --git a/tests/testlist.c b/tests/testlist.c
index 14a6ceb3f8..d0ff42a902 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -259,7 +259,7 @@ main (int argc, char *argv[])
 
   window = gtk_window_new ();
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
 
   provider = gtk_css_provider_new ();
   gtk_css_provider_load_from_data (provider, css, -1);
diff --git a/tests/testlist2.c b/tests/testlist2.c
index 3dfb4702c2..1aa933d3c2 100644
--- a/tests/testlist2.c
+++ b/tests/testlist2.c
@@ -122,7 +122,7 @@ int main (int argc, char *argv[])
   gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
   gtk_list_box_set_header_func (GTK_LIST_BOX (list), add_separator, NULL, NULL);
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
 
   for (i = 0; i < 20; i++)
diff --git a/tests/testlist3.c b/tests/testlist3.c
index 00444ab777..bc2f61e83f 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -139,7 +139,7 @@ main (int argc, char *argv[])
   gtk_window_set_default_size (GTK_WINDOW (window), -1, 300);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_widget_set_margin_start (vbox, 12);
   gtk_widget_set_margin_end (vbox, 12);
diff --git a/tests/testlist4.c b/tests/testlist4.c
index 8f4294e2f5..d820d58b52 100644
--- a/tests/testlist4.c
+++ b/tests/testlist4.c
@@ -101,7 +101,7 @@ new_window (GApplication *app)
 
   /* widget creation */
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_set_hexpand (GTK_WIDGET (sw), true);
   gtk_widget_set_vexpand (GTK_WIDGET (sw), true);
diff --git a/tests/testlockbutton.c b/tests/testlockbutton.c
index e6622b4486..da37f6c897 100644
--- a/tests/testlockbutton.c
+++ b/tests/testlockbutton.c
@@ -227,7 +227,7 @@ main (int argc, char *argv[])
   gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   allowed_button = gtk_check_button_new_with_label ("Allowed");
   gtk_container_add (GTK_CONTAINER (box), allowed_button);
diff --git a/tests/testlogout.c b/tests/testlogout.c
index e028c0d0fd..2d9cd215bd 100644
--- a/tests/testlogout.c
+++ b/tests/testlogout.c
@@ -86,7 +86,7 @@ activate (GtkApplication *app,
   gtk_widget_set_margin_end (box, 12);
   gtk_widget_set_margin_top (box, 12);
   gtk_widget_set_margin_bottom (box, 12);
-  gtk_container_add (GTK_CONTAINER (win), box);
+  gtk_window_set_child (GTK_WINDOW (win), box);
 
   grid = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
diff --git a/tests/testmenubutton.c b/tests/testmenubutton.c
index cb2b647b0f..7ef5eaa4b0 100644
--- a/tests/testmenubutton.c
+++ b/tests/testmenubutton.c
@@ -52,7 +52,7 @@ int main (int argc, char **argv)
        grid = gtk_grid_new ();
        gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
        gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
-       gtk_container_add (GTK_CONTAINER (window), grid);
+       gtk_window_set_child (GTK_WINDOW (window), grid);
 
        /* horizontal alignment */
        label = gtk_label_new ("Horizontal Alignment:");
diff --git a/tests/testnoscreen.c b/tests/testnoscreen.c
index e213277a3e..72b0c8daaf 100644
--- a/tests/testnoscreen.c
+++ b/tests/testnoscreen.c
@@ -35,7 +35,7 @@ int main (int argc, char *argv[])
 
   window = gtk_window_new ();
   button = gtk_button_new ();
-  gtk_container_add (GTK_CONTAINER (window), button);
+  gtk_window_set_child (GTK_WINDOW (window), button);
 
   display = gdk_display_open (NULL);
 
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index a93c6d4dcb..b55028299b 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -72,7 +72,7 @@ window_creation_function (GtkNotebook *source_notebook,
   gtk_notebook_set_group_name (GTK_NOTEBOOK (notebook),
                                gtk_notebook_get_group_name (source_notebook));
 
-  gtk_container_add (GTK_CONTAINER (window), notebook);
+  gtk_window_set_child (GTK_WINDOW (window), notebook);
 
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
   gtk_widget_show (window);
@@ -317,7 +317,7 @@ main (gint argc, gchar *argv[])
                    create_trash_button (),
                    1, 2, 1, 1);
 
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
 
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testorientable.c b/tests/testorientable.c
index f0f98627e6..0ffa5b184c 100644
--- a/tests/testorientable.c
+++ b/tests/testorientable.c
@@ -91,7 +91,7 @@ main (int argc, char **argv)
   g_signal_connect (button, "toggled",
                   G_CALLBACK (orient_toggled), orientables);
 
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
   gtk_widget_show (window);
 
   g_signal_connect (window, "destroy",
diff --git a/tests/testoutsetshadowdrawing.c b/tests/testoutsetshadowdrawing.c
index 0966f42ddf..49ee0d12f9 100644
--- a/tests/testoutsetshadowdrawing.c
+++ b/tests/testoutsetshadowdrawing.c
@@ -162,7 +162,7 @@ main (int argc, char **argv)
 
   gtk_container_add (GTK_CONTAINER (box), top);
   gtk_container_add (GTK_CONTAINER (box), bottom);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   gtk_widget_show (window);
 
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 54b92789f0..210fe7594b 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -50,7 +50,7 @@ test_nonzerox (void)
   gtk_widget_set_margin_top (grid, 5);
   gtk_widget_set_margin_bottom (grid, 5);
 
-  gtk_container_add (GTK_CONTAINER (win), grid);
+  gtk_window_set_child (GTK_WINDOW (win), grid);
   gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Above"), 1, 0, 1, 1);
   gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Below"), 1, 2, 1, 1);
   gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Left"), 0, 1, 1, 1);
@@ -135,7 +135,7 @@ test_relative (void)
   gtk_window_set_title (GTK_WINDOW (win), "Custom positioning");
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   grid = gtk_grid_new ();
   gtk_container_add (GTK_CONTAINER (overlay), grid);
@@ -190,7 +190,7 @@ test_fullwidth (void)
   gtk_window_set_title (GTK_WINDOW (win), "Full-width");
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   text = gtk_text_view_new ();
   gtk_widget_set_size_request (text, 200, 200);
@@ -227,7 +227,7 @@ test_scrolling (void)
   gtk_window_set_title (GTK_WINDOW (win), "Scrolling");
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 200);
@@ -373,7 +373,7 @@ test_chase (void)
   gtk_window_set_title (GTK_WINDOW (win), "Chase");
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 200);
@@ -446,7 +446,7 @@ test_stacking (void)
   gtk_container_add (GTK_CONTAINER (overlay), main_child);
   gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child);
   gtk_grid_attach (GTK_GRID (grid), overlay, 1, 0, 1, 3);
-  gtk_container_add (GTK_CONTAINER (win), grid);
+  gtk_window_set_child (GTK_WINDOW (win), grid);
 
   gtk_grid_attach (GTK_GRID (grid), check1, 0, 0, 1, 1);
   gtk_grid_attach (GTK_GRID (grid), check2, 0, 1, 1, 1);
@@ -505,7 +505,7 @@ test_input_stacking (void)
   gtk_container_add (GTK_CONTAINER (vbox), entry);
 
 
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   return win;
 }
diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c
index 4243e1e7e9..5cff97abb6 100644
--- a/tests/testoverlaystyleclass.c
+++ b/tests/testoverlaystyleclass.c
@@ -150,7 +150,7 @@ main (int argc, char *argv[])
                     G_CALLBACK (overlay_get_child_position), child);
 
   gtk_grid_attach (GTK_GRID (grid), overlay, 1, 0, 1, 3);
-  gtk_container_add (GTK_CONTAINER (win), grid);
+  gtk_window_set_child (GTK_WINDOW (win), grid);
 
   g_print ("\n");
 
diff --git a/tests/testpixbuf-scale.c b/tests/testpixbuf-scale.c
index 8d4ec92fc5..eef877a2c1 100644
--- a/tests/testpixbuf-scale.c
+++ b/tests/testpixbuf-scale.c
@@ -104,7 +104,7 @@ main(int argc, char **argv)
                          G_CALLBACK (quit_cb), &done);
        
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_container_add (GTK_CONTAINER (window), vbox);
+       gtk_window_set_child (GTK_WINDOW (window), vbox);
 
         combo_box = gtk_combo_box_text_new ();
 
diff --git a/tests/testplacesview.c b/tests/testplacesview.c
index 84974ee36e..50e00e99cc 100644
--- a/tests/testplacesview.c
+++ b/tests/testplacesview.c
@@ -27,7 +27,7 @@ main (int argc, char *argv[])
 
   view = gtk_places_view_new ();
 
-  gtk_container_add (GTK_CONTAINER (win), view);
+  gtk_window_set_child (GTK_WINDOW (win), view);
   gtk_widget_show (win);
 
   g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testpopover.c b/tests/testpopover.c
index a18c5f4459..5d3b0fff05 100644
--- a/tests/testpopover.c
+++ b/tests/testpopover.c
@@ -82,7 +82,7 @@ main (int argc, char *argv[])
   gtk_widget_insert_action_group (win, "top", G_ACTION_GROUP (actions));
 
   overlay = gtk_overlay_new ();
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
 
   grid = gtk_grid_new ();
   gtk_widget_set_halign (grid, GTK_ALIGN_FILL);
diff --git a/tests/testrevealer.c b/tests/testrevealer.c
index 81e4d8bd2f..575d6aa15b 100644
--- a/tests/testrevealer.c
+++ b/tests/testrevealer.c
@@ -12,7 +12,7 @@ main (gint argc,
   gtk_widget_set_size_request (window, 300, 300);
 
   box = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
   gtk_widget_set_margin_top (widget, 10);
diff --git a/tests/testrevealer2.c b/tests/testrevealer2.c
index dfdb1d9fc3..e44bf22a17 100644
--- a/tests/testrevealer2.c
+++ b/tests/testrevealer2.c
@@ -34,7 +34,7 @@ on_activate (GApplication *app,
 
       /* content */
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-      gtk_container_add (GTK_CONTAINER (window), hbox);
+      gtk_window_set_child (GTK_WINDOW (window), hbox);
 
       revealer = gtk_revealer_new ();
       gtk_revealer_set_transition_type (GTK_REVEALER (revealer),
diff --git a/tests/testscale.c b/tests/testscale.c
index 735ac6474c..797f77d8da 100644
--- a/tests/testscale.c
+++ b/tests/testscale.c
@@ -136,7 +136,7 @@ int main (int argc, char *argv[])
   gtk_widget_set_hexpand (flipbox, TRUE);
   gtk_widget_set_vexpand (flipbox, TRUE);
   gtk_container_add (GTK_CONTAINER (box1), box);
-  gtk_container_add (GTK_CONTAINER (window), box1);
+  gtk_window_set_child (GTK_WINDOW (window), box1);
 
   frame = gtk_frame_new ("No marks");
   scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
diff --git a/tests/testscrolledge.c b/tests/testscrolledge.c
index af674571d8..b6b393167f 100644
--- a/tests/testscrolledge.c
+++ b/tests/testscrolledge.c
@@ -125,7 +125,7 @@ main (int argc, char *argv[])
   list = gtk_list_box_new ();
   gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
 
-  gtk_container_add (GTK_CONTAINER (win), overlay);
+  gtk_window_set_child (GTK_WINDOW (win), overlay);
   gtk_container_add (GTK_CONTAINER (overlay), sw);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
   populate_list (GTK_LIST_BOX (list));
diff --git a/tests/testscrolledwindow.c b/tests/testscrolledwindow.c
index 7c181227cf..6ea0fa354e 100644
--- a/tests/testscrolledwindow.c
+++ b/tests/testscrolledwindow.c
@@ -89,7 +89,7 @@ scrollable_policy (void)
 
   gtk_widget_show (vbox);
   gtk_widget_show (hbox);
-  gtk_container_add (GTK_CONTAINER (window), hbox);
+  gtk_window_set_child (GTK_WINDOW (window), hbox);
   gtk_container_add (GTK_CONTAINER (hbox), vbox);
 
   frame = gtk_frame_new ("Scrolled Window");
diff --git a/tests/testscrolltofocus.c b/tests/testscrolltofocus.c
index 58c5083442..e524988a3d 100644
--- a/tests/testscrolltofocus.c
+++ b/tests/testscrolltofocus.c
@@ -11,7 +11,7 @@ int main (int argc, char *argv[])
 
   window = gtk_window_new ();
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (sw)),
                                gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw)));
   gtk_viewport_set_scroll_to_focus (GTK_VIEWPORT (viewport), TRUE);
diff --git a/tests/testsensitive.c b/tests/testsensitive.c
index a7badb9aaf..7f8b0be77e 100644
--- a/tests/testsensitive.c
+++ b/tests/testsensitive.c
@@ -62,7 +62,7 @@ int main (int argc, char *argv[])
 
   window = gtk_window_new ();
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 15);
   gtk_container_add (GTK_CONTAINER (box), w);
diff --git a/tests/testsounds.c b/tests/testsounds.c
index 169120eb71..3a62f69fae 100644
--- a/tests/testsounds.c
+++ b/tests/testsounds.c
@@ -49,7 +49,7 @@ int main (int argc, char *argv[])
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
   gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
   gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   button = gtk_button_new_with_label ("Α");
   g_signal_connect (button, "clicked", G_CALLBACK (enter), NULL);
diff --git a/tests/testspinbutton.c b/tests/testspinbutton.c
index 9ba8d23148..ca1ff40b67 100644
--- a/tests/testspinbutton.c
+++ b/tests/testspinbutton.c
@@ -45,7 +45,7 @@ prepare_window_for_orientation (GtkOrientation orientation)
   g_signal_connect (window, "close-request", G_CALLBACK (on_delete), NULL);
 
   mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL ^ orientation, 2);
-  gtk_container_add (GTK_CONTAINER (window), mainbox);
+  gtk_window_set_child (GTK_WINDOW (window), mainbox);
 
   wrap_button = gtk_toggle_button_new_with_label ("Wrap");
   gtk_container_add (GTK_CONTAINER (mainbox), wrap_button);
diff --git a/tests/teststack.c b/tests/teststack.c
index 079a7ff104..00b21226a4 100644
--- a/tests/teststack.c
+++ b/tests/teststack.c
@@ -126,7 +126,7 @@ main (gint argc,
   gtk_widget_set_size_request (window, 300, 300);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   switcher = gtk_stack_switcher_new ();
   gtk_container_add (GTK_CONTAINER (box), switcher);
diff --git a/tests/testswitch.c b/tests/testswitch.c
index ec6bab4619..0a3644ab6b 100644
--- a/tests/testswitch.c
+++ b/tests/testswitch.c
@@ -173,7 +173,7 @@ int main (int argc, char *argv[])
   gtk_widget_show (window);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   hbox = make_switch (FALSE, TRUE);
   gtk_container_add (GTK_CONTAINER (vbox), hbox);
diff --git a/tests/testtexture.c b/tests/testtexture.c
index dff9626fd0..78c5464949 100644
--- a/tests/testtexture.c
+++ b/tests/testtexture.c
@@ -143,7 +143,7 @@ main (int argc, char **argv)
   view = g_object_new (GTK_TYPE_TEXTURE_VIEW, NULL);
   ((GtkTextureView*)view)->texture = g_steal_pointer (&texture);
 
-  gtk_container_add (GTK_CONTAINER (window), view);
+  gtk_window_set_child (GTK_WINDOW (window), view);
 
   gtk_widget_show (window);
 
diff --git a/tests/testtextview.c b/tests/testtextview.c
index c5918355b4..a8aa9da101 100644
--- a/tests/testtextview.c
+++ b/tests/testtextview.c
@@ -192,7 +192,7 @@ main (int argc, char **argv)
   create_tags (buffer);
   anchor = insert_text (buffer);
 
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
   gtk_text_view_add_overlay (GTK_TEXT_VIEW (textview),
                              button,
diff --git a/tests/testtextview2.c b/tests/testtextview2.c
index 42a7e08f42..b7a2af89c3 100644
--- a/tests/testtextview2.c
+++ b/tests/testtextview2.c
@@ -199,7 +199,7 @@ main (int argc, char *argv[])
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_set_hexpand (sw, TRUE);
   gtk_widget_set_vexpand (sw, TRUE);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_container_add (GTK_CONTAINER (box), sw);
 
   tv = gtk_text_view_new ();
diff --git a/tests/testtoolbar2.c b/tests/testtoolbar2.c
index 82f8918e3d..50698713d8 100644
--- a/tests/testtoolbar2.c
+++ b/tests/testtoolbar2.c
@@ -14,7 +14,7 @@ int main (int argc, char *argv[])
   window = gtk_window_new ();
   gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   frame = gtk_frame_new (NULL);
   gtk_container_add (GTK_CONTAINER (box), frame);
   view = gtk_text_view_new ();
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 8696427e2f..88bd6473c6 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -302,7 +302,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   tooltip = g_object_new (my_tooltip_get_type (), NULL);
   gtk_widget_set_margin_top (tooltip, 20);
diff --git a/tests/testtreechanging.c b/tests/testtreechanging.c
index 9cfb81ef74..dab647c6fc 100644
--- a/tests/testtreechanging.c
+++ b/tests/testtreechanging.c
@@ -501,7 +501,7 @@ main (int    argc,
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
 
   model = GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_UINT));
   treeview = gtk_tree_view_new_with_model (model);
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c
index 07002cc8b3..f7bafa571b 100644
--- a/tests/testtreecolumns.c
+++ b/tests/testtreecolumns.c
@@ -762,7 +762,7 @@ main (int argc, char *argv[])
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
   gtk_window_set_title (GTK_WINDOW (window), "Top Window");
   swindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), swindow);
+  gtk_window_set_child (GTK_WINDOW (window), swindow);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), sample_tree_view_top);
   gtk_widget_show (window);
 
@@ -771,7 +771,7 @@ main (int argc, char *argv[])
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
   gtk_window_set_title (GTK_WINDOW (window), "Bottom Window");
   swindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), swindow);
+  gtk_window_set_child (GTK_WINDOW (window), swindow);
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), sample_tree_view_bottom);
   gtk_widget_show (window);
 
@@ -780,7 +780,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   gtk_window_set_default_size (GTK_WINDOW (window), 500, 300);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
   gtk_container_add (GTK_CONTAINER (vbox), hbox);
diff --git a/tests/testtreecolumnsizing.c b/tests/testtreecolumnsizing.c
index 39ef865a77..a9709aae47 100644
--- a/tests/testtreecolumnsizing.c
+++ b/tests/testtreecolumnsizing.c
@@ -190,7 +190,7 @@ main (int argc, char **argv)
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   /* Option menu contents */
   combo_box = gtk_combo_box_text_new ();
diff --git a/tests/testtreednd.c b/tests/testtreednd.c
index 3bf664dd70..76483dd6b4 100644
--- a/tests/testtreednd.c
+++ b/tests/testtreednd.c
@@ -122,7 +122,7 @@ main (int argc, char *argv[])
   window = gtk_window_new ();
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_container_add (GTK_CONTAINER (box), get_dragsource ());
   gtk_container_add (GTK_CONTAINER (box), get_droptarget ());
 
diff --git a/tests/testtreeedit.c b/tests/testtreeedit.c
index a1d4b3e59c..fb8b4825de 100644
--- a/tests/testtreeedit.c
+++ b/tests/testtreeedit.c
@@ -252,7 +252,7 @@ main (gint argc, gchar **argv)
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE);
diff --git a/tests/testtreeflow.c b/tests/testtreeflow.c
index c39687c458..10a5894d74 100644
--- a/tests/testtreeflow.c
+++ b/tests/testtreeflow.c
@@ -149,7 +149,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Incremental Reflow Test"));
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC,
diff --git a/tests/testtreefocus.c b/tests/testtreefocus.c
index a89fd74015..4c4928b9b3 100644
--- a/tests/testtreefocus.c
+++ b/tests/testtreefocus.c
@@ -365,7 +365,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE);
@@ -480,7 +480,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("The model revealed"));
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE);
diff --git a/tests/testtreelistmodel.c b/tests/testtreelistmodel.c
index 06d956a139..b267fded4c 100644
--- a/tests/testtreelistmodel.c
+++ b/tests/testtreelistmodel.c
@@ -327,7 +327,7 @@ main (int argc, char *argv[])
   g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), &done);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (win), vbox);
+  gtk_window_set_child (GTK_WINDOW (win), vbox);
 
   search_entry = gtk_search_entry_new ();
   gtk_container_add (GTK_CONTAINER (vbox), search_entry);
diff --git a/tests/testtreepos.c b/tests/testtreepos.c
index 5625d2631e..c00aa96b88 100644
--- a/tests/testtreepos.c
+++ b/tests/testtreepos.c
@@ -95,7 +95,7 @@ int main (int argc, char *argv[])
 
   window = gtk_window_new ();
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), sw);
+  gtk_window_set_child (GTK_WINDOW (window), sw);
   tv = gtk_tree_view_new ();
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
diff --git a/tests/testtreesort.c b/tests/testtreesort.c
index 4cf6904897..dbb6ad52df 100644
--- a/tests/testtreesort.c
+++ b/tests/testtreesort.c
@@ -123,7 +123,7 @@ main (int argc, char *argv[])
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Jonathan and Kristian's list of cool words. (And 
Anders' cool list of numbers) \n\nThis is just a GtkTreeStore"));
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
 
   entry = gtk_entry_new ();
   gtk_container_add (GTK_CONTAINER (vbox), entry);
@@ -252,7 +252,7 @@ main (int argc, char *argv[])
       vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
       gtk_container_add (GTK_CONTAINER (vbox2), 
                          gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort 
wrapping the GtkTreeStore of window 1"));
-      gtk_container_add (GTK_CONTAINER (window2), vbox2);
+      gtk_window_set_child (GTK_WINDOW (window2), vbox2);
       
       scrolled_window2 = gtk_scrolled_window_new (NULL, NULL);
       gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window2), TRUE);
@@ -319,7 +319,7 @@ main (int argc, char *argv[])
       vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
       gtk_container_add (GTK_CONTAINER (vbox3), 
                          gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort 
wrapping the GtkTreeModelSort of window 2"));
-      gtk_container_add (GTK_CONTAINER (window3), vbox3);
+      gtk_window_set_child (GTK_WINDOW (window3), vbox3);
       
       scrolled_window3 = gtk_scrolled_window_new (NULL, NULL);
       gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window3), TRUE);
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 534a6f0f6e..a5648c6be9 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -702,7 +702,7 @@ main (int    argc,
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   tv = gtk_tree_view_new_with_model (models[0]);
   g_signal_connect (tv, "row-activated", G_CALLBACK (on_row_activated), NULL);
diff --git a/tests/testverticalcells.c b/tests/testverticalcells.c
index aaead5a21b..b3aaed3924 100644
--- a/tests/testverticalcells.c
+++ b/tests/testverticalcells.c
@@ -324,7 +324,7 @@ main (gint argc, gchar **argv)
   gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), 
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (window), scrolled_window);
+  gtk_window_set_child (GTK_WINDOW (window), scrolled_window);
 
   tree_model = create_model ();
   tree_view = gtk_tree_view_new_with_model (tree_model);
diff --git a/tests/testvolumebutton.c b/tests/testvolumebutton.c
index 252ab96ecf..5a3b31f049 100644
--- a/tests/testvolumebutton.c
+++ b/tests/testvolumebutton.c
@@ -95,7 +95,7 @@ main (int    argc,
                     G_CALLBACK (value_changed),
                     NULL);
 
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
   gtk_container_add (GTK_CONTAINER (vbox), box);
   gtk_container_add (GTK_CONTAINER (box), button);
   gtk_container_add (GTK_CONTAINER (box), button2);
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 58e72cf220..9a9ea5302a 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -297,7 +297,7 @@ main(int argc, char **argv)
 
   gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
 
-  gtk_container_add (GTK_CONTAINER (window), widget);
+  gtk_window_set_child (GTK_WINDOW (window), widget);
   g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
 
   gtk_widget_show (window);
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index f48c9489a0..3dc684d74c 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -341,7 +341,7 @@ main (int argc, char **argv)
   gtk_widget_set_vexpand (transform_tester, TRUE);
   gtk_container_add (GTK_CONTAINER (box), transform_tester);
   gtk_container_add (GTK_CONTAINER (box), matrix_chooser);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   gtk_window_set_default_size ((GtkWindow *)window, 200, 200);
   g_signal_connect (window, "close-request", G_CALLBACK (quit_cb), &done);
diff --git a/tests/testwindowdrag.c b/tests/testwindowdrag.c
index 07c7735f59..2f8d1539ac 100644
--- a/tests/testwindowdrag.c
+++ b/tests/testwindowdrag.c
@@ -108,7 +108,7 @@ main (int argc, char *argv[])
   gtk_window_set_titlebar (GTK_WINDOW (window), gtk_header_bar_new ());
 
   grid = gtk_grid_new ();
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   gtk_grid_attach (GTK_GRID (grid),
                    resize_button (GDK_SURFACE_EDGE_NORTH_WEST), 
diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c
index 620a5c3b47..99148869bf 100644
--- a/tests/testwindowsize.c
+++ b/tests/testwindowsize.c
@@ -87,7 +87,7 @@ create_window (void)
   grid = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
-  gtk_container_add (GTK_CONTAINER (window), grid);
+  gtk_window_set_child (GTK_WINDOW (window), grid);
 
   label = gtk_label_new ("Width chars");
   gtk_widget_set_halign (label, GTK_ALIGN_START);
diff --git a/tests/treestoretest.c b/tests/treestoretest.c
index d8a3430b86..bd61bbdbfe 100644
--- a/tests/treestoretest.c
+++ b/tests/treestoretest.c
@@ -345,7 +345,7 @@ make_window (gint view_type)
   gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
   gtk_widget_set_vexpand (scrolled_window, TRUE);
   gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
-  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_window_set_child (GTK_WINDOW (window), vbox);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);
diff --git a/tests/video-timer.c b/tests/video-timer.c
index 2d9e12fb42..512ab7a66f 100644
--- a/tests/video-timer.c
+++ b/tests/video-timer.c
@@ -402,7 +402,7 @@ main(int argc, char **argv)
 
   da = gtk_drawing_area_new ();
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), da);
+  gtk_window_set_child (GTK_WINDOW (window), da);
 
   gtk_widget_show (window);
 
diff --git a/testsuite/gtk/action.c b/testsuite/gtk/action.c
index f1e38550e2..a07526cbf6 100644
--- a/testsuite/gtk/action.c
+++ b/testsuite/gtk/action.c
@@ -58,7 +58,7 @@ test_action (void)
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   button = gtk_button_new ();
 
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
   gtk_container_add (GTK_CONTAINER (box), button);
 
   win_actions = g_simple_action_group_new ();
@@ -210,7 +210,7 @@ test_overlap (void)
   window = gtk_window_new ();
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   win_actions = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (win_actions),
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 345178bc5f..14d5a4adc8 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -904,7 +904,6 @@ test_children (void)
 {
   GtkBuilder * builder;
   GtkWidget *content_area;
-  GList *children;
   const gchar buffer1[] =
     "<interface>"
     "  <object class=\"GtkWindow\" id=\"window1\">"
@@ -934,7 +933,9 @@ test_children (void)
 
   GObject *window, *button;
   GObject *dialog, *vbox, *action_area;
-  
+  GtkWidget *child;
+  int count;
+
   builder = builder_new_from_string (buffer1, -1, NULL);
   window = gtk_builder_get_object (builder, "window1");
   g_assert (window != NULL);
@@ -948,15 +949,18 @@ test_children (void)
 
   gtk_widget_destroy (GTK_WIDGET (window));
   g_object_unref (builder);
-  
+
   builder = builder_new_from_string (buffer2, -1, NULL);
   dialog = gtk_builder_get_object (builder, "dialog1");
   g_assert (dialog != NULL);
   g_assert (GTK_IS_DIALOG (dialog));
-  children = gtk_container_get_children (GTK_CONTAINER (dialog));
-  g_assert_cmpint (g_list_length (children), ==, 2);
-  g_list_free (children);
-  
+  count = 0;
+  for (child = gtk_widget_get_first_child (GTK_WIDGET (dialog));
+       child != NULL;
+       child = gtk_widget_get_next_sibling (child))
+    count++;
+  g_assert_cmpint (count, ==, 2);
+
   vbox = gtk_builder_get_object (builder, "dialog1-vbox");
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
   g_assert (vbox != NULL);
diff --git a/testsuite/gtk/displayclose.c b/testsuite/gtk/displayclose.c
index e5e33c880c..e6093dcf9e 100644
--- a/testsuite/gtk/displayclose.c
+++ b/testsuite/gtk/displayclose.c
@@ -28,7 +28,7 @@ main (int argc, char **argv)
   but = gtk_button_new_with_label ("Try to Exit");
   g_signal_connect_swapped (but, "clicked",
                            G_CALLBACK (gtk_widget_destroy), win);
-  gtk_container_add (GTK_CONTAINER (win), but);
+  gtk_window_set_child (GTK_WINDOW (win), but);
 
   gtk_widget_show (win);
 
diff --git a/testsuite/gtk/filtermodel.c b/testsuite/gtk/filtermodel.c
index 40d67e0d8b..99a3e8ed32 100644
--- a/testsuite/gtk/filtermodel.c
+++ b/testsuite/gtk/filtermodel.c
@@ -4690,7 +4690,7 @@ specific_append_after_collapse (void)
 
   window = gtk_window_new ();
   tree_view = gtk_tree_view_new_with_model (sort);
-  gtk_container_add (GTK_CONTAINER (window), tree_view);
+  gtk_window_set_child (GTK_WINDOW (window), tree_view);
   gtk_widget_realize (tree_view);
 
   while (g_main_context_pending (NULL))
@@ -4810,7 +4810,7 @@ specific_sort_filter_remove_node (void)
 
   window = gtk_window_new ();
   tree_view = gtk_tree_view_new_with_model (filter);
-  gtk_container_add (GTK_CONTAINER (window), tree_view);
+  gtk_window_set_child (GTK_WINDOW (window), tree_view);
   gtk_widget_realize (tree_view);
 
   while (g_main_context_pending (NULL))
diff --git a/testsuite/gtk/grid-layout.c b/testsuite/gtk/grid-layout.c
index 9ef07e1ea0..2b97c7c9b7 100644
--- a/testsuite/gtk/grid-layout.c
+++ b/testsuite/gtk/grid-layout.c
@@ -114,7 +114,7 @@ test_simple_row (void)
 
   window = gtk_window_new ();
   parent = g_object_new (GTK_TYPE_GIZMO, NULL);
-  gtk_container_add (GTK_CONTAINER (window), parent);
+  gtk_window_set_child (GTK_WINDOW (window), parent);
 
   layout = gtk_grid_layout_new ();
   gtk_widget_set_layout_manager (parent, layout);
@@ -207,7 +207,7 @@ test_simple_column (void)
 
   window = gtk_window_new ();
   parent = g_object_new (GTK_TYPE_GIZMO, NULL);
-  gtk_container_add (GTK_CONTAINER (window), parent);
+  gtk_window_set_child (GTK_WINDOW (window), parent);
 
   layout = gtk_grid_layout_new ();
   gtk_widget_set_layout_manager (parent, layout);
@@ -311,7 +311,7 @@ test_spans (void)
 
   window = gtk_window_new ();
   parent = g_object_new (GTK_TYPE_GIZMO, NULL);
-  gtk_container_add (GTK_CONTAINER (window), parent);
+  gtk_window_set_child (GTK_WINDOW (window), parent);
 
   layout = gtk_grid_layout_new ();
   gtk_widget_set_layout_manager (parent, layout);
@@ -427,7 +427,7 @@ test_homogeneous (void)
 
   window = gtk_window_new ();
   parent = g_object_new (GTK_TYPE_GIZMO, NULL);
-  gtk_container_add (GTK_CONTAINER (window), parent);
+  gtk_window_set_child (GTK_WINDOW (window), parent);
 
   layout = gtk_grid_layout_new ();
   gtk_grid_layout_set_row_homogeneous (GTK_GRID_LAYOUT (layout), TRUE);
@@ -552,7 +552,7 @@ test_simple_layout (void)
 
   window = gtk_window_new ();
   parent = g_object_new (GTK_TYPE_GIZMO, NULL);
-  gtk_container_add (GTK_CONTAINER (window), parent);
+  gtk_window_set_child (GTK_WINDOW (window), parent);
 
   layout = gtk_grid_layout_new ();
   gtk_grid_layout_set_row_homogeneous (GTK_GRID_LAYOUT (layout), TRUE);
diff --git a/testsuite/gtk/popover.c b/testsuite/gtk/popover.c
index 2a982e2417..db8112a085 100644
--- a/testsuite/gtk/popover.c
+++ b/testsuite/gtk/popover.c
@@ -46,7 +46,7 @@ test_show_popover (void)
   popover = gtk_popover_new ();
   gtk_popover_set_child (GTK_POPOVER (popover), gtk_label_new ("Nu?"));
   gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover);
-  gtk_container_add (GTK_CONTAINER (window), button);
+  gtk_window_set_child (GTK_WINDOW (window), button);
 
   gtk_window_present (GTK_WINDOW (window));
 
diff --git a/testsuite/gtk/propertylookuplistmodel.c b/testsuite/gtk/propertylookuplistmodel.c
index 4e8092e06f..13c129feff 100644
--- a/testsuite/gtk/propertylookuplistmodel.c
+++ b/testsuite/gtk/propertylookuplistmodel.c
@@ -112,7 +112,7 @@ create_widget_tree (void)
   widgets = g_slist_prepend (widgets, window);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (window), box);
+  gtk_window_set_child (GTK_WINDOW (window), box);
 
   grid = gtk_grid_new ();
   gtk_container_add (GTK_CONTAINER (box), grid);
diff --git a/testsuite/gtk/regression-tests.c b/testsuite/gtk/regression-tests.c
index 6b64e863da..6ab853ffcb 100644
--- a/testsuite/gtk/regression-tests.c
+++ b/testsuite/gtk/regression-tests.c
@@ -26,7 +26,7 @@ test_9d6da33ff5c5e41e3521e1afd63d2d67bc915753 (void)
 
   window = gtk_window_new ();
   label = gtk_label_new ("I am sensitive.");
-  gtk_container_add (GTK_CONTAINER (window), label);
+  gtk_window_set_child (GTK_WINDOW (window), label);
 
   gtk_widget_set_sensitive (label, FALSE);
   gtk_widget_set_sensitive (window, FALSE);
@@ -45,7 +45,7 @@ test_94f00eb04dd1433cf1cc9a3341f485124e38abd1 (void)
 
   window = gtk_window_new ();
   label = gtk_label_new ("I am insensitive.");
-  gtk_container_add (GTK_CONTAINER (window), label);
+  gtk_window_set_child (GTK_WINDOW (window), label);
 
   gtk_widget_set_sensitive (window, FALSE);
   gtk_widget_set_sensitive (label, FALSE);
diff --git a/testsuite/gtk/treeview.c b/testsuite/gtk/treeview.c
index f92f42c7b8..e97258d93a 100644
--- a/testsuite/gtk/treeview.c
+++ b/testsuite/gtk/treeview.c
@@ -208,7 +208,7 @@ test_row_separator_height (void)
                                                "text", 0,
                                                NULL);
 
-  gtk_container_add (GTK_CONTAINER (window), tree_view);
+  gtk_window_set_child (GTK_WINDOW (window), tree_view);
   gtk_widget_show (window);
 
   gtk_test_widget_wait_for_draw (window);
diff --git a/testsuite/gtk/window.c b/testsuite/gtk/window.c
index d0d3dc27b4..847d458f80 100644
--- a/testsuite/gtk/window.c
+++ b/testsuite/gtk/window.c
@@ -77,7 +77,7 @@ test_default_size (void)
 
   da = gtk_drawing_area_new ();
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), da);
+  gtk_window_set_child (GTK_WINDOW (window), da);
 
   /* check that default size is unset initially */
   gtk_window_get_default_size (GTK_WINDOW (window), &w, &h);
@@ -165,7 +165,7 @@ test_resize (void)
 
   da = gtk_drawing_area_new ();
   gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (window), da);
+  gtk_window_set_child (GTK_WINDOW (window), da);
 
   /* test that resize before show overrides default size */
   gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
diff --git a/testsuite/reftests/set-default-direction.c b/testsuite/reftests/set-default-direction.c
index 468d3dc922..0784edc0bd 100644
--- a/testsuite/reftests/set-default-direction.c
+++ b/testsuite/reftests/set-default-direction.c
@@ -80,9 +80,6 @@ swap_child (GtkWidget *window)
 {
   GtkWidget *image;
 
-  gtk_container_remove (GTK_CONTAINER (window), gtk_bin_get_child (GTK_BIN (window)));
-
   image = gtk_image_new_from_icon_name ("go-next");
-  gtk_widget_show (image);
-  gtk_container_add (GTK_CONTAINER (window), image);
+  gtk_window_set_child (GTK_WINDOW (window), image);
 }



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