Commit ce869921 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Matthias Clasen

Don't use gtk_scrolled_window_add_with_viewport() in tests

https://bugzilla.gnome.org/show_bug.cgi?id=693015
parent 7c1c7cb7
...@@ -575,8 +575,7 @@ do_toolpalette (GtkWidget *do_widget) ...@@ -575,8 +575,7 @@ do_toolpalette (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller), gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
contents);
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6); gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
...@@ -606,8 +605,7 @@ do_toolpalette (GtkWidget *do_widget) ...@@ -606,8 +605,7 @@ do_toolpalette (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller), gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
contents);
gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6); gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller, gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller,
......
...@@ -1024,8 +1024,7 @@ create_scrolledwindow (void) ...@@ -1024,8 +1024,7 @@ create_scrolledwindow (void)
scrolledwin = gtk_scrolled_window_new (NULL, NULL); scrolledwin = gtk_scrolled_window_new (NULL, NULL);
label = gtk_label_new ("Scrolled Window"); label = gtk_label_new ("Scrolled Window");
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwin), gtk_container_add (GTK_CONTAINER (scrolledwin), label);
label);
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM); return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
} }
......
...@@ -39,7 +39,7 @@ test_scrolled_window_child_count (void) ...@@ -39,7 +39,7 @@ test_scrolled_window_child_count (void)
g_object_ref_sink (sw); g_object_ref_sink (sw);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS); GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), gtk_label_new ("Bla")); gtk_container_add (GTK_CONTAINER (sw), gtk_label_new ("Bla"));
accessible = gtk_widget_get_accessible (sw); accessible = gtk_widget_get_accessible (sw);
g_assert_cmpint (atk_object_get_n_accessible_children (accessible), ==, 3); g_assert_cmpint (atk_object_get_n_accessible_children (accessible), ==, 3);
...@@ -65,16 +65,6 @@ children_changed (AtkObject *accessible, ...@@ -65,16 +65,6 @@ children_changed (AtkObject *accessible,
data->n_children = atk_object_get_n_accessible_children (accessible); data->n_children = atk_object_get_n_accessible_children (accessible);
} }
static void
add_child (GtkWidget *container,
GtkWidget *child)
{
if (GTK_IS_SCROLLED_WINDOW (container))
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (container), child);
else
gtk_container_add (GTK_CONTAINER (container), child);
}
static void static void
remove_child (STATE *state, remove_child (STATE *state,
gint i) gint i)
...@@ -179,7 +169,7 @@ test_add_remove (GtkWidget *widget) ...@@ -179,7 +169,7 @@ test_add_remove (GtkWidget *widget)
child_accessible = gtk_widget_get_accessible (state.child[i]); child_accessible = gtk_widget_get_accessible (state.child[i]);
g_signal_connect (child_accessible, "notify::accessible-parent", g_signal_connect (child_accessible, "notify::accessible-parent",
G_CALLBACK (parent_notify), &(parent_data[i])); G_CALLBACK (parent_notify), &(parent_data[i]));
add_child (widget, state.child[i]); gtk_container_add (GTK_CONTAINER (widget), state.child[i]);
} }
else else
child_accessible = atk_object_ref_accessible_child (accessible, i); child_accessible = atk_object_ref_accessible_child (accessible, i);
......
...@@ -1146,7 +1146,7 @@ properties_from_type (GObject *object, ...@@ -1146,7 +1146,7 @@ properties_from_type (GObject *object,
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox); gtk_container_add (GTK_CONTAINER (sw), vbox);
g_free (specs); g_free (specs);
...@@ -1220,7 +1220,7 @@ child_properties_from_object (GObject *object) ...@@ -1220,7 +1220,7 @@ child_properties_from_object (GObject *object)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox); gtk_container_add (GTK_CONTAINER (sw), vbox);
g_free (specs); g_free (specs);
...@@ -1283,7 +1283,7 @@ children_from_object (GObject *object) ...@@ -1283,7 +1283,7 @@ children_from_object (GObject *object)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox); gtk_container_add (GTK_CONTAINER (sw), vbox);
g_list_free (children); g_list_free (children);
...@@ -1339,7 +1339,7 @@ cells_from_object (GObject *object) ...@@ -1339,7 +1339,7 @@ cells_from_object (GObject *object)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox); gtk_container_add (GTK_CONTAINER (sw), vbox);
g_list_free (cells); g_list_free (cells);
......
...@@ -3551,7 +3551,7 @@ create_scrolled_windows (GtkWidget *widget) ...@@ -3551,7 +3551,7 @@ create_scrolled_windows (GtkWidget *widget)
grid = gtk_grid_new (); grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 10); gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
gtk_grid_set_column_spacing (GTK_GRID (grid), 10); gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), grid); gtk_container_add (GTK_CONTAINER (scrolled_window), grid);
gtk_container_set_focus_hadjustment (GTK_CONTAINER (grid), gtk_container_set_focus_hadjustment (GTK_CONTAINER (grid),
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window))); gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
gtk_container_set_focus_vadjustment (GTK_CONTAINER (grid), gtk_container_set_focus_vadjustment (GTK_CONTAINER (grid),
...@@ -8719,7 +8719,7 @@ create_selection_test (GtkWidget *widget) ...@@ -8719,7 +8719,7 @@ create_selection_test (GtkWidget *widget)
store = gtk_list_store_new (1, G_TYPE_STRING); store = gtk_list_store_new (1, G_TYPE_STRING);
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), tree_view); gtk_container_add (GTK_CONTAINER (scrolled_win), tree_view);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Target", renderer, column = gtk_tree_view_column_new_with_attributes ("Target", renderer,
...@@ -9750,7 +9750,7 @@ create_main_window (void) ...@@ -9750,7 +9750,7 @@ create_main_window (void)
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), box2); gtk_container_add (GTK_CONTAINER (scrolled_window), box2);
gtk_container_set_focus_vadjustment (GTK_CONTAINER (box2), gtk_container_set_focus_vadjustment (GTK_CONTAINER (box2),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window))); gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
gtk_widget_show (box2); gtk_widget_show (box2);
......
...@@ -69,7 +69,7 @@ kinetic_scrolling (void) ...@@ -69,7 +69,7 @@ kinetic_scrolling (void)
swindow = gtk_scrolled_window_new (NULL, NULL); swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE); gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE);
gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE); gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swindow), button_grid); gtk_container_add (GTK_CONTAINER (swindow), button_grid);
gtk_widget_show (button_grid); gtk_widget_show (button_grid);
gtk_grid_attach (GTK_GRID (grid), swindow, 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), swindow, 0, 1, 1, 1);
......
...@@ -68,8 +68,7 @@ main (int argc, char *argv[]) ...@@ -68,8 +68,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (overlay), sw); gtk_container_add (GTK_CONTAINER (overlay), sw);
main_child = gtk_event_box_new (); main_child = gtk_event_box_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), gtk_container_add (GTK_CONTAINER (sw), main_child);
main_child);
gdk_rgba_parse (&color, "green"); gdk_rgba_parse (&color, "green");
gtk_widget_override_background_color (main_child, 0, &color); gtk_widget_override_background_color (main_child, 0, &color);
gtk_widget_set_hexpand (main_child, TRUE); gtk_widget_set_hexpand (main_child, TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment