Use gtk_viewport_set_child throughout

Replace all uses of gtk_container_add on viewports
by gtk_viewport_set_child.
This commit is contained in:
Matthias Clasen 2020-05-01 15:43:09 -04:00
parent 937c94bab5
commit e9ddf0fda5
6 changed files with 6 additions and 6 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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++)
{

View File

@ -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);

View File

@ -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 */

View File

@ -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++)