[gtk/bin-removal: 14/49] Use gtk_scrolled_window_set_child throughout



commit 4effabb6538ebe7f1208b7c35ccff5de07f8296c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 2 00:51:20 2020 -0400

    Use gtk_scrolled_window_set_child throughout
    
    Replace all uses of gtk_container_add on popovers
    by gtk_scrolled_window_set_child.

 demos/gtk-demo/dnd.c                      |  2 +-
 demos/gtk-demo/editable_cells.c           |  2 +-
 demos/gtk-demo/expander.c                 |  2 +-
 demos/gtk-demo/fixed.c                    |  2 +-
 demos/gtk-demo/flowbox.c                  |  2 +-
 demos/gtk-demo/hypertext.c                |  2 +-
 demos/gtk-demo/iconscroll.c               | 23 +++++++++++------------
 demos/gtk-demo/iconview.c                 |  2 +-
 demos/gtk-demo/list_store.c               |  2 +-
 demos/gtk-demo/listbox.c                  |  2 +-
 demos/gtk-demo/main.c                     |  4 ++--
 demos/gtk-demo/markup.c                   |  4 ++--
 demos/gtk-demo/overlay2.c                 |  2 +-
 demos/gtk-demo/sliding_puzzle.c           |  2 +-
 demos/gtk-demo/tabs.c                     |  2 +-
 demos/gtk-demo/textscroll.c               |  2 +-
 demos/gtk-demo/textundo.c                 |  2 +-
 demos/gtk-demo/textview.c                 |  6 +++---
 demos/gtk-demo/tree_store.c               |  2 +-
 docs/reference/gtk/getting_started.xml.in |  2 +-
 docs/tools/widgets.c                      |  2 +-
 examples/application10/exampleappwin.c    |  8 ++++----
 examples/application3/exampleappwin.c     |  2 +-
 examples/application4/exampleappwin.c     |  2 +-
 examples/application5/exampleappwin.c     |  2 +-
 examples/application6/exampleappwin.c     |  2 +-
 examples/application7/exampleappwin.c     |  4 ++--
 examples/application8/exampleappwin.c     |  6 +++---
 examples/application9/exampleappwin.c     |  8 ++++----
 examples/bp/bloatpad.c                    |  2 +-
 examples/plugman.c                        |  2 +-
 examples/sunny.c                          |  2 +-
 gtk/gtkcustompaperunixdialog.c            |  2 +-
 gtk/gtkentrycompletion.c                  |  3 ++-
 gtk/gtkmountoperation.c                   |  2 +-
 gtk/gtkplacessidebar.c                    |  2 +-
 gtk/gtkshortcutswindow.c                  |  5 ++---
 gtk/gtkstacksidebar.c                     |  2 +-
 gtk/inspector/controllers.c               |  2 +-
 gtk/inspector/prop-editor.c               |  7 ++++---
 tests/gdkgears.c                          |  2 +-
 tests/listmodel.c                         |  4 ++--
 tests/overlayscroll.c                     |  2 +-
 tests/print-editor.c                      |  2 +-
 tests/scrolling-performance.c             |  2 +-
 tests/syncscroll.c                        |  6 +++---
 tests/testaccel.c                         |  2 +-
 tests/testcellrenderertext.c              |  2 +-
 tests/testclipboard2.c                    |  2 +-
 tests/testcombochange.c                   |  4 ++--
 tests/testdnd3.c                          |  2 +-
 tests/testexpander.c                      |  2 +-
 tests/testflowbox.c                       |  2 +-
 tests/testgrid.c                          |  2 +-
 tests/testgrouping.c                      |  2 +-
 tests/testgtk.c                           | 12 ++++++------
 tests/testiconview.c                      | 10 +++++-----
 tests/testkineticscrolling.c              |  6 +++---
 tests/testlist.c                          |  2 +-
 tests/testlist2.c                         |  2 +-
 tests/testlist3.c                         |  2 +-
 tests/testlist4.c                         |  2 +-
 tests/testoverlay.c                       |  4 ++--
 tests/testoverlaystyleclass.c             |  2 +-
 tests/testscrolledge.c                    |  2 +-
 tests/testscrolledwindow.c                |  4 ++--
 tests/testscrolltofocus.c                 |  2 +-
 tests/teststack.c                         |  2 +-
 tests/testtextview.c                      |  2 +-
 tests/testtextview2.c                     |  2 +-
 tests/testtreechanging.c                  |  2 +-
 tests/testtreecolumns.c                   | 10 +++++-----
 tests/testtreecolumnsizing.c              |  2 +-
 tests/testtreeedit.c                      |  2 +-
 tests/testtreeflow.c                      |  2 +-
 tests/testtreefocus.c                     |  5 ++---
 tests/testtreepos.c                       |  2 +-
 tests/testtreesort.c                      | 11 +++++------
 tests/testtreeview.c                      |  2 +-
 tests/testverticalcells.c                 |  4 ++--
 tests/treestoretest.c                     |  2 +-
 testsuite/a11y/children.c                 |  2 +-
 testsuite/gtk/scrolledwindow.c            |  2 +-
 83 files changed, 138 insertions(+), 140 deletions(-)
---
diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c
index 4093a39276..b2c1a307da 100644
--- a/demos/gtk-demo/dnd.c
+++ b/demos/gtk-demo/dnd.c
@@ -474,7 +474,7 @@ do_dnd (GtkWidget *do_widget)
 
       box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
       gtk_widget_add_css_class (box3, "linked");
-      gtk_container_add (GTK_CONTAINER (sw), box3);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
 
       for (i = 0; colors[i]; i++)
         {
diff --git a/demos/gtk-demo/editable_cells.c b/demos/gtk-demo/editable_cells.c
index 52a432b344..5a559a674c 100644
--- a/demos/gtk-demo/editable_cells.c
+++ b/demos/gtk-demo/editable_cells.c
@@ -387,7 +387,7 @@ do_editable_cells (GtkWidget *do_widget)
       g_object_unref (numbers_model);
       g_object_unref (items_model);
 
-      gtk_container_add (GTK_CONTAINER (sw), treeview);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
 
       /* some buttons */
       hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
diff --git a/demos/gtk-demo/expander.c b/demos/gtk-demo/expander.c
index cc9691ab7d..78cb3fb271 100644
--- a/demos/gtk-demo/expander.c
+++ b/demos/gtk-demo/expander.c
@@ -78,7 +78,7 @@ do_expander (GtkWidget *do_widget)
                                 "A second paragraph will contain even more "
                                 "innuendo, just to make you scroll down or "
                                 "resize the window. Do it already !", -1);
-      gtk_container_add (GTK_CONTAINER (sw), tv);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
       gtk_container_add (GTK_CONTAINER (expander), sw);
       gtk_container_add (GTK_CONTAINER (area), expander);
       g_signal_connect (expander, "notify::expanded",
diff --git a/demos/gtk-demo/fixed.c b/demos/gtk-demo/fixed.c
index cf1d642f20..7c739030a6 100644
--- a/demos/gtk-demo/fixed.c
+++ b/demos/gtk-demo/fixed.c
@@ -134,7 +134,7 @@ create_demo_window (GtkWidget *do_widget)
   gtk_container_add (GTK_CONTAINER (window), sw);
 
   fixed = gtk_fixed_new ();
-  gtk_container_add (GTK_CONTAINER (sw), fixed);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), fixed);
   gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
   gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
 
diff --git a/demos/gtk-demo/flowbox.c b/demos/gtk-demo/flowbox.c
index 09acaf42f9..c9e2f255b4 100644
--- a/demos/gtk-demo/flowbox.c
+++ b/demos/gtk-demo/flowbox.c
@@ -735,7 +735,7 @@ do_flowbox (GtkWidget *do_widget)
       gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), 30);
       gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (flowbox), GTK_SELECTION_NONE);
 
-      gtk_container_add (GTK_CONTAINER (scrolled), flowbox);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), flowbox);
       gtk_container_add (GTK_CONTAINER (window), scrolled);
 
       for (i = 0; colors[i]; i++)
diff --git a/demos/gtk-demo/hypertext.c b/demos/gtk-demo/hypertext.c
index 9958d9b21a..81a19e3305 100644
--- a/demos/gtk-demo/hypertext.c
+++ b/demos/gtk-demo/hypertext.c
@@ -267,7 +267,7 @@ do_hypertext (GtkWidget *do_widget)
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
       gtk_container_add (GTK_CONTAINER (window), sw);
-      gtk_container_add (GTK_CONTAINER (sw), view);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
 
       show_page (buffer, 1);
     }
diff --git a/demos/gtk-demo/iconscroll.c b/demos/gtk-demo/iconscroll.c
index e2f0edd525..2254aa0bef 100644
--- a/demos/gtk-demo/iconscroll.c
+++ b/demos/gtk-demo/iconscroll.c
@@ -66,9 +66,9 @@ populate_icons (void)
   hincrement = 0;
 
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
-                                 GTK_POLICY_NEVER,
-                                 GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
+                                  GTK_POLICY_NEVER,
+                                  GTK_POLICY_AUTOMATIC);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
 }
 
 static char *content;
@@ -102,9 +102,9 @@ populate_text (gboolean hilight)
   hincrement = 0;
 
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
-                                 GTK_POLICY_NEVER,
-                                 GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
+                                  GTK_POLICY_NEVER,
+                                  GTK_POLICY_AUTOMATIC);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), textview);
 }
 
 static void
@@ -126,9 +126,9 @@ populate_image (void)
   hincrement = 5;
 
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
-                                 GTK_POLICY_AUTOMATIC,
-                                 GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), image);
 }
 
 static void
@@ -137,9 +137,8 @@ set_widget_type (int type)
   if (tick_cb)
     gtk_widget_remove_tick_callback (window, tick_cb);
 
-  if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
-    gtk_container_remove (GTK_CONTAINER (scrolledwindow),
-                          gtk_bin_get_child (GTK_BIN (scrolledwindow)));
+  if (gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (scrolledwindow)))
+    gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), NULL);
 
   selected = type;
 
diff --git a/demos/gtk-demo/iconview.c b/demos/gtk-demo/iconview.c
index 98ee9e03e6..8a6372d119 100644
--- a/demos/gtk-demo/iconview.c
+++ b/demos/gtk-demo/iconview.c
@@ -312,7 +312,7 @@ do_iconview (GtkWidget *do_widget)
       /* Connect to the "item-activated" signal */
       g_signal_connect (icon_view, "item-activated",
                         G_CALLBACK (item_activated), store);
-      gtk_container_add (GTK_CONTAINER (sw), icon_view);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), icon_view);
 
       gtk_widget_grab_focus (icon_view);
     }
diff --git a/demos/gtk-demo/list_store.c b/demos/gtk-demo/list_store.c
index a75cca1854..27815802ca 100644
--- a/demos/gtk-demo/list_store.c
+++ b/demos/gtk-demo/list_store.c
@@ -289,7 +289,7 @@ do_list_store (GtkWidget *do_widget)
 
       g_object_unref (model);
 
-      gtk_container_add (GTK_CONTAINER (sw), treeview);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
 
       /* add columns to the tree view */
       add_columns (GTK_TREE_VIEW (treeview));
diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c
index 6b9f3cf5d9..d988ec5e65 100644
--- a/demos/gtk-demo/listbox.c
+++ b/demos/gtk-demo/listbox.c
@@ -368,7 +368,7 @@ do_listbox (GtkWidget *do_widget)
       gtk_widget_set_vexpand (scrolled, TRUE);
       gtk_container_add (GTK_CONTAINER (vbox), scrolled);
       listbox = gtk_list_box_new ();
-      gtk_container_add (GTK_CONTAINER (scrolled), listbox);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox);
 
       gtk_list_box_set_sort_func (GTK_LIST_BOX (listbox), (GtkListBoxSortFunc)gtk_message_row_sort, listbox, 
NULL);
       gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (listbox), FALSE);
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index a31036d916..1e4d2d3ff8 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -571,7 +571,7 @@ display_image (const char *resource)
   gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
   gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
   sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (sw), image);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
 
   return sw;
 }
@@ -614,7 +614,7 @@ display_text (const char *resource)
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (sw), textview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
 
   return sw;
 }
diff --git a/demos/gtk-demo/markup.c b/demos/gtk-demo/markup.c
index cb5ec505a0..a9a0eaf11b 100644
--- a/demos/gtk-demo/markup.c
+++ b/demos/gtk-demo/markup.c
@@ -86,7 +86,7 @@ do_markup (GtkWidget *do_widget)
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-      gtk_container_add (GTK_CONTAINER (sw), view);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
 
       gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
 
@@ -99,7 +99,7 @@ do_markup (GtkWidget *do_widget)
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-      gtk_container_add (GTK_CONTAINER (sw), view2);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
 
       gtk_stack_add_named (GTK_STACK (stack), sw, "source");
 
diff --git a/demos/gtk-demo/overlay2.c b/demos/gtk-demo/overlay2.c
index ac2b1fafa2..b990701944 100644
--- a/demos/gtk-demo/overlay2.c
+++ b/demos/gtk-demo/overlay2.c
@@ -59,7 +59,7 @@ do_overlay2 (GtkWidget *do_widget)
 
       gtk_container_add (GTK_CONTAINER (window), overlay);
       gtk_container_add (GTK_CONTAINER (overlay), sw);
-      gtk_container_add (GTK_CONTAINER (sw), text);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
 
       g_signal_connect (window, "destroy",
                         G_CALLBACK (gtk_widget_destroyed), &window);
diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c
index b4d0e991e0..00c2a765e4 100644
--- a/demos/gtk-demo/sliding_puzzle.c
+++ b/demos/gtk-demo/sliding_puzzle.c
@@ -424,7 +424,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
       gtk_media_stream_play (media);
       add_choice (choices, GDK_PAINTABLE (media));
       sw = gtk_scrolled_window_new (NULL, NULL);
-      gtk_container_add (GTK_CONTAINER (sw), choices);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), choices);
       gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
 
       label = gtk_label_new ("Size");
diff --git a/demos/gtk-demo/tabs.c b/demos/gtk-demo/tabs.c
index 877d1e7c58..034b60a566 100644
--- a/demos/gtk-demo/tabs.c
+++ b/demos/gtk-demo/tabs.c
@@ -47,7 +47,7 @@ do_tabs (GtkWidget *do_widget)
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
       gtk_container_add (GTK_CONTAINER (window), sw);
-      gtk_container_add (GTK_CONTAINER (sw), view);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/textscroll.c b/demos/gtk-demo/textscroll.c
index 08afc0ede5..ccd5d521b1 100644
--- a/demos/gtk-demo/textscroll.c
+++ b/demos/gtk-demo/textscroll.c
@@ -159,7 +159,7 @@ create_text_view (GtkWidget *hbox,
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_container_add (GTK_CONTAINER (hbox), swindow);
   textview = gtk_text_view_new ();
-  gtk_container_add (GTK_CONTAINER (swindow), textview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);
 
   timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
 
diff --git a/demos/gtk-demo/textundo.c b/demos/gtk-demo/textundo.c
index 770ec1cfbb..fb3a03e442 100644
--- a/demos/gtk-demo/textundo.c
+++ b/demos/gtk-demo/textundo.c
@@ -54,7 +54,7 @@ do_textundo (GtkWidget *do_widget)
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
       gtk_container_add (GTK_CONTAINER (window), sw);
-      gtk_container_add (GTK_CONTAINER (sw), view);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
     }
 
   if (!gtk_widget_get_visible (window))
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index d5aed9b08b..0acc03e9e2 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -503,7 +503,7 @@ do_textview (GtkWidget *do_widget)
                                       GTK_POLICY_AUTOMATIC);
       gtk_paned_add1 (GTK_PANED (vpaned), sw);
 
-      gtk_container_add (GTK_CONTAINER (sw), view1);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view1);
 
       sw = gtk_scrolled_window_new (NULL, NULL);
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -511,7 +511,7 @@ do_textview (GtkWidget *do_widget)
                                       GTK_POLICY_AUTOMATIC);
       gtk_paned_add2 (GTK_PANED (vpaned), sw);
 
-      gtk_container_add (GTK_CONTAINER (sw), view2);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
 
       create_tags (buffer);
       insert_text (GTK_TEXT_VIEW (view1));
@@ -595,7 +595,7 @@ easter_egg_callback (GtkWidget *button,
                                   GTK_POLICY_AUTOMATIC);
 
   gtk_container_add (GTK_CONTAINER (window), sw);
-  gtk_container_add (GTK_CONTAINER (sw), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
 
   window_ptr = &window;
   g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c
index 7b01ab2a5e..f404fcc757 100644
--- a/demos/gtk-demo/tree_store.c
+++ b/demos/gtk-demo/tree_store.c
@@ -426,7 +426,7 @@ do_tree_store (GtkWidget *do_widget)
 
       add_columns (GTK_TREE_VIEW (treeview));
 
-      gtk_container_add (GTK_CONTAINER (sw), treeview);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
 
       /* expand all rows after the treeview widget has been realized */
       g_signal_connect (treeview, "realize",
diff --git a/docs/reference/gtk/getting_started.xml.in b/docs/reference/gtk/getting_started.xml.in
index a686eccdde..3f2405caa4 100644
--- a/docs/reference/gtk/getting_started.xml.in
+++ b/docs/reference/gtk/getting_started.xml.in
@@ -551,7 +551,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 683e5dfda4..f3a93efb75 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -876,7 +876,7 @@ create_scrolledwindow (void)
                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
   label = gtk_label_new ("Scrolled Window");
 
-  gtk_container_add (GTK_CONTAINER (scrolledwin), label);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwin), label);
 
   return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
 }
diff --git a/examples/application10/exampleappwin.c b/examples/application10/exampleappwin.c
index 31f527b128..16a8658f36 100644
--- a/examples/application10/exampleappwin.c
+++ b/examples/application10/exampleappwin.c
@@ -37,7 +37,7 @@ search_text_changed (GtkEntry         *entry,
     return;
 
   tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   /* Very simple-minded search implementation */
@@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
   if (tab == NULL)
     return;
 
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
   if (tab == NULL)
     return;
 
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   count = gtk_text_buffer_get_line_count (buffer);
@@ -266,7 +266,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/application3/exampleappwin.c b/examples/application3/exampleappwin.c
index 01fb4ae115..9ed0b88452 100644
--- a/examples/application3/exampleappwin.c
+++ b/examples/application3/exampleappwin.c
@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
diff --git a/examples/application4/exampleappwin.c b/examples/application4/exampleappwin.c
index 01fb4ae115..9ed0b88452 100644
--- a/examples/application4/exampleappwin.c
+++ b/examples/application4/exampleappwin.c
@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
diff --git a/examples/application5/exampleappwin.c b/examples/application5/exampleappwin.c
index ca45b85d40..16d11f4c70 100644
--- a/examples/application5/exampleappwin.c
+++ b/examples/application5/exampleappwin.c
@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/application6/exampleappwin.c b/examples/application6/exampleappwin.c
index ca45b85d40..16d11f4c70 100644
--- a/examples/application6/exampleappwin.c
+++ b/examples/application6/exampleappwin.c
@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/application7/exampleappwin.c b/examples/application7/exampleappwin.c
index d4a671cc45..f15cf3ba42 100644
--- a/examples/application7/exampleappwin.c
+++ b/examples/application7/exampleappwin.c
@@ -31,7 +31,7 @@ search_text_changed (GtkEntry         *entry,
     return;
 
   tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   /* Very simple-minded search implementation */
@@ -125,7 +125,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/application8/exampleappwin.c b/examples/application8/exampleappwin.c
index f662b67cbb..f21eeec5cc 100644
--- a/examples/application8/exampleappwin.c
+++ b/examples/application8/exampleappwin.c
@@ -35,7 +35,7 @@ search_text_changed (GtkEntry         *entry,
     return;
 
   tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   /* Very simple-minded search implementation */
@@ -75,7 +75,7 @@ update_words (ExampleAppWindow *win)
   if (tab == NULL)
     return;
 
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -229,7 +229,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/application9/exampleappwin.c b/examples/application9/exampleappwin.c
index 0394904d76..725ee67df1 100644
--- a/examples/application9/exampleappwin.c
+++ b/examples/application9/exampleappwin.c
@@ -37,7 +37,7 @@ search_text_changed (GtkEntry         *entry,
     return;
 
   tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   /* Very simple-minded search implementation */
@@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
   if (tab == NULL)
     return;
 
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
   if (tab == NULL)
     return;
 
-  view = gtk_bin_get_child (GTK_BIN (tab));
+  view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
 
   count = gtk_text_buffer_get_line_count (buffer);
@@ -263,7 +263,7 @@ example_app_window_open (ExampleAppWindow *win,
   view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
 
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c
index f8f48d4fc9..3cb619eb8f 100644
--- a/examples/bp/bloatpad.c
+++ b/examples/bp/bloatpad.c
@@ -259,7 +259,7 @@ new_window (GApplication *app,
 
   g_object_set_data ((GObject*)window, "bloatpad-text", view);
 
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
 
   gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);
 
diff --git a/examples/plugman.c b/examples/plugman.c
index d36b28bfb1..1b33f0eeb4 100644
--- a/examples/plugman.c
+++ b/examples/plugman.c
@@ -92,7 +92,7 @@ new_window (GApplication *app,
 
   g_object_set_data ((GObject*)window, "plugman-text", view);
 
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
 
   gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
 
diff --git a/examples/sunny.c b/examples/sunny.c
index 3e3fc6a672..7a7ca94074 100644
--- a/examples/sunny.c
+++ b/examples/sunny.c
@@ -28,7 +28,7 @@ new_window (GApplication *app,
   gtk_widget_set_vexpand (scrolled, TRUE);
   view = gtk_text_view_new ();
 
-  gtk_container_add (GTK_CONTAINER (scrolled), view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
   gtk_container_add (GTK_CONTAINER (overlay), scrolled);
 
   if (file != NULL)
diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c
index d6a87cdf6f..e664c595cd 100644
--- a/gtk/gtkcustompaperunixdialog.c
+++ b/gtk/gtkcustompaperunixdialog.c
@@ -1045,7 +1045,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
 
   gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
 
-  gtk_container_add (GTK_CONTAINER (scrolled), treeview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), treeview);
   gtk_widget_show (treeview);
 
   toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 5ab7fb828a..2aa691fe65 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -605,7 +605,8 @@ gtk_entry_completion_constructed (GObject *object)
   priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_frame_set_child (GTK_FRAME (popup_frame), priv->vbox);
 
-  gtk_container_add (GTK_CONTAINER (priv->scrolled_window), priv->tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+                                 priv->tree_view);
   gtk_widget_set_hexpand (priv->scrolled_window, TRUE);
   gtk_widget_set_vexpand (priv->scrolled_window, TRUE);
   gtk_container_add (GTK_CONTAINER (priv->vbox), priv->scrolled_window);
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index d1eb782079..e58bae6ac6 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -1591,7 +1591,7 @@ create_show_processes_dialog (GtkMountOperation *op,
                                   GTK_POLICY_AUTOMATIC);
   gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE);
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
   gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
 
   controller = gtk_shortcut_controller_new ();
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 6ba5cd3a5c..178c3bde66 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -3810,7 +3810,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
   sidebar->row_placeholder = NULL;
   sidebar->dragging_over = FALSE;
 
-  gtk_container_add (GTK_CONTAINER (sidebar->swin), sidebar->list_box);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sidebar->swin), sidebar->list_box);
 
   sidebar->hostname = g_strdup (_("Computer"));
   sidebar->hostnamed_cancellable = g_cancellable_new ();
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index db05e48ba2..e8aee12510 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -972,14 +972,13 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  scroller = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
-                           NULL);
+  scroller = gtk_scrolled_window_new (NULL, NULL);
   box = g_object_new (GTK_TYPE_BOX,
                       "halign", GTK_ALIGN_CENTER,
                       "orientation", GTK_ORIENTATION_VERTICAL,
                       NULL);
   gtk_widget_add_css_class (GTK_WIDGET (box), "shortcuts-search-results");
-  gtk_container_add (GTK_CONTAINER (scroller), GTK_WIDGET (box));
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroller), GTK_WIDGET (box));
   gtk_stack_add_named (priv->stack, scroller, "internal-search");
 
   priv->search_shortcuts = g_object_new (GTK_TYPE_BOX,
diff --git a/gtk/gtkstacksidebar.c b/gtk/gtkstacksidebar.c
index 84953d7845..8dfed9c749 100644
--- a/gtk/gtkstacksidebar.c
+++ b/gtk/gtkstacksidebar.c
@@ -166,7 +166,7 @@ gtk_stack_sidebar_init (GtkStackSidebar *self)
 
   self->list = GTK_LIST_BOX (gtk_list_box_new ());
 
-  gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (self->list));
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), GTK_WIDGET (self->list));
 
   gtk_list_box_set_header_func (self->list, update_header, self, NULL);
 
diff --git a/gtk/inspector/controllers.c b/gtk/inspector/controllers.c
index 280fbe9154..95b9ff3efa 100644
--- a/gtk/inspector/controllers.c
+++ b/gtk/inspector/controllers.c
@@ -80,7 +80,7 @@ gtk_inspector_controllers_init (GtkInspectorControllers *sl)
                 "margin-top", 60,
                 "margin-bottom", 30,
                 NULL);
-  gtk_container_add (GTK_CONTAINER (sw), box);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
   gtk_widget_set_hexpand (box, TRUE);
   gtk_widget_set_vexpand (box, TRUE);
 
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index 04c8d20dee..94d4577c6d 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -41,6 +41,7 @@
 #include "gtkspinbutton.h"
 #include "gtksettingsprivate.h"
 #include "gtktogglebutton.h"
+#include "gtkviewport.h"
 #include "gtkwidgetprivate.h"
 #include "gtkcssnodeprivate.h"
 #include "gtklistbox.h"
@@ -574,7 +575,7 @@ flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
 
   popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (data));
   sw =  gtk_popover_get_child (GTK_POPOVER (popover));
-  viewport = gtk_bin_get_child (GTK_BIN (sw));
+  viewport = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (sw));
   box = gtk_viewport_get_child (GTK_VIEWPORT (viewport));
   children = gtk_container_get_children (GTK_CONTAINER (box));
 
@@ -957,7 +958,7 @@ property_editor (GObject                *object,
                       NULL);
         box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
         gtk_widget_show (box);
-        gtk_container_add (GTK_CONTAINER (sw), box);
+        gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
 
         fclass = G_FLAGS_CLASS (g_type_class_ref (spec->value_type));
 
@@ -1034,7 +1035,7 @@ property_editor (GObject                *object,
       gtk_list_box_bind_model (GTK_LIST_BOX (box), model, create_row, editor, NULL);
       g_object_unref (model);
 
-      gtk_container_add (GTK_CONTAINER (sw), box);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
     }
   else if (type == G_TYPE_PARAM_OBJECT)
     {
diff --git a/tests/gdkgears.c b/tests/gdkgears.c
index 6a035277d8..17714717d2 100644
--- a/tests/gdkgears.c
+++ b/tests/gdkgears.c
@@ -232,7 +232,7 @@ main (int argc, char *argv[])
 
   extra_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
   gtk_box_set_spacing (GTK_BOX (extra_hbox), 6);
-  gtk_container_add (GTK_CONTAINER (scrolled), extra_hbox);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), extra_hbox);
   gtk_widget_show (extra_hbox);
 
   bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/tests/listmodel.c b/tests/listmodel.c
index ee61a053f0..f4d88fe477 100644
--- a/tests/listmodel.c
+++ b/tests/listmodel.c
@@ -203,7 +203,7 @@ main (int argc, char *argv[])
 
   box = gtk_list_box_new ();
   gtk_list_box_bind_model (GTK_LIST_BOX (box), G_LIST_MODEL (store), create_widget, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (sw), box);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
 
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -215,7 +215,7 @@ main (int argc, char *argv[])
 
   box = gtk_flow_box_new ();
   gtk_flow_box_bind_model (GTK_FLOW_BOX (box), G_LIST_MODEL (store), create_widget, NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (sw), box);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box);
 
   button = gtk_button_new_with_label ("Add some");
   g_signal_connect (button, "clicked", G_CALLBACK (add_some), store);
diff --git a/tests/overlayscroll.c b/tests/overlayscroll.c
index 933ab3e892..4cb8e18f46 100644
--- a/tests/overlayscroll.c
+++ b/tests/overlayscroll.c
@@ -83,7 +83,7 @@ main (int argc, char *argv[])
 
   tv = gtk_text_view_new ();
   gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
   gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv)),
                             content, -1);
   g_free (content);
diff --git a/tests/print-editor.c b/tests/print-editor.c
index 32d522ae8f..a0a8fde4ee 100644
--- a/tests/print-editor.c
+++ b/tests/print-editor.c
@@ -765,7 +765,7 @@ activate (GApplication *app)
   contents = gtk_text_view_new ();
   gtk_widget_grab_focus (contents);
 
-  gtk_container_add (GTK_CONTAINER (sw),
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw),
                      contents);
 
   /* Create statusbar */
diff --git a/tests/scrolling-performance.c b/tests/scrolling-performance.c
index c47e834fb7..db2fae820e 100644
--- a/tests/scrolling-performance.c
+++ b/tests/scrolling-performance.c
@@ -135,7 +135,7 @@ main (int argc, char **argv)
   gtk_container_add (GTK_CONTAINER (window), scrolled_window);
 
   viewport = gtk_viewport_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), viewport);
 
   grid = gtk_grid_new ();
   gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid);
diff --git a/tests/syncscroll.c b/tests/syncscroll.c
index 715fc0ae32..aae3487413 100644
--- a/tests/syncscroll.c
+++ b/tests/syncscroll.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (box), sw);
   tv = gtk_text_view_new ();
   fill_text_view (tv, "Left");
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
 
@@ -46,7 +46,7 @@ main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (box), sw);
   tv = gtk_text_view_new ();
   fill_text_view (tv, "Middle");
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   sw = gtk_scrolled_window_new (NULL, adj);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (box), sw);
   tv = gtk_text_view_new ();
   fill_text_view (tv, "Right");
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   sb = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adj);
 
diff --git a/tests/testaccel.c b/tests/testaccel.c
index d07048cd24..0dc121d7b5 100644
--- a/tests/testaccel.c
+++ b/tests/testaccel.c
@@ -79,7 +79,7 @@ key_test (void)
 
        store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT);
        tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
-       gtk_container_add (GTK_CONTAINER (sw), tv);
+       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
        column = gtk_tree_view_column_new ();
        rend = gtk_cell_renderer_accel_new ();
        g_object_set (G_OBJECT (rend),
diff --git a/tests/testcellrenderertext.c b/tests/testcellrenderertext.c
index 8c95ad55d5..c5ec0a08ce 100644
--- a/tests/testcellrenderertext.c
+++ b/tests/testcellrenderertext.c
@@ -181,7 +181,7 @@ create_tree (gboolean rtl)
 
   treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
   gtk_widget_set_direction (treeview, rtl ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
-  gtk_container_add (GTK_CONTAINER (sw), treeview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
 
   /* Line number */
 
diff --git a/tests/testclipboard2.c b/tests/testclipboard2.c
index da812f6782..7ea34e9bf7 100644
--- a/tests/testclipboard2.c
+++ b/tests/testclipboard2.c
@@ -253,7 +253,7 @@ get_formats_list (GdkClipboard *clipboard)
   list = gtk_list_box_new ();
   g_signal_connect_object (clipboard, "notify::formats", G_CALLBACK (clipboard_formats_change_cb), list, 0);
   clipboard_formats_change_cb (clipboard, NULL, list);
-  gtk_container_add (GTK_CONTAINER (sw), list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
 
   return sw;
 }
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index bdaadf19ca..57f2c5bdd9 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -274,13 +274,13 @@ main (int argc, char **argv)
   gtk_widget_set_hexpand (scrolled_window, TRUE);
   gtk_container_add (GTK_CONTAINER (hbox), scrolled_window);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
   text_view = gtk_text_view_new ();
   gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
   gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), text_view);
 
   button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_container_add (GTK_CONTAINER (hbox), button_vbox);
diff --git a/tests/testdnd3.c b/tests/testdnd3.c
index 34d2386f1b..6234799b00 100644
--- a/tests/testdnd3.c
+++ b/tests/testdnd3.c
@@ -301,7 +301,7 @@ int main (int argc, char *argv[])
 
   box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_widget_add_css_class (box3, "linked");
-  gtk_container_add (GTK_CONTAINER (sw), box3);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
 
   for (i = 0; colors[i]; i++)
     {
diff --git a/tests/testexpander.c b/tests/testexpander.c
index ba99e80a44..a56cddd10d 100644
--- a/tests/testexpander.c
+++ b/tests/testexpander.c
@@ -68,7 +68,7 @@ main (int argc, char *argv[])
                             "A second paragraph will contain even more "
                             "innuendo, just to make you scroll down or "
                             "resize the window. Do it already !", -1);
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
   gtk_container_add (GTK_CONTAINER (expander), sw);
   gtk_widget_set_hexpand (expander, TRUE);
   gtk_widget_set_vexpand (expander, TRUE);
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index 14b274acb0..9421409f3d 100644
--- a/tests/testflowbox.c
+++ b/tests/testflowbox.c
@@ -407,7 +407,7 @@ create_window (void)
   gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MINIMUM_LENGTH);
   gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MAXIMUM_LENGTH);
   gtk_widget_show (flowbox);
-  gtk_container_add (GTK_CONTAINER (swindow), flowbox);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), flowbox);
 
   gtk_flow_box_set_hadjustment (GTK_FLOW_BOX (flowbox),
                                 gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (swindow)));
diff --git a/tests/testgrid.c b/tests/testgrid.c
index 0df805101a..c3c33a9f82 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -263,7 +263,7 @@ scrolling (void)
   grid = gtk_grid_new ();
 
   gtk_container_add (GTK_CONTAINER (window), sw);
-  gtk_container_add (GTK_CONTAINER (sw), viewport);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), viewport);
   gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid);
 
   child = oriented_test_widget ("#800080", "#800080");
diff --git a/tests/testgrouping.c b/tests/testgrouping.c
index b522a439e9..a1d44468e5 100644
--- a/tests/testgrouping.c
+++ b/tests/testgrouping.c
@@ -129,7 +129,7 @@ main (int argc, char **argv)
   gtk_container_add (GTK_CONTAINER (window), sw);
 
   tv = gtk_tree_view_new_with_model (model);
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   g_signal_connect (tv, "row-activated",
                    G_CALLBACK (tree_view_row_activated), tv);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index bd07c664f3..432dc1d810 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -1548,7 +1548,7 @@ create_listbox (GtkWidget *widget)
       gtk_container_add (GTK_CONTAINER (hbox), scrolled);
 
       scrolled_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (scrolled), scrolled_box);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), scrolled_box);
 
       label = gtk_label_new ("This is \na LABEL\nwith rows");
       gtk_container_add (GTK_CONTAINER (scrolled_box), label);
@@ -1882,7 +1882,7 @@ scrolled_windows_delete_cb (GtkWidget *widget,
 {
   g_object_ref (scrollwin);
   gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
-  gtk_container_add (GTK_CONTAINER (sw_parent), scrollwin);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_parent), scrollwin);
   g_object_unref (scrollwin);
 
   g_signal_handler_disconnect (sw_parent, sw_destroyed_handler);
@@ -1916,7 +1916,7 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
     {
       g_object_ref (scrollwin);
       gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
-      gtk_container_add (GTK_CONTAINER (sw_parent), scrollwin);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_parent), scrollwin);
       g_object_unref (scrollwin);
 
 
@@ -1938,7 +1938,7 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
       
       g_object_ref (scrollwin);
       gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
-      gtk_container_add (GTK_CONTAINER (sw_float_parent), scrollwin);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_float_parent), scrollwin);
       g_object_unref (scrollwin);
 
 
@@ -1990,7 +1990,7 @@ create_scrolled_windows (GtkWidget *widget)
       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 (scrolled_window), grid);
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), grid);
       gtk_viewport_set_scroll_to_focus (GTK_VIEWPORT (gtk_widget_get_parent (grid)), TRUE);
       gtk_widget_show (grid);
 
@@ -6070,7 +6070,7 @@ create_main_window (void)
   gtk_container_add (GTK_CONTAINER (box1), scrolled_window);
 
   box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), box2);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), box2);
   gtk_viewport_set_scroll_to_focus (GTK_VIEWPORT (gtk_widget_get_parent (box2)), TRUE);
   gtk_widget_show (box2);
 
diff --git a/tests/testiconview.c b/tests/testiconview.c
index 31394c4ac3..cd40c6e63b 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -520,16 +520,16 @@ main (gint argc, gchar **argv)
                                         targets,
                                        GDK_ACTION_MOVE);
   gdk_content_formats_unref (targets);
-                             
+
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), icon_list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), icon_list);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
   gtk_paned_add1 (GTK_PANED (paned), scrolled_window);
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tv);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
@@ -578,9 +578,9 @@ main (gint argc, gchar **argv)
   icon_list = gtk_icon_view_new ();
 
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), icon_list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), icon_list);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-                                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+                                  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   gtk_paned_add2 (GTK_PANED (paned), scrolled_window);
 
   gtk_widget_show (window);
diff --git a/tests/testkineticscrolling.c b/tests/testkineticscrolling.c
index 1ade83fc03..90944de2f9 100644
--- a/tests/testkineticscrolling.c
+++ b/tests/testkineticscrolling.c
@@ -71,7 +71,7 @@ kinetic_scrolling (void)
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE);
   gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE);
-  gtk_container_add (GTK_CONTAINER (swindow), button_grid);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), button_grid);
   gtk_widget_show (button_grid);
 
   gtk_grid_attach (GTK_GRID (grid), swindow, 0, 1, 1, 1);
@@ -111,7 +111,7 @@ kinetic_scrolling (void)
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE);
   gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE);
-  gtk_container_add (GTK_CONTAINER (swindow), treeview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), treeview);
   gtk_widget_show (treeview);
 
   gtk_grid_attach (GTK_GRID (grid), swindow, 1, 1, 1, 1);
@@ -123,7 +123,7 @@ kinetic_scrolling (void)
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE);
   gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE);
-  gtk_container_add (GTK_CONTAINER (swindow), textview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);
   gtk_widget_show (textview);
 
   gtk_grid_attach (GTK_GRID (grid), swindow, 2, 1, 1, 1);
diff --git a/tests/testlist.c b/tests/testlist.c
index fb0600ef90..14a6ceb3f8 100644
--- a/tests/testlist.c
+++ b/tests/testlist.c
@@ -290,7 +290,7 @@ main (int argc, char *argv[])
 
   scrolled = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-  gtk_container_add (GTK_CONTAINER (scrolled), list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), list);
   gtk_container_add (GTK_CONTAINER (hbox), scrolled);
 
   g_signal_connect (list, "row-activated", G_CALLBACK (row_activated_cb), NULL);
diff --git a/tests/testlist2.c b/tests/testlist2.c
index 244974b969..3dfb4702c2 100644
--- a/tests/testlist2.c
+++ b/tests/testlist2.c
@@ -123,7 +123,7 @@ int main (int argc, char *argv[])
   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_container_add (GTK_CONTAINER (sw), list);
+  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 88d1713716..00444ab777 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -158,7 +158,7 @@ main (int argc, char *argv[])
   gtk_widget_set_hexpand (sw, TRUE);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
   gtk_container_add (GTK_CONTAINER (hbox), sw);
-  gtk_container_add (GTK_CONTAINER (sw), list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
 
   button = gtk_check_button_new_with_label ("Activate on single click");
   g_object_bind_property (list, "activate-on-single-click",
diff --git a/tests/testlist4.c b/tests/testlist4.c
index 96deaf3765..8f4294e2f5 100644
--- a/tests/testlist4.c
+++ b/tests/testlist4.c
@@ -110,7 +110,7 @@ new_window (GApplication *app)
   list = gtk_list_box_new ();
   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);
-  gtk_container_add (GTK_CONTAINER (sw), list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
 
   label = gtk_label_new ("No row activated");
   gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
diff --git a/tests/testoverlay.c b/tests/testoverlay.c
index 5f7c0293b4..54b92789f0 100644
--- a/tests/testoverlay.c
+++ b/tests/testoverlay.c
@@ -247,7 +247,7 @@ test_scrolling (void)
 
   gtk_widget_set_hexpand (text, TRUE);
   gtk_widget_set_vexpand (text, TRUE);
-  gtk_container_add (GTK_CONTAINER (sw), text);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
 
   child = gtk_label_new ("This should be visible");
   gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
@@ -393,7 +393,7 @@ test_chase (void)
 
   gtk_widget_set_hexpand (text, TRUE);
   gtk_widget_set_vexpand (text, TRUE);
-  gtk_container_add (GTK_CONTAINER (sw), text);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
 
   child = gtk_label_new ("Try to enter");
   gtk_widget_set_halign (child, GTK_ALIGN_START);
diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c
index 92e861e7d4..4243e1e7e9 100644
--- a/tests/testoverlaystyleclass.c
+++ b/tests/testoverlaystyleclass.c
@@ -77,7 +77,7 @@ main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (overlay), sw);
 
   main_child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (sw), main_child);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), main_child);
   gtk_widget_set_hexpand (main_child, TRUE);
   gtk_widget_set_vexpand (main_child, TRUE);
   label = gtk_label_new ("Main child");
diff --git a/tests/testscrolledge.c b/tests/testscrolledge.c
index 23663bf520..af674571d8 100644
--- a/tests/testscrolledge.c
+++ b/tests/testscrolledge.c
@@ -127,7 +127,7 @@ main (int argc, char *argv[])
 
   gtk_container_add (GTK_CONTAINER (win), overlay);
   gtk_container_add (GTK_CONTAINER (overlay), sw);
-  gtk_container_add (GTK_CONTAINER (sw), list);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
   populate_list (GTK_LIST_BOX (list));
 
   g_signal_connect (sw, "edge-overshot", G_CALLBACK (edge_overshot), list);
diff --git a/tests/testscrolledwindow.c b/tests/testscrolledwindow.c
index c00508288c..7c181227cf 100644
--- a/tests/testscrolledwindow.c
+++ b/tests/testscrolledwindow.c
@@ -119,7 +119,7 @@ scrollable_policy (void)
   gtk_widget_show (label);
   gtk_widget_show (viewport);
   gtk_viewport_set_child (GTK_VIEWPORT (viewport), label);
-  gtk_container_add (GTK_CONTAINER (swindow), viewport);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), viewport);
 
   /* Add controls here */
   expander = gtk_expander_new ("Controls");
@@ -232,7 +232,7 @@ scrollable_policy (void)
 
   /* Listbox */
   listbox = gtk_list_box_new ();
-  gtk_container_add (GTK_CONTAINER (swindow), listbox);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), listbox);
   gtk_widget_show (listbox);
 
   /* Min content */
diff --git a/tests/testscrolltofocus.c b/tests/testscrolltofocus.c
index 8bc6da352f..58c5083442 100644
--- a/tests/testscrolltofocus.c
+++ b/tests/testscrolltofocus.c
@@ -15,7 +15,7 @@ int main (int argc, char *argv[])
   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);
-  gtk_container_add (GTK_CONTAINER (sw), viewport);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), viewport);
   grid = gtk_grid_new ();
   gtk_widget_set_margin_start (grid, 20);
   gtk_widget_set_margin_end (grid, 20);
diff --git a/tests/teststack.c b/tests/teststack.c
index 3e0affc23f..079a7ff104 100644
--- a/tests/teststack.c
+++ b/tests/teststack.c
@@ -177,7 +177,7 @@ main (gint argc,
 
   tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
 
-  gtk_container_add (GTK_CONTAINER (scrolled_win), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_win), tree_view);
   w3 = scrolled_win;
 
   renderer = gtk_cell_renderer_text_new ();
diff --git a/tests/testtextview.c b/tests/testtextview.c
index 922606ae83..c5918355b4 100644
--- a/tests/testtextview.c
+++ b/tests/testtextview.c
@@ -193,7 +193,7 @@ main (int argc, char **argv)
   anchor = insert_text (buffer);
 
   gtk_container_add (GTK_CONTAINER (window), sw);
-  gtk_container_add (GTK_CONTAINER (sw), textview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
   gtk_text_view_add_overlay (GTK_TEXT_VIEW (textview),
                              button,
                              50, 150);
diff --git a/tests/testtextview2.c b/tests/testtextview2.c
index 5e0c4d4453..42a7e08f42 100644
--- a/tests/testtextview2.c
+++ b/tests/testtextview2.c
@@ -203,7 +203,7 @@ main (int argc, char *argv[])
   gtk_container_add (GTK_CONTAINER (box), sw);
 
   tv = gtk_text_view_new ();
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   buffer = gtk_text_buffer_new (NULL);
   gtk_text_view_set_buffer (GTK_TEXT_VIEW (tv), buffer);
diff --git a/tests/testtreechanging.c b/tests/testtreechanging.c
index 23d24cdfa1..9cfb81ef74 100644
--- a/tests/testtreechanging.c
+++ b/tests/testtreechanging.c
@@ -515,7 +515,7 @@ main (int    argc,
                                                NULL);
   for (i = 0; i < (MIN_ROWS + MAX_ROWS) / 2; i++)
     add (GTK_TREE_VIEW (treeview));
-  gtk_container_add (GTK_CONTAINER (sw), treeview);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
 
   gtk_widget_show (window);
 
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c
index a4c1b8dcd0..07002cc8b3 100644
--- a/tests/testtreecolumns.c
+++ b/tests/testtreecolumns.c
@@ -763,7 +763,7 @@ main (int argc, char *argv[])
   gtk_window_set_title (GTK_WINDOW (window), "Top Window");
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_container_add (GTK_CONTAINER (window), swindow);
-  gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_top);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), sample_tree_view_top);
   gtk_widget_show (window);
 
   window = gtk_window_new ();
@@ -772,7 +772,7 @@ main (int argc, char *argv[])
   gtk_window_set_title (GTK_WINDOW (window), "Bottom Window");
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_container_add (GTK_CONTAINER (window), swindow);
-  gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_bottom);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), sample_tree_view_bottom);
   gtk_widget_show (window);
 
   /* Set up the main window */
@@ -791,7 +791,7 @@ main (int argc, char *argv[])
   swindow = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   left_tree_view = gtk_tree_view_new_with_model (left_tree_model);
-  gtk_container_add (GTK_CONTAINER (swindow), left_tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), left_tree_view);
   gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1,
                                               "Unattached Columns", cell, "text", 0, NULL);
   cell = gtk_cell_renderer_toggle_new ();
@@ -857,7 +857,7 @@ main (int argc, char *argv[])
   gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
   gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column);
 
-  gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), top_right_tree_view);
   gtk_container_add (GTK_CONTAINER (vbox2), swindow);
 
   swindow = gtk_scrolled_window_new (NULL, NULL);
@@ -871,7 +871,7 @@ main (int argc, char *argv[])
   column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL);
   gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
   gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column);
-  gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), bottom_right_tree_view);
   gtk_container_add (GTK_CONTAINER (vbox2), swindow);
 
 
diff --git a/tests/testtreecolumnsizing.c b/tests/testtreecolumnsizing.c
index 5432002b73..39ef865a77 100644
--- a/tests/testtreecolumnsizing.c
+++ b/tests/testtreecolumnsizing.c
@@ -213,7 +213,7 @@ main (int argc, char **argv)
   gtk_container_add (GTK_CONTAINER (vbox), sw);
 
   tree_view = gtk_tree_view_new_with_model (create_model ());
-  gtk_container_add (GTK_CONTAINER (sw), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tree_view);
 
   for (i = 0; i < 5; i++)
     {
diff --git a/tests/testtreeedit.c b/tests/testtreeedit.c
index 1a2139c43f..a1d4b3e59c 100644
--- a/tests/testtreeedit.c
+++ b/tests/testtreeedit.c
@@ -358,7 +358,7 @@ main (gint argc, gchar **argv)
                                               "value", PROGRESS_COLUMN,
                                               NULL);
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
 
   gtk_window_set_default_size (GTK_WINDOW (window),
                               800, 250);
diff --git a/tests/testtreeflow.c b/tests/testtreeflow.c
index e7c90662d7..a638131871 100644
--- a/tests/testtreeflow.c
+++ b/tests/testtreeflow.c
@@ -169,7 +169,7 @@ main (int argc, char *argv[])
                                               gtk_cell_renderer_text_new (),
                                               "text", TEXT_COLUMN,
                                               NULL);
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_container_add (GTK_CONTAINER (vbox), hbox);
   button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>");
diff --git a/tests/testtreefocus.c b/tests/testtreefocus.c
index 87c5fec4af..a89fd74015 100644
--- a/tests/testtreefocus.c
+++ b/tests/testtreefocus.c
@@ -466,7 +466,7 @@ main (int argc, char *argv[])
   gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
   gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
 
   g_signal_connect (tree_view, "realize",
                    G_CALLBACK (gtk_tree_view_expand_all),
@@ -536,8 +536,7 @@ main (int argc, char *argv[])
                    G_CALLBACK (gtk_tree_view_expand_all),
                    NULL);
                           
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
-
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
 
   gtk_window_set_default_size (GTK_WINDOW (window),
                               650, 400);
diff --git a/tests/testtreepos.c b/tests/testtreepos.c
index fcd1590060..5625d2631e 100644
--- a/tests/testtreepos.c
+++ b/tests/testtreepos.c
@@ -97,7 +97,7 @@ int main (int argc, char *argv[])
   sw = gtk_scrolled_window_new (NULL, NULL);
   gtk_container_add (GTK_CONTAINER (window), sw);
   tv = gtk_tree_view_new ();
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
 
   col = gtk_tree_view_column_new ();
   cell = gtk_cell_renderer_text_new ();
diff --git a/tests/testtreesort.c b/tests/testtreesort.c
index 5f07c6b80d..4cf6904897 100644
--- a/tests/testtreesort.c
+++ b/tests/testtreesort.c
@@ -235,7 +235,7 @@ main (int argc, char *argv[])
                                        WORD_COLUMN_1,
                                        GTK_SORT_ASCENDING);*/
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
   gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
   gtk_widget_show (window);
 
@@ -299,9 +299,8 @@ main (int argc, char *argv[])
       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (smodel),
                                            WORD_COLUMN_1,
                                            GTK_SORT_DESCENDING);*/
-      
-      
-      gtk_container_add (GTK_CONTAINER (scrolled_window2), tree_view2);
+
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window2), tree_view2);
       gtk_window_set_default_size (GTK_WINDOW (window2), 400, 400);
       gtk_widget_show (window2);
     }
@@ -367,8 +366,8 @@ main (int argc, char *argv[])
       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (ssmodel),
                                            WORD_COLUMN_1,
                                            GTK_SORT_ASCENDING);*/
-      
-      gtk_container_add (GTK_CONTAINER (scrolled_window3), tree_view3);
+
+      gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window3), tree_view3);
       gtk_window_set_default_size (GTK_WINDOW (window3), 400, 400);
       gtk_widget_show (window3);
     }
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index f7843dc67c..534a6f0f6e 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -755,7 +755,7 @@ main (int    argc,
   
   gtk_container_add (GTK_CONTAINER (box), sw);
   
-  gtk_container_add (GTK_CONTAINER (sw), tv);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
   
   gtk_widget_show (window);
   
diff --git a/tests/testverticalcells.c b/tests/testverticalcells.c
index 23ea1ddcd7..aaead5a21b 100644
--- a/tests/testverticalcells.c
+++ b/tests/testverticalcells.c
@@ -377,8 +377,8 @@ main (gint argc, gchar **argv)
 
   gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
 
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
-  
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
+
   gtk_window_set_default_size (GTK_WINDOW (window),
                               800, 400);
 
diff --git a/tests/treestoretest.c b/tests/treestoretest.c
index c461c25b37..d8a3430b86 100644
--- a/tests/treestoretest.c
+++ b/tests/treestoretest.c
@@ -342,7 +342,7 @@ make_window (gint view_type)
   gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), GTK_SELECTION_SINGLE);
 
   /* Put them together */
-  gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
+  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);
diff --git a/testsuite/a11y/children.c b/testsuite/a11y/children.c
index debbca5b1e..f5c7d588a2 100644
--- a/testsuite/a11y/children.c
+++ b/testsuite/a11y/children.c
@@ -40,7 +40,7 @@ test_scrolled_window_child_count (void)
   g_object_ref_sink (sw);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                   GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
-  gtk_container_add (GTK_CONTAINER (sw), gtk_label_new ("Bla"));
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gtk_label_new ("Bla"));
 
   accessible = gtk_widget_get_accessible (sw);
   g_assert_cmpint (atk_object_get_n_accessible_children (accessible), ==, 3);
diff --git a/testsuite/gtk/scrolledwindow.c b/testsuite/gtk/scrolledwindow.c
index 9f03174e59..8cabbd926b 100644
--- a/testsuite/gtk/scrolledwindow.c
+++ b/testsuite/gtk/scrolledwindow.c
@@ -29,7 +29,7 @@ test_size (gboolean       overlay,
   gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scrolledwindow), TRUE);
   gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scrolledwindow), overlay);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), policy, policy);
-  gtk_container_add (GTK_CONTAINER (scrolledwindow), box);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), box);
 
   /* Testing the content-width property */
   if (orientation == GTK_ORIENTATION_HORIZONTAL)


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