From e9ddf0fda552889ba17c2f34705ed87d38824cff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 1 May 2020 15:43:09 -0400 Subject: [PATCH] Use gtk_viewport_set_child throughout Replace all uses of gtk_container_add on viewports by gtk_viewport_set_child. --- gtk/gtkscrolledwindow.c | 2 +- gtk/inspector/prop-editor.c | 2 +- tests/scrolling-performance.c | 2 +- tests/testgrid.c | 2 +- tests/testscrolledwindow.c | 2 +- tests/testscrolltofocus.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index d2c660607e..0d2eedccd7 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -3501,7 +3501,7 @@ gtk_scrolled_window_add (GtkContainer *container, else { scrollable_child = gtk_viewport_new (hadj, vadj); - gtk_container_add (GTK_CONTAINER (scrollable_child), child); + gtk_viewport_set_child (GTK_VIEWPORT (scrollable_child), child); priv->auto_added_viewport = TRUE; } diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index 8b881f5f2f..a5630d4488 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -575,7 +575,7 @@ flags_changed (GObject *object, GParamSpec *pspec, gpointer data) popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (data)); sw = gtk_bin_get_child (GTK_BIN (popover)); viewport = gtk_bin_get_child (GTK_BIN (sw)); - box = gtk_bin_get_child (GTK_BIN (viewport)); + box = gtk_viewport_get_child (GTK_VIEWPORT (viewport)); children = gtk_container_get_children (GTK_CONTAINER (box)); for (c = children; c; c = c->next) diff --git a/tests/scrolling-performance.c b/tests/scrolling-performance.c index 65a1c03f18..c47e834fb7 100644 --- a/tests/scrolling-performance.c +++ b/tests/scrolling-performance.c @@ -138,7 +138,7 @@ main (int argc, char **argv) gtk_container_add (GTK_CONTAINER (scrolled_window), viewport); grid = gtk_grid_new (); - gtk_container_add (GTK_CONTAINER (viewport), grid); + gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid); for (i = 0; i < 4; i++) { diff --git a/tests/testgrid.c b/tests/testgrid.c index 6f05e7b66e..0df805101a 100644 --- a/tests/testgrid.c +++ b/tests/testgrid.c @@ -264,7 +264,7 @@ scrolling (void) gtk_container_add (GTK_CONTAINER (window), sw); gtk_container_add (GTK_CONTAINER (sw), viewport); - gtk_container_add (GTK_CONTAINER (viewport), grid); + gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid); child = oriented_test_widget ("#800080", "#800080"); gtk_grid_attach (GTK_GRID (grid), child, 0, 0, 1, 1); diff --git a/tests/testscrolledwindow.c b/tests/testscrolledwindow.c index a03851f954..a8926410d3 100644 --- a/tests/testscrolledwindow.c +++ b/tests/testscrolledwindow.c @@ -118,7 +118,7 @@ scrollable_policy (void) gtk_widget_show (label); gtk_widget_show (viewport); - gtk_container_add (GTK_CONTAINER (viewport), label); + gtk_viewport_set_child (GTK_VIEWPORT (viewport), label); gtk_container_add (GTK_CONTAINER (swindow), viewport); /* Add controls here */ diff --git a/tests/testscrolltofocus.c b/tests/testscrolltofocus.c index ac46c815ce..8bc6da352f 100644 --- a/tests/testscrolltofocus.c +++ b/tests/testscrolltofocus.c @@ -21,7 +21,7 @@ int main (int argc, char *argv[]) gtk_widget_set_margin_end (grid, 20); gtk_widget_set_margin_top (grid, 20); gtk_widget_set_margin_bottom (grid, 20); - gtk_container_add (GTK_CONTAINER (viewport), grid); + gtk_viewport_set_child (GTK_VIEWPORT (viewport), grid); for (i = 0; i < 20; i++) for (j = 0; j < 20; j++)