diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-09 08:26:52 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-11 22:38:21 -0400 |
commit | 2a24b8c6534b58051135570399cba8a6b04d34ea (patch) | |
tree | c3b4690ed396ab2b2ca162641bd2008d0bd7630e /tests | |
parent | 665edcba53bf2f2e854a95cdcc52a72c16a1a427 (diff) | |
download | gtk+-2a24b8c6534b58051135570399cba8a6b04d34ea.tar.gz |
Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
Diffstat (limited to 'tests')
90 files changed, 1138 insertions, 1064 deletions
diff --git a/tests/gdkgears.c b/tests/gdkgears.c index 28dd15cc5a..ae77b9293f 100644 --- a/tests/gdkgears.c +++ b/tests/gdkgears.c @@ -65,7 +65,7 @@ create_axis_slider (GtkGears *gears, } label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0); g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis)); @@ -74,7 +74,7 @@ create_axis_slider (GtkGears *gears, gears); slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj); gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE); - gtk_container_add (GTK_CONTAINER (box), slider); + gtk_box_append (GTK_BOX (box), slider); gtk_widget_set_vexpand (slider, TRUE); return box; @@ -83,23 +83,21 @@ create_axis_slider (GtkGears *gears, static void moar_gears (GtkButton *button, gpointer data) { - GtkContainer *container = GTK_CONTAINER (data); GtkWidget *gears; gears = gtk_gears_new (); gtk_widget_set_size_request (gears, 100, 100); - gtk_container_add (container, gears); + gtk_box_append (GTK_BOX (data), gears); } static void less_gears (GtkButton *button, gpointer data) { - GtkContainer *container = GTK_CONTAINER (data); GtkWidget *gears; - gears = gtk_widget_get_last_child (GTK_WIDGET (container)); + gears = gtk_widget_get_last_child (GTK_WIDGET (data)); if (gears) - gtk_container_remove (container, gears); + gtk_box_remove (GTK_BOX (data), gears); } static void @@ -152,7 +150,7 @@ main (int argc, char *argv[]) gtk_frame_set_child (GTK_FRAME (frame), hbox); label = gtk_label_new ("This is a transparent overlay widget!!!!\nAmazing, eh?"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE); gtk_box_set_spacing (GTK_BOX (box), 6); @@ -160,24 +158,24 @@ main (int argc, char *argv[]) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE); gtk_box_set_spacing (GTK_BOX (box), 6); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); gears = gtk_gears_new (); gtk_widget_set_hexpand (gears, TRUE); gtk_widget_set_vexpand (gears, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), gears); + gtk_box_append (GTK_BOX (hbox), gears); for (i = 0; i < GTK_GEARS_N_AXIS; i++) - gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i)); + gtk_box_append (GTK_BOX (hbox), create_axis_slider (GTK_GEARS (gears), i)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE); gtk_box_set_spacing (GTK_BOX (hbox), 6); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); fps_label = gtk_label_new (""); gtk_widget_set_hexpand (fps_label, TRUE); gtk_widget_set_halign (fps_label, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (hbox), fps_label); + gtk_box_append (GTK_BOX (hbox), fps_label); gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label)); @@ -188,10 +186,10 @@ main (int argc, char *argv[]) gtk_popover_set_child (GTK_POPOVER (popover), label); gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); check = gtk_check_button_new_with_label ("Overlay"); - gtk_container_add (GTK_CONTAINER (hbox), check); + gtk_box_append (GTK_BOX (hbox), check); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE); g_signal_connect (check, "toggled", G_CALLBACK (toggle_overlay), revealer); @@ -199,12 +197,12 @@ main (int argc, char *argv[]) check = gtk_check_button_new_with_label ("Animate spinner"); - gtk_container_add (GTK_CONTAINER (hbox), check); + gtk_box_append (GTK_BOX (hbox), check); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); spinner = gtk_spinner_new (); - gtk_container_add (GTK_CONTAINER (hbox), spinner); + gtk_box_append (GTK_BOX (hbox), spinner); gtk_spinner_start (GTK_SPINNER (spinner)); g_signal_connect (check, "toggled", G_CALLBACK (toggle_spin), spinner); @@ -214,7 +212,7 @@ main (int argc, char *argv[]) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (box), scrolled); + gtk_box_append (GTK_BOX (box), scrolled); extra_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE); gtk_box_set_spacing (GTK_BOX (extra_hbox), 6); @@ -222,19 +220,19 @@ main (int argc, char *argv[]) bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_spacing (GTK_BOX (bbox), 6); - gtk_container_add (GTK_CONTAINER (box), bbox); + gtk_box_append (GTK_BOX (box), bbox); button = gtk_button_new_with_label ("Moar gears!"); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); g_signal_connect (button, "clicked", G_CALLBACK (moar_gears), extra_hbox); button = gtk_button_new_with_label ("Less gears!"); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); g_signal_connect (button, "clicked", G_CALLBACK (less_gears), extra_hbox); button = gtk_button_new_with_label ("Quit"); gtk_widget_set_hexpand (button, TRUE); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); gtk_widget_show (window); diff --git a/tests/motion-compression.c b/tests/motion-compression.c index caba2bca3f..33be6b617e 100644 --- a/tests/motion-compression.c +++ b/tests/motion-compression.c @@ -67,15 +67,15 @@ 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_widget_set_vexpand (da, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), da); + gtk_box_append (GTK_BOX (vbox), da); label = gtk_label_new ("Event processing time (ms):"); gtk_widget_set_halign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); adjustment = gtk_adjustment_new (20, 0, 200, 1, 10, 0); scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment); - gtk_container_add (GTK_CONTAINER (vbox), scale); + gtk_box_append (GTK_BOX (vbox), scale); controller = gtk_event_controller_motion_new (); g_signal_connect (controller, "motion", diff --git a/tests/overlayscroll.c b/tests/overlayscroll.c index 2daee85411..0eb0582b6f 100644 --- a/tests/overlayscroll.c +++ b/tests/overlayscroll.c @@ -78,7 +78,7 @@ main (int argc, char *argv[]) GTK_POLICY_AUTOMATIC); gtk_widget_set_hexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); content = get_content (); @@ -98,10 +98,10 @@ main (int argc, char *argv[]) g_signal_connect (combo, "changed", G_CALLBACK (mode_changed), sw); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); sb2 = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adj); - gtk_container_add (GTK_CONTAINER (box), sb2); + gtk_box_append (GTK_BOX (box), sb2); gtk_widget_show (window); diff --git a/tests/print-editor.c b/tests/print-editor.c index 0d2ee82133..7b8ca15e15 100644 --- a/tests/print-editor.c +++ b/tests/print-editor.c @@ -342,15 +342,15 @@ create_custom_widget (GtkPrintOperation *operation, vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); gtk_widget_show (hbox); label = gtk_label_new ("Font:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); gtk_widget_show (label); font = gtk_font_button_new_with_font (data->font); - gtk_container_add (GTK_CONTAINER (hbox), font); + gtk_box_append (GTK_BOX (hbox), font); gtk_widget_show (font); data->font_button = font; @@ -762,7 +762,7 @@ activate (GApplication *app) gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE); gtk_widget_set_vexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); contents = gtk_text_view_new (); gtk_widget_grab_focus (contents); @@ -772,7 +772,7 @@ activate (GApplication *app) /* Create statusbar */ statusbar = gtk_statusbar_new (); - gtk_container_add (GTK_CONTAINER (box), statusbar); + gtk_box_append (GTK_BOX (box), statusbar); /* Show text widget info in the statusbar */ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); diff --git a/tests/scrolling-performance.c b/tests/scrolling-performance.c index 96fc298542..033bd31fd4 100644 --- a/tests/scrolling-performance.c +++ b/tests/scrolling-performance.c @@ -45,7 +45,7 @@ create_widget_factory_content (void) result = GTK_WIDGET (gtk_builder_get_object (builder, "box1")); g_object_ref (result); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (result)), + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (result)), result); g_object_unref (builder); diff --git a/tests/showrendernode.c b/tests/showrendernode.c index 1f54217073..538f7288ae 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -216,8 +216,8 @@ main (int argc, char **argv) gdk_texture_get_width (texture), gdk_texture_get_height (texture)); - gtk_container_add (GTK_CONTAINER (box), nodeview); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), nodeview); + gtk_box_append (GTK_BOX (box), image); gtk_window_set_child (GTK_WINDOW (window), box); gsk_renderer_unrealize (renderer); diff --git a/tests/syncscroll.c b/tests/syncscroll.c index 7ad7662133..ffbfc209ca 100644 --- a/tests/syncscroll.c +++ b/tests/syncscroll.c @@ -33,7 +33,7 @@ main (int argc, char *argv[]) GTK_POLICY_NEVER, GTK_POLICY_EXTERNAL); gtk_widget_set_hexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); tv = gtk_text_view_new (); fill_text_view (tv, "Left"); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); @@ -45,7 +45,7 @@ main (int argc, char *argv[]) GTK_POLICY_NEVER, GTK_POLICY_EXTERNAL); gtk_widget_set_hexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); tv = gtk_text_view_new (); fill_text_view (tv, "Middle"); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); @@ -55,14 +55,14 @@ main (int argc, char *argv[]) GTK_POLICY_NEVER, GTK_POLICY_EXTERNAL); gtk_widget_set_hexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); tv = gtk_text_view_new (); fill_text_view (tv, "Right"); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); sb = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adj); - gtk_container_add (GTK_CONTAINER (box), sb); + gtk_box_append (GTK_BOX (box), sb); gtk_widget_show (win); diff --git a/tests/testaccel.c b/tests/testaccel.c index 270d8a1b16..fedefd4781 100644 --- a/tests/testaccel.c +++ b/tests/testaccel.c @@ -74,7 +74,7 @@ key_test (void) gtk_widget_set_vexpand (sw, TRUE); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); gtk_window_set_child (GTK_WINDOW (window), box); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); 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)); @@ -111,7 +111,7 @@ key_test (void) } entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); return window; } diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c index d9a122042a..4ae0568c7d 100644 --- a/tests/testadjustsize.c +++ b/tests/testadjustsize.c @@ -153,14 +153,14 @@ open_control_window (void) g_signal_connect (G_OBJECT (toggle), "toggled", G_CALLBACK (on_set_small_size_requests), NULL); - gtk_container_add (GTK_CONTAINER (box), toggle); + gtk_box_append (GTK_BOX (box), toggle); toggle = gtk_toggle_button_new_with_label ("Set large size requests"); g_signal_connect (G_OBJECT (toggle), "toggled", G_CALLBACK (on_set_large_size_requests), NULL); - gtk_container_add (GTK_CONTAINER (box), toggle); + gtk_box_append (GTK_BOX (box), toggle); gtk_widget_show (window); @@ -182,16 +182,16 @@ create_widget_visible_border (const char *text) inner_box = gtk_overlay_new (); gtk_widget_add_css_class (inner_box, "blue-bg"); - gtk_container_add (GTK_CONTAINER (outer_box), inner_box); + gtk_box_append (GTK_BOX (outer_box), inner_box); test_widget = gtk_overlay_new (); gtk_widget_add_css_class (test_widget, "red-bg"); - gtk_container_add (GTK_CONTAINER (inner_box), test_widget); + gtk_box_append (GTK_BOX (inner_box), test_widget); label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (test_widget), label); + gtk_box_append (GTK_BOX (test_widget), label); g_assert (TEST_WIDGET (outer_box) == test_widget); @@ -315,7 +315,7 @@ open_margin_window (void) GtkWidget *child = create_margined(margins[i]); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); } gtk_widget_show (test_window); @@ -334,7 +334,7 @@ open_valigned_label_window (void) gtk_window_set_child (GTK_WINDOW (window), box); label = gtk_label_new ("Both labels expand"); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new ("Some wrapping text with width-chars = 15 and max-width-chars = 35"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); @@ -347,7 +347,7 @@ open_valigned_label_window (void) gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); gtk_window_present (GTK_WINDOW (window)); } diff --git a/tests/testappchooserbutton.c b/tests/testappchooserbutton.c index 288949db76..1cc98923d9 100644 --- a/tests/testappchooserbutton.c +++ b/tests/testappchooserbutton.c @@ -91,7 +91,7 @@ main (int argc, button = gtk_app_chooser_button_new ("image/jpeg"); gtk_widget_set_vexpand (button, TRUE); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_signal_connect (button, "changed", G_CALLBACK (combo_changed_cb), NULL); @@ -99,18 +99,18 @@ main (int argc, w = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (w), "<b>Selected app info</b>"); gtk_widget_set_vexpand (w, TRUE); - gtk_container_add (GTK_CONTAINER (box), w); + gtk_box_append (GTK_BOX (box), w); w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_vexpand (w, TRUE); - gtk_container_add (GTK_CONTAINER (box), w); + gtk_box_append (GTK_BOX (box), w); sel_image = gtk_image_new (); gtk_widget_set_hexpand (sel_image, TRUE); - gtk_container_add (GTK_CONTAINER (w), sel_image); + gtk_box_append (GTK_BOX (w), sel_image); sel_name = gtk_label_new (NULL); gtk_widget_set_hexpand (sel_name, TRUE); - gtk_container_add (GTK_CONTAINER (w), sel_name); + gtk_box_append (GTK_BOX (w), sel_name); gtk_app_chooser_button_set_heading (GTK_APP_CHOOSER_BUTTON (button), "Choose one, <i>not</i> two"); gtk_app_chooser_button_append_separator (GTK_APP_CHOOSER_BUTTON (button)); diff --git a/tests/testassistant.c b/tests/testassistant.c index ea6daf9361..22ee8209c2 100644 --- a/tests/testassistant.c +++ b/tests/testassistant.c @@ -61,8 +61,8 @@ add_completion_test_page (GtkWidget *assistant, page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); check = gtk_check_button_new_with_label ("Complete"); - gtk_container_add (GTK_CONTAINER (page), gtk_label_new (text)); - gtk_container_add (GTK_CONTAINER (page), check); + gtk_box_append (GTK_BOX (page), gtk_label_new (text)); + gtk_box_append (GTK_BOX (page), check); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), complete); @@ -271,7 +271,7 @@ create_generous_assistant (GtkWidget *widget) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); g_signal_connect (G_OBJECT (check), "toggled", G_CALLBACK (visible_cb), next); - gtk_container_add (GTK_CONTAINER (page), check); + gtk_box_append (GTK_BOX (page), check); add_completion_test_page (assistant, "Even More Content", TRUE, TRUE); @@ -369,13 +369,13 @@ create_nonlinear_assistant (GtkWidget *widget) page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); button = gtk_radio_button_new_with_label (NULL, "branch A"); - gtk_container_add (GTK_CONTAINER (page), button); + gtk_box_append (GTK_BOX (page), button); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('A')); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); button = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "branch B"); - gtk_container_add (GTK_CONTAINER (page), button); + gtk_box_append (GTK_BOX (page), button); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('B')); gtk_assistant_append_page (GTK_ASSISTANT (assistant), page); @@ -624,7 +624,7 @@ create_page_flipping_assistant (GtkWidget *widget) gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE); page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (page), + gtk_box_append (GTK_BOX (page), get_test_page ("Page 2")); gtk_assistant_append_page (GTK_ASSISTANT (assistant), page); gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2"); @@ -704,7 +704,7 @@ main (int argc, gchar *argv[]) g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (buttons[i].func), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } gtk_widget_show (window); diff --git a/tests/testbaseline.c b/tests/testbaseline.c index ba1129d4cc..f229a9b660 100644 --- a/tests/testbaseline.c +++ b/tests/testbaseline.c @@ -112,13 +112,13 @@ main (int argc, for (j = 0; j < 2; j++) { hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); const char *aligns_names[] = { "FILL", "BASELINE" }; GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE}; label = gtk_label_new (aligns_names[j]); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); for (i = 0; i < 3; i++) { label = gtk_label_new ("│XYyj,Ö..."); @@ -127,7 +127,7 @@ main (int argc, gtk_widget_set_valign (label, aligns[j]); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); } for (i = 0; i < 3; i++) { @@ -138,33 +138,33 @@ main (int argc, gtk_widget_set_valign (entry, aligns[j]); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); } spin = gtk_spin_button_new (NULL, 0, 1); gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), GTK_ORIENTATION_VERTICAL); gtk_widget_set_valign (spin, aligns[j]); - gtk_container_add (GTK_CONTAINER (hbox), spin); + gtk_box_append (GTK_BOX (hbox), spin); spin = gtk_spin_button_new (NULL, 0, 1); gtk_widget_set_valign (spin, aligns[j]); - gtk_container_add (GTK_CONTAINER (hbox), spin); + gtk_box_append (GTK_BOX (hbox), spin); } grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[1]); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[2]); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1); - gtk_container_add (GTK_CONTAINER (hbox), combo); + gtk_box_append (GTK_BOX (hbox), combo); for (j = 0; j < 2; j++) { hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (baseline_position_changed), hbox); @@ -173,7 +173,7 @@ main (int argc, label = gtk_label_new ("Baseline:"); else label = gtk_label_new ("Normal:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); for (i = 0; i < 3; i++) { @@ -184,7 +184,7 @@ main (int argc, if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } for (i = 0; i < 3; i++) @@ -192,8 +192,8 @@ main (int argc, GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); - gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("face-sad")); + gtk_box_append (GTK_BOX (box), gtk_label_new ("│Xyj,Ö")); + gtk_box_append (GTK_BOX (box), gtk_image_new_from_icon_name ("face-sad")); gtk_button_set_child (GTK_BUTTON (button), box); set_font_size (button, i); @@ -201,34 +201,34 @@ main (int argc, if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 34); if (j == 0) gtk_widget_set_valign (image, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); button = gtk_toggle_button_new_with_label ("│Xyj,Ö"); if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_toggle_button_new_with_label ("│Xyj,Ö"); if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_check_button_new_with_label ("│Xyj,Ö"); if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_radio_button_new_with_label (NULL, "│Xyj,Ö"); if (j == 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } @@ -237,12 +237,12 @@ main (int argc, vbox, gtk_label_new ("grid")); grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Align me:"); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); grid = gtk_grid_new (); gtk_widget_set_valign (grid, GTK_ALIGN_BASELINE); @@ -284,8 +284,8 @@ main (int argc, GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); - gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("face-sad")); + gtk_box_append (GTK_BOX (box), gtk_label_new ("│Xyj,Ö")); + gtk_box_append (GTK_BOX (box), gtk_image_new_from_icon_name ("face-sad")); gtk_button_set_child (GTK_BUTTON (button), box); set_font_size (button, i); @@ -301,19 +301,19 @@ main (int argc, } - gtk_container_add (GTK_CONTAINER (hbox), grid); + gtk_box_append (GTK_BOX (hbox), grid); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); adjustment = gtk_adjustment_new (0.0, -1.0, 5.0, 1.0, 1.0, 0.0); spin = gtk_spin_button_new (adjustment, 1.0, 0); g_signal_connect (spin, "value-changed", (GCallback)baseline_row_value_changed, grid); - gtk_container_add (GTK_CONTAINER (hbox), spin); + gtk_box_append (GTK_BOX (hbox), spin); toggle = gtk_toggle_button_new_with_label ("Homogeneous"); g_signal_connect (toggle, "toggled", (GCallback)homogeneous_changed, grid); - gtk_container_add (GTK_CONTAINER (hbox), toggle); + gtk_box_append (GTK_BOX (hbox), toggle); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]); @@ -322,37 +322,37 @@ main (int argc, gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1); g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (baseline_position_changed), grid_hbox); - gtk_container_add (GTK_CONTAINER (hbox), combo); + gtk_box_append (GTK_BOX (hbox), combo); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, gtk_label_new ("button box")); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); adjustment = gtk_adjustment_new (34.0, 1.0, 64.0, 1.0, 1.0, 0.0); spin = gtk_spin_button_new (adjustment, 1.0, 0); - gtk_container_add (GTK_CONTAINER (hbox), spin); + gtk_box_append (GTK_BOX (hbox), spin); adjustment = gtk_adjustment_new (16.0, 1.0, 64.0, 1.0, 1.0, 0.0); spin2 = gtk_spin_button_new (adjustment, 1.0, 0); - gtk_container_add (GTK_CONTAINER (hbox), spin2); + gtk_box_append (GTK_BOX (hbox), spin2); for (j = 0; j < 3; j++) { hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); gtk_box_set_baseline_position (GTK_BOX (hbox), j); label = gtk_label_new (baseline_pos_str[j]); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); gtk_widget_set_vexpand (label, TRUE); image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 34); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); g_signal_connect (spin, "value-changed", (GCallback)image_size_value_changed, image); @@ -365,7 +365,7 @@ main (int argc, if (i != 0) gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } for (i = 0; i < 3; i++) @@ -373,10 +373,10 @@ main (int argc, GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("│Xyj,Ö")); + gtk_box_append (GTK_BOX (box), gtk_label_new ("│Xyj,Ö")); image = gtk_image_new_from_icon_name ("face-sad"); gtk_image_set_pixel_size (GTK_IMAGE (image), 16); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), image); gtk_button_set_child (GTK_BUTTON (button), box); if (i == 0) @@ -386,7 +386,7 @@ main (int argc, gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } } diff --git a/tests/testblur.c b/tests/testblur.c index 21fa7774ae..618862cf1c 100644 --- a/tests/testblur.c +++ b/tests/testblur.c @@ -112,7 +112,7 @@ main (int argc, char **argv) gtk_label_set_attributes (GTK_LABEL (value_label), attrs); pango_attr_list_unref (attrs); } - gtk_container_add (GTK_CONTAINER (blur_box), value_label); + gtk_box_append (GTK_BOX (blur_box), value_label); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 10, 0.05); @@ -123,7 +123,7 @@ main (int argc, char **argv) g_signal_connect (scale, "value-changed", G_CALLBACK (value_changed_cb), blur_box); g_signal_connect (scale, "value-changed", G_CALLBACK (value_changed_cb2), value_label); - gtk_container_add (GTK_CONTAINER (blur_box), scale); + gtk_box_append (GTK_BOX (blur_box), scale); gtk_window_set_child (GTK_WINDOW (window), blur_box); gtk_widget_show (window); diff --git a/tests/testborderdrawing.c b/tests/testborderdrawing.c index 96c3246bb3..fa5b3125af 100644 --- a/tests/testborderdrawing.c +++ b/tests/testborderdrawing.c @@ -118,52 +118,52 @@ main (int argc, char **argv) w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "one"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "two"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "three"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "four"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "five"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); /* Bottom */ w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "b1"); - gtk_container_add (GTK_CONTAINER (bottom), w); + gtk_box_append (GTK_BOX (bottom), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "b2"); - gtk_container_add (GTK_CONTAINER (bottom), w); + gtk_box_append (GTK_BOX (bottom), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "b3"); - gtk_container_add (GTK_CONTAINER (bottom), w); + gtk_box_append (GTK_BOX (bottom), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "b4"); - gtk_container_add (GTK_CONTAINER (bottom), w); + gtk_box_append (GTK_BOX (bottom), w); - gtk_container_add (GTK_CONTAINER (box), top); - gtk_container_add (GTK_CONTAINER (box), bottom); + gtk_box_append (GTK_BOX (box), top); + gtk_box_append (GTK_BOX (box), bottom); 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 62e62f3d47..3b551079d4 100644 --- a/tests/testbox.c +++ b/tests/testbox.c @@ -27,7 +27,7 @@ edit_widget (GtkWidget *button) "row-spacing", 10, "column-spacing", 10, NULL); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid); label = gtk_label_new ("Label:"); gtk_widget_set_halign (label, GTK_ALIGN_END); @@ -92,14 +92,14 @@ main (int argc, char *argv[]) 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")); - gtk_container_add (GTK_CONTAINER (box), test_widget ("2")); - gtk_container_add (GTK_CONTAINER (box), test_widget ("3")); - gtk_container_add (GTK_CONTAINER (box), test_widget ("4")); - gtk_container_add (GTK_CONTAINER (box), test_widget ("5")); - gtk_container_add (GTK_CONTAINER (box), test_widget ("6")); + gtk_box_append (GTK_BOX (box), test_widget ("1")); + gtk_box_append (GTK_BOX (box), test_widget ("2")); + gtk_box_append (GTK_BOX (box), test_widget ("3")); + gtk_box_append (GTK_BOX (box), test_widget ("4")); + gtk_box_append (GTK_BOX (box), test_widget ("5")); + gtk_box_append (GTK_BOX (box), test_widget ("6")); - gtk_container_add (GTK_CONTAINER (vbox), box); + gtk_box_append (GTK_BOX (vbox), box); check = gtk_check_button_new_with_label ("Homogeneous"); g_object_bind_property (box, "homogeneous", @@ -110,7 +110,7 @@ main (int argc, char *argv[]) gtk_widget_set_margin_top (check, 10); gtk_widget_set_margin_bottom (check, 10); gtk_widget_set_halign (check, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), check); + gtk_box_append (GTK_BOX (vbox), check); b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_widget_set_margin_start (b, 10); @@ -120,15 +120,15 @@ main (int argc, char *argv[]) gtk_widget_set_halign (b, GTK_ALIGN_CENTER); label = gtk_label_new ("Spacing:"); gtk_widget_set_halign (label, GTK_ALIGN_END); - gtk_container_add (GTK_CONTAINER (b), label); + gtk_box_append (GTK_BOX (b), label); spin = gtk_spin_button_new_with_range (0, 10, 1); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_widget_set_halign (spin, GTK_ALIGN_START); g_signal_connect (spin, "value-changed", G_CALLBACK (spacing_changed), box); - gtk_container_add (GTK_CONTAINER (b), spin); - gtk_container_add (GTK_CONTAINER (vbox), b); + gtk_box_append (GTK_BOX (b), spin); + gtk_box_append (GTK_BOX (vbox), b); gtk_widget_show (window); diff --git a/tests/testbuttons.c b/tests/testbuttons.c index 08f4418e29..cac1b578a0 100644 --- a/tests/testbuttons.c +++ b/tests/testbuttons.c @@ -36,11 +36,11 @@ int main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (window), box); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = g_object_new (GTK_TYPE_BUTTON, "label", "document-save", NULL); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_object_get (button, "label", &text, @@ -50,12 +50,12 @@ int main (int argc, char *argv[]) text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE"); label = gtk_label_new (text); g_free (text); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new_with_label ("_Save"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_object_get (button, "label", &text, @@ -65,12 +65,12 @@ int main (int argc, char *argv[]) text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE"); label = gtk_label_new (text); g_free (text); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new_with_mnemonic ("_Save"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_object_get (button, "label", &text, @@ -80,12 +80,12 @@ int main (int argc, char *argv[]) text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE"); label = gtk_label_new (text); g_free (text); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new_from_icon_name ("help-about"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_object_get (button, "label", &text, @@ -95,14 +95,14 @@ int main (int argc, char *argv[]) text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE"); label = gtk_label_new (text); g_free (text); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new (); gtk_button_set_icon_name (GTK_BUTTON (button), "help-about"); gtk_button_set_use_underline (GTK_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_object_get (button, "label", &text, "use-underline", &use_underline, @@ -111,7 +111,7 @@ int main (int argc, char *argv[]) text = g_strdup_printf ("label: \"%s\" icon-name: \"%s\" use-underline: %s\n", text, icon_name, use_underline ? "TRUE" : "FALSE"); label = gtk_label_new (text); g_free (text); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); gtk_widget_show (window); diff --git a/tests/testcalendar.c b/tests/testcalendar.c index 3f641ddf3b..de43eac502 100644 --- a/tests/testcalendar.c +++ b/tests/testcalendar.c @@ -235,24 +235,24 @@ create_calendar(void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); frame = create_frame ("<b>Options</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (rpane), frame); + gtk_box_append (GTK_BOX (rpane), frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); gtk_widget_set_halign (hbox, GTK_ALIGN_START); gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Build the Right frame with the flags in */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (rpane), vbox); + gtk_box_append (GTK_BOX (rpane), vbox); for (i = 0; i < G_N_ELEMENTS (flags); i++) { GtkWidget *toggle = gtk_check_button_new_with_mnemonic (flags[i].label); gboolean value; - gtk_container_add (GTK_CONTAINER (vbox), toggle); + gtk_box_append (GTK_BOX (vbox), toggle); g_object_get (G_OBJECT (calendar), flags[i].prop_name, &value, NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), value); @@ -269,25 +269,25 @@ create_calendar(void) frame = create_frame ("<b>Signal Events</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Signal:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); calendar_data.last_sig = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), calendar_data.last_sig); + gtk_box_append (GTK_BOX (hbox), calendar_data.last_sig); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Previous signal:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); calendar_data.prev_sig = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), calendar_data.prev_sig); + gtk_box_append (GTK_BOX (hbox), calendar_data.prev_sig); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Second previous signal:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); calendar_data.prev2_sig = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), calendar_data.prev2_sig); + gtk_box_append (GTK_BOX (hbox), calendar_data.prev2_sig); /* * Glue everything together @@ -298,15 +298,15 @@ create_calendar(void) button = gtk_button_new_with_label ("Close"); g_signal_connect (button, "clicked", G_CALLBACK (quit_cb), &done); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (vbox), hpaned); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (vbox), frame); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (vbox), bbox); + gtk_box_append (GTK_BOX (vbox), hpaned); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), frame); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), bbox); gtk_window_set_child (GTK_WINDOW (window), vbox); diff --git a/tests/testcellarea.c b/tests/testcellarea.c index 78c3e817ce..158553c28b 100644 --- a/tests/testcellarea.c +++ b/tests/testcellarea.c @@ -196,29 +196,29 @@ simple_cell_area (void) /* Now add some controls */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); - gtk_container_add (GTK_CONTAINER (hbox), frame); + gtk_box_append (GTK_BOX (hbox), frame); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (orientation_changed), iconview); widget = gtk_check_button_new_with_label ("Align 2nd Cell"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (align_cell_2_toggled), iconview); widget = gtk_check_button_new_with_label ("Align 3rd Cell"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (align_cell_3_toggled), iconview); @@ -226,21 +226,21 @@ simple_cell_area (void) widget = gtk_check_button_new_with_label ("Expand 1st Cell"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (expand_cell_1_toggled), iconview); widget = gtk_check_button_new_with_label ("Expand 2nd Cell"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (expand_cell_2_toggled), iconview); widget = gtk_check_button_new_with_label ("Expand 3rd Cell"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (expand_cell_3_toggled), iconview); @@ -432,21 +432,21 @@ focus_cell_area (void) /* Now add some controls */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), vbox); - gtk_container_add (GTK_CONTAINER (hbox), frame); + gtk_box_append (GTK_BOX (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), frame); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (orientation_changed), iconview); widget = gtk_check_button_new_with_label ("Focus Sibling"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (focus_sibling_toggled), iconview); @@ -513,7 +513,7 @@ background_area (void) "prepended space distributed to the background area."); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_width_chars (GTK_LABEL (label), 40); - gtk_container_add (GTK_CONTAINER (main_vbox), label); + gtk_box_append (GTK_BOX (main_vbox), label); iconview = focus_iconview (TRUE, NULL, NULL); @@ -527,16 +527,16 @@ background_area (void) /* Now add some controls */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), vbox); - gtk_container_add (GTK_CONTAINER (hbox), frame); + gtk_box_append (GTK_BOX (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), frame); - gtk_container_add (GTK_CONTAINER (main_vbox), hbox); + gtk_box_append (GTK_BOX (main_vbox), hbox); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (orientation_changed), iconview); @@ -545,9 +545,9 @@ background_area (void) label = gtk_label_new ("Cell spacing"); gtk_widget_set_hexpand (label, TRUE); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), label); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), label); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (cell_spacing_changed), iconview); @@ -558,9 +558,9 @@ background_area (void) label = gtk_label_new ("Row spacing"); gtk_widget_set_hexpand (label, TRUE); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), label); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), label); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (row_spacing_changed), iconview); @@ -570,9 +570,9 @@ background_area (void) gtk_widget_set_hexpand (label, TRUE); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), gtk_icon_view_get_item_padding (GTK_ICON_VIEW (iconview))); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), label); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), label); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (item_padding_changed), iconview); diff --git a/tests/testcellrenderertext.c b/tests/testcellrenderertext.c index 87f424330c..ca558dc51a 100644 --- a/tests/testcellrenderertext.c +++ b/tests/testcellrenderertext.c @@ -278,20 +278,20 @@ main (int argc, char **argv) /* LTR */ label = gtk_label_new ("Left to right"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); tree = create_tree (FALSE); gtk_widget_set_vexpand (tree, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), tree); + gtk_box_append (GTK_BOX (vbox), tree); /* RTL */ label = gtk_label_new ("Right to left"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); tree = create_tree (TRUE); gtk_widget_set_vexpand (tree, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), tree); + gtk_box_append (GTK_BOX (vbox), tree); gtk_widget_show (window); diff --git a/tests/testclipboard2.c b/tests/testclipboard2.c index a7d61be95b..40c91b2b72 100644 --- a/tests/testclipboard2.c +++ b/tests/testclipboard2.c @@ -204,7 +204,7 @@ format_list_add_row (GtkWidget *list, GtkWidget *box; box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new (format_name)); + gtk_box_append (GTK_BOX (box), gtk_label_new (format_name)); gdk_content_formats_unref (formats); gtk_list_box_insert (GTK_LIST_BOX (list), box, -1); @@ -303,7 +303,7 @@ add_provider_button (GtkWidget *box, if (provider) g_object_set_data_full (G_OBJECT (button), "provider", provider, g_object_unref); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } static GtkWidget * @@ -320,7 +320,7 @@ get_button_list (GdkClipboard *clipboard, box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new (info)); + gtk_box_append (GTK_BOX (box), gtk_label_new (info)); add_provider_button (box, NULL, @@ -388,16 +388,16 @@ get_clipboard_widget (GdkClipboard *clipboard, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox); - gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new (name)); + gtk_box_append (GTK_BOX (hbox), vbox); + gtk_box_append (GTK_BOX (vbox), gtk_label_new (name)); switcher = gtk_stack_switcher_new (); - gtk_container_add (GTK_CONTAINER (vbox), switcher); + gtk_box_append (GTK_BOX (vbox), switcher); stack = get_contents_widget (clipboard); - gtk_container_add (GTK_CONTAINER (vbox), stack); + gtk_box_append (GTK_BOX (vbox), stack); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); - gtk_container_add (GTK_CONTAINER (hbox), get_button_list (clipboard, "Set Locally:")); + gtk_box_append (GTK_BOX (hbox), get_button_list (clipboard, "Set Locally:")); if (clipboard != alt_clipboard) - gtk_container_add (GTK_CONTAINER (hbox), get_button_list (alt_clipboard, "Set Remotely:")); + gtk_box_append (GTK_BOX (hbox), get_button_list (alt_clipboard, "Set Remotely:")); return hbox; } @@ -410,11 +410,11 @@ get_window_contents (GdkDisplay *display, box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), get_clipboard_widget (gdk_display_get_clipboard (display), gdk_display_get_clipboard (alt_display), "Clipboard")); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), get_clipboard_widget (gdk_display_get_primary_clipboard (display), gdk_display_get_primary_clipboard (alt_display), "Primary Clipboard")); diff --git a/tests/testcombo.c b/tests/testcombo.c index 2ae3ceb6e0..fc1a53bedc 100644 --- a/tests/testcombo.c +++ b/tests/testcombo.c @@ -958,7 +958,7 @@ main (int argc, char **argv) /* GtkCellView */ tmp = gtk_frame_new ("GtkCellView"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -975,11 +975,11 @@ main (int argc, char **argv) renderer, TRUE); g_object_set (renderer, "text", "la la la", NULL); - gtk_container_add (GTK_CONTAINER (boom), cellview); + gtk_box_append (GTK_BOX (boom), cellview); /* GtkComboBox list */ tmp = gtk_frame_new ("GtkComboBox (list)"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -987,7 +987,7 @@ main (int argc, char **argv) model = create_list_blaat (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), @@ -1019,7 +1019,7 @@ main (int argc, char **argv) /* GtkComboBox dynamic list */ tmp = gtk_frame_new ("GtkComboBox (dynamic list)"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1030,7 +1030,7 @@ main (int argc, char **argv) G_CALLBACK (populate_list_blaat), combobox); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), @@ -1062,7 +1062,7 @@ main (int argc, char **argv) /* GtkComboBox custom entry */ tmp = gtk_frame_new ("GtkComboBox (custom)"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1070,7 +1070,7 @@ main (int argc, char **argv) model = create_list_blaat (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), @@ -1116,7 +1116,7 @@ main (int argc, char **argv) /* GtkComboBox tree */ tmp = gtk_frame_new ("GtkComboBox (tree)"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1124,7 +1124,7 @@ main (int argc, char **argv) model = create_tree_blaat (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), @@ -1159,7 +1159,7 @@ main (int argc, char **argv) /* GtkComboBox (grid mode) */ tmp = gtk_frame_new ("GtkComboBox (grid mode)"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1167,19 +1167,19 @@ main (int argc, char **argv) /* GtkComboBoxEntry */ tmp = gtk_frame_new ("GtkComboBox with entry"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); comboboxtext = gtk_combo_box_text_new_with_entry (); setup_combo_entry (GTK_COMBO_BOX_TEXT (comboboxtext)); - gtk_container_add (GTK_CONTAINER (boom), comboboxtext); + gtk_box_append (GTK_BOX (boom), comboboxtext); /* Phylogenetic tree */ tmp = gtk_frame_new ("What are you ?"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1187,7 +1187,7 @@ main (int argc, char **argv) model = create_phylogenetic_tree (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), @@ -1201,7 +1201,7 @@ main (int argc, char **argv) /* Capitals */ tmp = gtk_frame_new ("Where are you ?"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1209,7 +1209,7 @@ main (int argc, char **argv) model = create_capital_tree (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, @@ -1232,7 +1232,7 @@ main (int argc, char **argv) /* Aligned Food */ tmp = gtk_frame_new ("Hungry ?"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1240,7 +1240,7 @@ main (int argc, char **argv) model = create_food_list (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (combobox)); @@ -1266,7 +1266,7 @@ main (int argc, char **argv) /* Ellipsizing growing combos */ tmp = gtk_frame_new ("Unconstrained Menu"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (tmp), boom); @@ -1274,7 +1274,7 @@ main (int argc, char **argv) model = create_list_long (); combobox = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (boom), combobox); + gtk_box_append (GTK_BOX (boom), combobox); renderer = gtk_cell_renderer_text_new (); g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); @@ -1285,7 +1285,7 @@ main (int argc, char **argv) gtk_combo_box_set_popup_fixed_width (GTK_COMBO_BOX (combobox), FALSE); tmp = gtk_frame_new ("Looong"); - gtk_container_add (GTK_CONTAINER (mainbox), tmp); + gtk_box_append (GTK_BOX (mainbox), tmp); combobox = gtk_combo_box_text_new (); for (i = 0; i < 200; i++) { diff --git a/tests/testcombochange.c b/tests/testcombochange.c index 96e9c27393..29cefc662a 100644 --- a/tests/testcombochange.c +++ b/tests/testcombochange.c @@ -215,10 +215,10 @@ main (int argc, char **argv) content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - gtk_container_add (GTK_CONTAINER (content_area), hbox); + gtk_box_append (GTK_BOX (content_area), hbox); combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), combo_vbox); + gtk_box_append (GTK_BOX (hbox), combo_vbox); combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model)); cell_renderer = gtk_cell_renderer_text_new (); @@ -226,11 +226,11 @@ main (int argc, char **argv) gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell_renderer, "text", 0, NULL); gtk_widget_set_margin_start (combo, 12); - gtk_container_add (GTK_CONTAINER (combo_vbox), combo); + gtk_box_append (GTK_BOX (combo_vbox), combo); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_hexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), scrolled_window); + gtk_box_append (GTK_BOX (hbox), scrolled_window); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -241,24 +241,24 @@ main (int argc, char **argv) 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); + gtk_box_append (GTK_BOX (hbox), button_vbox); gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300); button = gtk_button_new_with_label ("Insert"); - gtk_container_add (GTK_CONTAINER (button_vbox), button); + gtk_box_append (GTK_BOX (button_vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (on_insert), NULL); button = gtk_button_new_with_label ("Delete"); - gtk_container_add (GTK_CONTAINER (button_vbox), button); + gtk_box_append (GTK_BOX (button_vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (on_delete), NULL); button = gtk_button_new_with_label ("Reorder"); - gtk_container_add (GTK_CONTAINER (button_vbox), button); + gtk_box_append (GTK_BOX (button_vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (on_reorder), NULL); button = gtk_button_new_with_label ("Animate"); - gtk_container_add (GTK_CONTAINER (button_vbox), button); + gtk_box_append (GTK_BOX (button_vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (on_animate), NULL); gtk_widget_show (dialog); diff --git a/tests/testdialog.c b/tests/testdialog.c index e1ed78a13f..c78ec11336 100644 --- a/tests/testdialog.c +++ b/tests/testdialog.c @@ -98,7 +98,7 @@ add_content (GtkWidget *dialog) gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label); } static void @@ -335,73 +335,73 @@ main (int argc, char *argv[]) box = gtk_flow_box_new (); gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_NONE); gtk_widget_set_hexpand (box, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), box); + gtk_box_append (GTK_BOX (vbox), box); button = gtk_button_new_with_label ("Message dialog"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Message with icon"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog1a), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Confirmation dialog"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_message_dialog2), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Builtin"); button = gtk_button_new_with_label ("Builtin"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Generic Builtin"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_color_chooser_generic), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Simple"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("With Header"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("With Buttons"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_buttons), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Header & Buttons"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Header & Buttons & Builder"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons2), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Template"); button = gtk_button_new_with_label ("Template"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Template With Header"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template_with_header), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_button_new_with_label ("Flexible Template"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_flex_template), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_flow_box_insert (GTK_FLOW_BOX (box), button, -1); button = gtk_check_button_new_with_label ("Dialogs have headers"); g_object_bind_property (gtk_settings_get_default (), "gtk-dialogs-use-header", button, "active", G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE); gtk_widget_set_halign (button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_spinner_new (); gtk_spinner_start (GTK_SPINNER (button)); gtk_widget_set_halign (button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); while (TRUE) g_main_context_iteration (NULL, TRUE); diff --git a/tests/testdnd2.c b/tests/testdnd2.c index e02dea97a4..a393bd9393 100644 --- a/tests/testdnd2.c +++ b/tests/testdnd2.c @@ -180,13 +180,13 @@ ask_actions (GdkDrop *drop, gtk_popover_set_child (GTK_POPOVER (popover), box); button = gtk_button_new_with_label ("Copy"); g_signal_connect (button, "clicked", G_CALLBACK (do_copy), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Move"); g_signal_connect (button, "clicked", G_CALLBACK (do_copy), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Cancel"); g_signal_connect (button, "clicked", G_CALLBACK (do_cancel), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } gtk_popover_popup (GTK_POPOVER (popover)); } diff --git a/tests/testdnd3.c b/tests/testdnd3.c index ac73b5bee4..3dd96bb35c 100644 --- a/tests/testdnd3.c +++ b/tests/testdnd3.c @@ -275,10 +275,10 @@ int main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (window), box); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); canvas = canvas_new (); - gtk_container_add (GTK_CONTAINER (box2), canvas); + gtk_box_append (GTK_BOX (box2), canvas); x = y = 40; for (i = 0; i < 4; i++) @@ -286,7 +286,7 @@ int main (int argc, char *argv[]) GtkWidget *item; item = canvas_item_new (i, x, y, 0); - gtk_container_add (GTK_CONTAINER (canvas), item); + gtk_box_append (GTK_BOX (canvas), item); apply_transform (item); x += 150; @@ -297,7 +297,7 @@ int main (int argc, char *argv[]) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_add_css_class (box3, "linked"); @@ -314,7 +314,7 @@ int main (int argc, char *argv[]) "rgba", &rgba, "selectable", FALSE, NULL); - gtk_container_add (GTK_CONTAINER (box3), swatch); + gtk_box_append (GTK_BOX (box3), swatch); } gtk_widget_show (window); diff --git a/tests/testellipsise.c b/tests/testellipsise.c index 6a8263a9ce..70f5be1385 100644 --- a/tests/testellipsise.c +++ b/tests/testellipsise.c @@ -143,9 +143,9 @@ main (int argc, char *argv[]) gtk_widget_set_vexpand (overlay, TRUE); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label); - gtk_container_add (GTK_CONTAINER (vbox), combo); - gtk_container_add (GTK_CONTAINER (vbox), scale); - gtk_container_add (GTK_CONTAINER (vbox), overlay); + gtk_box_append (GTK_BOX (vbox), combo); + gtk_box_append (GTK_BOX (vbox), scale); + gtk_box_append (GTK_BOX (vbox), overlay); g_object_set_data (G_OBJECT (label), "combo", combo); diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c index e06dc3f5ec..efdc9467d6 100644 --- a/tests/testentrycompletion.c +++ b/tests/testentrycompletion.c @@ -323,7 +323,7 @@ main (int argc, char *argv[]) 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."); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Create our first entry */ entry = gtk_entry_new (); @@ -336,7 +336,7 @@ main (int argc, char *argv[]) gtk_entry_set_completion (GTK_ENTRY (entry), completion); g_object_unref (completion); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); /* Create a tree model and use it as the completion model */ completion_model = create_simple_completion_model (); @@ -356,7 +356,7 @@ main (int argc, char *argv[]) gtk_entry_set_completion (GTK_ENTRY (entry), completion); g_object_unref (completion); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); /* Create a tree model and use it as the completion model */ completion_model = create_completion_model (); @@ -393,7 +393,7 @@ main (int argc, char *argv[]) gtk_entry_set_completion (GTK_ENTRY (entry), completion); g_object_unref (completion); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); /* Create a tree model and use it as the completion model */ completion_model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING)); @@ -408,7 +408,7 @@ main (int argc, char *argv[]) g_timeout_add (1000, (GSourceFunc) animation_timer, completion); /* Fourth entry */ - gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Model-less entry completion")); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion")); entry = gtk_entry_new (); @@ -419,7 +419,7 @@ main (int argc, char *argv[]) gtk_entry_set_completion (GTK_ENTRY (entry), completion); g_object_unref (completion); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); gtk_widget_show (window); diff --git a/tests/testentryicons.c b/tests/testentryicons.c index 3d6a4fdbea..9d8bf7fd1f 100644 --- a/tests/testentryicons.c +++ b/tests/testentryicons.c @@ -241,22 +241,22 @@ main (int argc, char **argv) button1 = gtk_radio_button_new_with_label (NULL, "Blank"); gtk_widget_set_valign (button1, GTK_ALIGN_START); g_signal_connect (button1, "toggled", G_CALLBACK (set_blank), entry); - gtk_container_add (GTK_CONTAINER (box), button1); + gtk_box_append (GTK_BOX (box), button1); button2 = gtk_radio_button_new_with_label (NULL, "Icon Name"); gtk_widget_set_valign (button2, GTK_ALIGN_START); gtk_radio_button_join_group (GTK_RADIO_BUTTON (button2), GTK_RADIO_BUTTON (button1)); g_signal_connect (button2, "toggled", G_CALLBACK (set_icon_name), entry); - gtk_container_add (GTK_CONTAINER (box), button2); + gtk_box_append (GTK_BOX (box), button2); button3 = gtk_radio_button_new_with_label (NULL, "GIcon"); gtk_widget_set_valign (button3, GTK_ALIGN_START); gtk_radio_button_join_group (GTK_RADIO_BUTTON (button3), GTK_RADIO_BUTTON (button1)); g_signal_connect (button3, "toggled", G_CALLBACK (set_gicon), entry); - gtk_container_add (GTK_CONTAINER (box), button3); + gtk_box_append (GTK_BOX (box), button3); button4 = gtk_radio_button_new_with_label (NULL, "Texture"); gtk_widget_set_valign (button4, GTK_ALIGN_START); gtk_radio_button_join_group (GTK_RADIO_BUTTON (button4), GTK_RADIO_BUTTON (button1)); g_signal_connect (button4, "toggled", G_CALLBACK (set_texture), entry); - gtk_container_add (GTK_CONTAINER (box), button4); + gtk_box_append (GTK_BOX (box), button4); label = gtk_label_new ("Emoji:"); gtk_grid_attach (GTK_GRID (grid), label, 0, 6, 1, 1); @@ -274,7 +274,7 @@ main (int argc, char **argv) gtk_widget_set_cursor_from_name (box, "text"); entry = gtk_entry_new (); gtk_widget_set_hexpand (entry, TRUE); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); image = gtk_image_new_from_icon_name ("edit-find-symbolic"); gtk_widget_set_cursor_from_name (image, "default"); gtk_widget_set_margin_start (image, 6); @@ -287,13 +287,13 @@ main (int argc, char **argv) gesture = gtk_gesture_click_new (); g_signal_connect (gesture, "pressed", G_CALLBACK (icon_pressed_cb), NULL); gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture)); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), image); image = gtk_image_new_from_icon_name ("document-save-symbolic"); gtk_widget_set_margin_start (image, 6); gtk_widget_set_margin_end (image, 6); gtk_widget_set_margin_top (image, 6); gtk_widget_set_margin_bottom (image, 6); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), image); gtk_grid_attach (GTK_GRID (grid), box, 1, 7, 1, 1); GtkCssProvider *provider; diff --git a/tests/testexpand.c b/tests/testexpand.c index 131eea5b2d..03b18bebc3 100644 --- a/tests/testexpand.c +++ b/tests/testexpand.c @@ -53,21 +53,21 @@ create_box_window (void) box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (box1), + gtk_box_append (GTK_BOX (box1), gtk_label_new ("VBox 1 Top")); - gtk_container_add (GTK_CONTAINER (box1), + gtk_box_append (GTK_BOX (box1), box2); - gtk_container_add (GTK_CONTAINER(box1), + gtk_box_append (GTK_BOX(box1), gtk_label_new ("VBox 1 Bottom")); - gtk_container_add (GTK_CONTAINER (box2), + gtk_box_append (GTK_BOX (box2), gtk_label_new ("HBox 2 Left")); - gtk_container_add (GTK_CONTAINER (box2), + gtk_box_append (GTK_BOX (box2), box3); - gtk_container_add (GTK_CONTAINER(box2), + gtk_box_append (GTK_BOX(box2), gtk_label_new ("HBox 2 Right")); - gtk_container_add (GTK_CONTAINER (box3), + gtk_box_append (GTK_BOX (box3), gtk_label_new ("VBox 3 Top")); colorbox = gtk_frame_new (NULL); @@ -83,7 +83,7 @@ create_box_window (void) G_CALLBACK (on_toggle_hexpand), NULL); gtk_frame_set_child (GTK_FRAME (colorbox), toggle); - gtk_container_add (GTK_CONTAINER (box3), colorbox); + gtk_box_append (GTK_BOX (box3), colorbox); colorbox = gtk_frame_new (NULL); @@ -97,8 +97,8 @@ create_box_window (void) g_signal_connect (G_OBJECT (toggle), "toggled", G_CALLBACK (on_toggle_vexpand), NULL); gtk_frame_set_child (GTK_FRAME (colorbox), toggle); - gtk_container_add (GTK_CONTAINER (box3), colorbox); - gtk_container_add (GTK_CONTAINER (box3), + gtk_box_append (GTK_BOX (box3), colorbox); + gtk_box_append (GTK_BOX (box3), gtk_label_new ("VBox 3 Bottom")); gtk_window_set_child (GTK_WINDOW (window), box1); diff --git a/tests/testexpander.c b/tests/testexpander.c index e9d6e7b745..d76619b912 100644 --- a/tests/testexpander.c +++ b/tests/testexpander.c @@ -7,11 +7,6 @@ expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog) } static void -do_not_expand (GtkWidget *child, gpointer data) -{ -} - -static void response_cb (GtkDialog *dialog, gint response_id, gpointer data) { gboolean *done = data; @@ -45,8 +40,6 @@ main (int argc, char *argv[]) "but not the full story."); area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog)); - /* make the labels not expand */ - gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL); expander = gtk_expander_new ("Details:"); sw = gtk_scrolled_window_new (NULL, NULL); @@ -72,7 +65,7 @@ main (int argc, char *argv[]) gtk_expander_set_child (GTK_EXPANDER (expander), sw); gtk_widget_set_hexpand (expander, TRUE); gtk_widget_set_vexpand (expander, TRUE); - gtk_container_add (GTK_CONTAINER (area), expander); + gtk_box_append (GTK_BOX (area), expander); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_cb), dialog); diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c index e5db029e4d..0cb5875ab6 100644 --- a/tests/testfilechooser.c +++ b/tests/testfilechooser.c @@ -455,49 +455,49 @@ main (int argc, char **argv) button = gtk_button_new_with_mnemonic ("_Select all"); gtk_widget_set_sensitive (button, multiple); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_file_chooser_select_all), dialog); g_signal_connect (dialog, "notify::select-multiple", G_CALLBACK (notify_multiple_cb), button); button = gtk_button_new_with_mnemonic ("_Unselect all"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_file_chooser_unselect_all), dialog); button = gtk_button_new_with_label ("set_current_folder (\"/nonexistent\")"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (set_folder_nonexistent_cb), dialog); button = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\")"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (set_folder_existing_nonexistent_cb), dialog); button = gtk_button_new_with_label ("set_filename (\"/nonexistent\")"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (set_filename_nonexistent_cb), dialog); button = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\")"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (set_filename_existing_nonexistent_cb), dialog); button = gtk_button_new_with_label ("Get selection"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (get_selection_cb), dialog); button = gtk_button_new_with_label ("Get current name"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (get_current_name_cb), dialog); button = gtk_button_new_with_label ("Unmap and remap"); - gtk_container_add (GTK_CONTAINER (vbbox), button); + gtk_box_append (GTK_BOX (vbbox), button); g_signal_connect (button, "clicked", G_CALLBACK (unmap_and_remap_cb), dialog); diff --git a/tests/testfilechooserbutton.c b/tests/testfilechooserbutton.c index 8015a3e6e6..270cd3194a 100644 --- a/tests/testfilechooserbutton.c +++ b/tests/testfilechooserbutton.c @@ -131,27 +131,27 @@ tests_button_clicked_cb (GtkButton *real_button, GTK_WINDOW (gtk_widget_get_root (user_data))); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (tests), box); + gtk_box_append (GTK_BOX (tests), box); button = gtk_button_new_with_label ("Print Selected Path"); g_signal_connect (button, "clicked", G_CALLBACK (print_selected_path_clicked_cb), user_data); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Add $PWD's Parent as Shortcut"); g_signal_connect (button, "clicked", G_CALLBACK (add_pwds_parent_as_shortcut_clicked_cb), user_data); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Remove $PWD's Parent as Shortcut"); g_signal_connect (button, "clicked", G_CALLBACK (del_pwds_parent_as_shortcut_clicked_cb), user_data); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Unselect all"); g_signal_connect (button, "clicked", G_CALLBACK (unselect_all_clicked_cb), user_data); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_set_data (user_data, "tests-dialog", tests); } @@ -229,12 +229,12 @@ add_new_filechooser_button (const gchar *mnemonic, GFile *path; hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - gtk_container_add (GTK_CONTAINER (group_box), hbox); + gtk_box_append (GTK_BOX (group_box), hbox); label = gtk_label_new_with_mnemonic (mnemonic); gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label); gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); chooser = gtk_file_chooser_button_new (g_strconcat(chooser_title, " - testfilechooserbutton", NULL), @@ -251,11 +251,11 @@ add_new_filechooser_button (const gchar *mnemonic, G_CALLBACK (chooser_current_folder_changed_cb), NULL); g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL); g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL); - gtk_container_add (GTK_CONTAINER (hbox), chooser); + gtk_box_append (GTK_BOX (hbox), chooser); button = gtk_button_new_with_label ("Tests"); g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } static void @@ -303,11 +303,11 @@ main (int argc, gtk_widget_set_margin_end (vbox, 6); gtk_widget_set_margin_top (vbox, 6); gtk_widget_set_margin_bottom (vbox, 6); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (win))), vbox); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (win))), vbox); frame = gtk_frame_new ("<b>GtkFileChooserButton</b>"); gtk_label_set_use_markup (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (frame))), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); gtk_widget_set_halign (frame, GTK_ALIGN_FILL); gtk_widget_set_valign (frame, GTK_ALIGN_FILL); diff --git a/tests/testflowbox.c b/tests/testflowbox.c index 972392909f..ece3a969f1 100644 --- a/tests/testflowbox.c +++ b/tests/testflowbox.c @@ -74,7 +74,7 @@ populate_flowbox_focus (GtkFlowBox *flowbox) gtk_frame_set_child (GTK_FRAME (frame), box); widget = gtk_label_new ("Label"); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); switch (i % 4) { @@ -95,10 +95,10 @@ populate_flowbox_focus (GtkFlowBox *flowbox) g_assert_not_reached (); } - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); if (i % 5 == 0) - gtk_container_add (GTK_CONTAINER (box), gtk_switch_new ()); + gtk_box_append (GTK_BOX (box), gtk_switch_new ()); gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1); if (!sensitive) @@ -172,11 +172,11 @@ populate_flowbox_images (GtkFlowBox *flowbox) label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (widget), image); - gtk_container_add (GTK_CONTAINER (widget), label); + gtk_box_append (GTK_BOX (widget), image); + gtk_box_append (GTK_BOX (widget), label); g_object_set_data_full (G_OBJECT (widget), "id", (gpointer)g_strdup (text), g_free); - gtk_container_add (GTK_CONTAINER (flowbox), widget); + gtk_box_append (GTK_BOX (flowbox), widget); g_free (text); } @@ -373,14 +373,14 @@ create_window (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_window_set_child (GTK_WINDOW (window), hbox); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_hexpand (swindow, TRUE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (hbox), swindow); + gtk_box_append (GTK_BOX (hbox), swindow); flowbox = gtk_flow_box_new (); gtk_widget_set_halign (flowbox, GTK_ALIGN_END); @@ -406,13 +406,13 @@ create_window (void) gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE); flowbox_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_expander_set_child (GTK_EXPANDER (expander), flowbox_cntl); - gtk_container_add (GTK_CONTAINER (vbox), expander); + gtk_box_append (GTK_BOX (vbox), expander); widget = gtk_check_button_new_with_label ("Homogeneous"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (homogeneous_toggled), flowbox); @@ -422,7 +422,7 @@ create_window (void) g_object_bind_property (widget, "active", flowbox, "activate-on-single-click", G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); /* Add alignment controls */ widget = gtk_combo_box_text_new (); @@ -433,7 +433,7 @@ create_window (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_HALIGN); gtk_widget_set_tooltip_text (widget, "Set the horizontal alignment policy"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (horizontal_alignment_changed), flowbox); @@ -446,7 +446,7 @@ create_window (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), INITIAL_VALIGN); gtk_widget_set_tooltip_text (widget, "Set the vertical alignment policy"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (vertical_alignment_changed), flowbox); @@ -458,7 +458,7 @@ create_window (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_widget_set_tooltip_text (widget, "Set the flowbox orientation"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (orientation_changed), flowbox); @@ -472,7 +472,7 @@ create_window (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1); gtk_widget_set_tooltip_text (widget, "Set the selection mode"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (selection_mode_changed), flowbox); @@ -482,7 +482,7 @@ create_window (void) gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MINIMUM_LENGTH); gtk_widget_set_tooltip_text (widget, "Set the minimum amount of items per line before wrapping"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (line_length_changed), flowbox); @@ -494,7 +494,7 @@ create_window (void) gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_MAXIMUM_LENGTH); gtk_widget_set_tooltip_text (widget, "Set the natural amount of items per line "); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (max_line_length_changed), flowbox); @@ -505,38 +505,38 @@ create_window (void) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); widget = gtk_label_new ("H Spacing"); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (0, 30, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_CSPACING); gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children"); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL)); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), hbox); + gtk_box_append (GTK_BOX (flowbox_cntl), hbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); widget = gtk_label_new ("V Spacing"); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (0, 30, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_RSPACING); gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children"); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL)); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL)); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), hbox); + gtk_box_append (GTK_BOX (flowbox_cntl), hbox); /* filtering and sorting */ @@ -544,7 +544,7 @@ create_window (void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (filter_toggled), flowbox); @@ -553,7 +553,7 @@ create_window (void) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted"); - gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget); + gtk_box_append (GTK_BOX (flowbox_cntl), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (sort_toggled), flowbox); @@ -564,7 +564,7 @@ create_window (void) gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE); items_cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_expander_set_child (GTK_EXPANDER (expander), items_cntl); - gtk_container_add (GTK_CONTAINER (vbox), expander); + gtk_box_append (GTK_BOX (vbox), expander); /* Add Items control */ widget = gtk_combo_box_text_new (); @@ -576,7 +576,7 @@ create_window (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_widget_set_tooltip_text (widget, "Set the item set to use"); - gtk_container_add (GTK_CONTAINER (items_cntl), widget); + gtk_box_append (GTK_BOX (items_cntl), widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (items_changed), flowbox); diff --git a/tests/testframe.c b/tests/testframe.c index f52e0caeba..36464daab2 100644 --- a/tests/testframe.c +++ b/tests/testframe.c @@ -79,7 +79,7 @@ int main (int argc, char **argv) frame = GTK_FRAME (gtk_frame_new ("Test GtkFrame")); gtk_widget_set_vexpand (GTK_WIDGET (frame), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (frame)); + gtk_box_append (GTK_BOX (vbox), GTK_WIDGET (frame)); widget = gtk_button_new_with_label ("Hello!"); gtk_frame_set_child (GTK_FRAME (frame), widget); @@ -87,7 +87,7 @@ int main (int argc, char **argv) grid = GTK_GRID (gtk_grid_new ()); gtk_grid_set_row_spacing (grid, 12); gtk_grid_set_column_spacing (grid, 6); - gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (grid)); + gtk_box_append (GTK_BOX (vbox), GTK_WIDGET (grid)); xalign = gtk_frame_get_label_align (frame); diff --git a/tests/testfullscreen.c b/tests/testfullscreen.c index 4a1e2ec2ec..c7deda5e92 100644 --- a/tests/testfullscreen.c +++ b/tests/testfullscreen.c @@ -78,15 +78,15 @@ main (int argc, char *argv[]) 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)); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Fullscreen on all monitors"); g_signal_connect (button, "clicked", G_CALLBACK (set_fullscreen_monitor_cb), GINT_TO_POINTER (GDK_FULLSCREEN_ON_ALL_MONITORS)); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Un-fullscreen"); g_signal_connect (button, "clicked", G_CALLBACK (remove_fullscreen_cb), NULL); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); gtk_widget_show (window); diff --git a/tests/testgaction.c b/tests/testgaction.c index 616fee0bf6..3a28d0b465 100644 --- a/tests/testgaction.c +++ b/tests/testgaction.c @@ -126,7 +126,7 @@ int main (int argc, char **argv) label = gtk_label_new ("Initial Text"); gtk_widget_set_margin_top (label, 12); gtk_widget_set_margin_bottom (label, 12); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_widget_set_halign (menubutton, GTK_ALIGN_CENTER); { GMenuModel *menu_model; @@ -137,10 +137,10 @@ int main (int argc, char **argv) } gtk_menu_button_set_popover (GTK_MENU_BUTTON (menubutton), menu); - gtk_container_add (GTK_CONTAINER (box), menubutton); + gtk_box_append (GTK_BOX (box), menubutton); gtk_widget_set_halign (button1, GTK_ALIGN_CENTER); gtk_actionable_set_action_name (GTK_ACTIONABLE (button1), "win.change-label-button"); - gtk_container_add (GTK_CONTAINER (box), button1); + gtk_box_append (GTK_BOX (box), button1); gtk_window_set_child (GTK_WINDOW (window), box); diff --git a/tests/testgiconpixbuf.c b/tests/testgiconpixbuf.c index 3f698098e2..16b3c1a991 100644 --- a/tests/testgiconpixbuf.c +++ b/tests/testgiconpixbuf.c @@ -53,32 +53,32 @@ main (int argc, gtk_window_set_child (GTK_WINDOW (toplevel), hbox); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); image = gtk_image_new_from_gicon (G_ICON (pixbuf)); gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE); - gtk_container_add (GTK_CONTAINER (vbox), image); + gtk_box_append (GTK_BOX (vbox), image); label = gtk_label_new (NULL); str = g_strdup_printf ("Normal icon, hash %u", g_icon_hash (G_ICON (pixbuf))); gtk_label_set_label (GTK_LABEL (label), str); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); otherpix = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL); emblem = g_emblem_new (G_ICON (otherpix)); emblemed = g_emblemed_icon_new (G_ICON (pixbuf), emblem); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); image2 = gtk_image_new_from_gicon (emblemed); gtk_image_set_icon_size (GTK_IMAGE (image2), GTK_ICON_SIZE_LARGE); - gtk_container_add (GTK_CONTAINER (vbox), image2); + gtk_box_append (GTK_BOX (vbox), image2); label = gtk_label_new (NULL); str = g_strdup_printf ("Emblemed icon, hash %u", g_icon_hash (emblemed)); gtk_label_set_label (GTK_LABEL (label), str); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); gtk_widget_show (toplevel); diff --git a/tests/testglarea.c b/tests/testglarea.c index 7ef8022222..5c8ab927f9 100644 --- a/tests/testglarea.c +++ b/tests/testglarea.c @@ -374,14 +374,14 @@ create_axis_slider (int axis) } label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0); g_signal_connect (adj, "value-changed", G_CALLBACK (on_axis_value_change), GINT_TO_POINTER (axis)); slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj); - gtk_container_add (GTK_CONTAINER (box), slider); + gtk_box_append (GTK_BOX (box), slider); gtk_widget_set_hexpand (slider, TRUE); return box; @@ -427,21 +427,21 @@ main (int argc, char *argv[]) gl_area = gtk_gl_area_new (); gtk_widget_set_hexpand (gl_area, TRUE); gtk_widget_set_vexpand (gl_area, TRUE); - gtk_container_add (GTK_CONTAINER (box), gl_area); + gtk_box_append (GTK_BOX (box), gl_area); g_signal_connect (gl_area, "realize", G_CALLBACK (realize), NULL); g_signal_connect (gl_area, "unrealize", G_CALLBACK (unrealize), NULL); g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL); controls = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE); - gtk_container_add (GTK_CONTAINER (box), controls); + gtk_box_append (GTK_BOX (box), controls); gtk_widget_set_hexpand (controls, TRUE); for (i = 0; i < N_AXIS; i++) - gtk_container_add (GTK_CONTAINER (controls), create_axis_slider (i)); + gtk_box_append (GTK_BOX (controls), create_axis_slider (i)); button = gtk_button_new_with_label ("Quit"); gtk_widget_set_hexpand (button, TRUE); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); gtk_widget_show (window); diff --git a/tests/testgmenu.c b/tests/testgmenu.c index d4a342c3d1..579518751d 100644 --- a/tests/testgmenu.c +++ b/tests/testgmenu.c @@ -564,7 +564,7 @@ create_add_remove_buttons (GActionGroup *group, box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); button = gtk_check_button_new_with_label ("Add Italic"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_set_data (G_OBJECT (button), "group", group); g_object_set_data (G_OBJECT (button), "model", model); @@ -573,7 +573,7 @@ create_add_remove_buttons (GActionGroup *group, G_CALLBACK (toggle_italic), treeview); button = gtk_check_button_new_with_label ("Add Sumerian"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_set_data (G_OBJECT (button), "group", group); g_object_set_data (G_OBJECT (button), "model", model); @@ -582,7 +582,7 @@ create_add_remove_buttons (GActionGroup *group, G_CALLBACK (toggle_sumerian), NULL); button = gtk_check_button_new_with_label ("Add Speed"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_set_data (G_OBJECT (button), "group", group); g_object_set_data (G_OBJECT (button), "model", model); @@ -661,9 +661,9 @@ main (int argc, char *argv[]) model = get_model (); tv = create_action_treeview (group); - gtk_container_add (GTK_CONTAINER (box), tv); + gtk_box_append (GTK_BOX (box), tv); buttons = create_add_remove_buttons (group, model, tv); - gtk_container_add (GTK_CONTAINER (box), buttons); + gtk_box_append (GTK_BOX (box), buttons); } if (do_export) @@ -688,7 +688,7 @@ main (int argc, char *argv[]) gtk_menu_button_set_label (GTK_MENU_BUTTON (button), "Click here"); gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model); gtk_widget_insert_action_group (button, "actions", group); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } gtk_widget_show (window); diff --git a/tests/testgrid.c b/tests/testgrid.c index 2369a7249e..15948f0063 100644 --- a/tests/testgrid.c +++ b/tests/testgrid.c @@ -18,7 +18,7 @@ oriented_test_widget (const gchar *label, const gchar *color) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_free (data); g_object_unref (provider); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); return box; } @@ -110,11 +110,11 @@ text_grid (void) grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("Above")); - gtk_container_add (GTK_CONTAINER (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (box), grid); - gtk_container_add (GTK_CONTAINER (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("Below")); + gtk_box_append (GTK_BOX (box), gtk_label_new ("Above")); + gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (box), grid); + gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (box), gtk_label_new ("Below")); label = gtk_label_new ("Some text that may wrap if it has to"); gtk_label_set_width_chars (GTK_LABEL (label), 10); @@ -146,32 +146,32 @@ box_comparison (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); 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)); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Above")); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), box); + gtk_box_append (GTK_BOX (vbox), box); - gtk_container_add (GTK_CONTAINER (box), test_widget ("1", "white")); + gtk_box_append (GTK_BOX (box), test_widget ("1", "white")); label = gtk_label_new ("Some ellipsizing text"); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_label_set_width_chars (GTK_LABEL (label), 10); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); - gtk_container_add (GTK_CONTAINER (box), test_widget ("2", "green")); + gtk_box_append (GTK_BOX (box), test_widget ("2", "green")); label = gtk_label_new ("Some text that may wrap if needed"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_width_chars (GTK_LABEL (label), 10); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); - gtk_container_add (GTK_CONTAINER (box), test_widget ("3", "red")); + gtk_box_append (GTK_BOX (box), test_widget ("3", "red")); grid = gtk_grid_new (); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (vbox), grid); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), grid); gtk_grid_attach (GTK_GRID (grid), test_widget ("1", "white"), 0, 0, 1, 1); @@ -191,8 +191,8 @@ box_comparison (void) gtk_grid_attach (GTK_GRID (grid), test_widget ("3", "red"), 4, 0, 1, 1); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Below")); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Below")); gtk_widget_show (window); } diff --git a/tests/testgtk.c b/tests/testgtk.c index d1463810f0..a296f5167f 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -155,10 +155,10 @@ build_alpha_widgets (void) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "<i>Entry: </i>"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); entry = gtk_entry_new (); gtk_widget_set_hexpand (entry, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); gtk_widget_set_hexpand (hbox, TRUE); gtk_grid_attach (GTK_GRID (grid), hbox, 0, 3, 2, 1); @@ -217,16 +217,14 @@ create_alpha_window (GtkWidget *widget) gtk_widget_set_margin_start (vbox, 12); gtk_widget_set_margin_end (vbox, 12); gtk_widget_set_vexpand (vbox, TRUE); - gtk_container_add (GTK_CONTAINER (content_area), vbox); - label = gtk_label_new (NULL); - gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (content_area), vbox); + gtk_box_append (GTK_BOX (vbox), label); display = gtk_widget_get_display (window); on_composited_changed (display, NULL, GTK_LABEL (label)); g_signal_connect (display, "notify::composited", G_CALLBACK (on_composited_changed), label); - gtk_container_add (GTK_CONTAINER (vbox), build_alpha_widgets ()); + gtk_box_append (GTK_BOX (vbox), build_alpha_widgets ()); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_signal_connect (window, "response", @@ -246,7 +244,7 @@ create_alpha_window (GtkWidget *widget) static void button_window (GtkWidget *widget, - GtkWidget *button) + GtkWidget *button) { if (!gtk_widget_get_visible (button)) gtk_widget_show (button); @@ -282,11 +280,12 @@ create_buttons (GtkWidget *widget) grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 5); gtk_grid_set_column_spacing (GTK_GRID (grid), 5); + gtk_widget_set_margin_top (grid, 10); gtk_widget_set_margin_bottom (grid, 10); gtk_widget_set_margin_start (grid, 10); gtk_widget_set_margin_end (grid, 10); - gtk_container_add (GTK_CONTAINER (box1), grid); + gtk_box_append (GTK_BOX (box1), grid); button[0] = gtk_button_new_with_label ("button1"); button[1] = gtk_button_new_with_mnemonic ("_button2"); @@ -311,10 +310,10 @@ create_buttons (GtkWidget *widget) } separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button[9] = gtk_button_new_with_label ("close"); gtk_widget_set_margin_top (button[9], 10); @@ -324,7 +323,7 @@ create_buttons (GtkWidget *widget) g_signal_connect_swapped (button[9], "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button[9]); + gtk_box_append (GTK_BOX (box2), button[9]); gtk_window_set_default_widget (GTK_WINDOW (window), button[9]); } @@ -360,28 +359,28 @@ create_toggle_buttons (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), box1); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_toggle_button_new_with_label ("button1"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_toggle_button_new_with_label ("button2"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_toggle_button_new_with_label ("button3"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -481,27 +480,27 @@ create_check_buttons (GtkWidget *widget) gtk_widget_set_margin_end (box2, 10); gtk_widget_set_margin_top (box2, 10); gtk_widget_set_margin_bottom (box2, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_check_button_new_with_mnemonic ("_button1"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_check_button_new_with_label ("button2"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_check_button_new_with_label ("button3"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_check_button_new_with_label ("inconsistent"); gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box2), separator); + gtk_box_append (GTK_BOX (box1), separator); table = create_widget_grid (GTK_TYPE_CHECK_BUTTON); gtk_widget_set_vexpand (table, TRUE); - gtk_container_add (GTK_CONTAINER (box2), table); + gtk_box_append (GTK_BOX (box2), table); } if (!gtk_widget_get_visible (window)) @@ -542,53 +541,53 @@ create_radio_buttons (GtkWidget *widget) box1 = gtk_dialog_get_content_area (GTK_DIALOG (window)); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_radio_button_new_with_label (NULL, "button1"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button2"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button3"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "inconsistent"); gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_radio_button_new_with_label (NULL, "button4"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button5"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_radio_button_new_with_label ( gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button6"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); table = create_widget_grid (GTK_TYPE_RADIO_BUTTON); - gtk_container_add (GTK_CONTAINER (box1), table); + gtk_box_append (GTK_BOX (box1), table); } if (!gtk_widget_get_visible (window)) @@ -728,7 +727,7 @@ create_statusbar (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), box1); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); statusbar = gtk_statusbar_new (); g_signal_connect (statusbar, @@ -739,7 +738,7 @@ create_statusbar (GtkWidget *widget) button = g_object_new (gtk_button_get_type (), "label", "push something", NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); g_object_connect (button, "signal::clicked", statusbar_push, statusbar, NULL); @@ -749,41 +748,41 @@ create_statusbar (GtkWidget *widget) NULL), "signal_after::clicked", statusbar_pop, statusbar, NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = g_object_connect (g_object_new (gtk_button_get_type (), "label", "steal #4", NULL), "signal_after::clicked", statusbar_steal, statusbar, NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = g_object_connect (g_object_new (gtk_button_get_type (), "label", "test contexts", NULL), "swapped_signal_after::clicked", statusbar_contexts, statusbar, NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = g_object_connect (g_object_new (gtk_button_get_type (), "label", "push something long", NULL), "signal_after::clicked", statusbar_push_long, statusbar, NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); - gtk_container_add (GTK_CONTAINER (box1), statusbar); + gtk_box_append (GTK_BOX (box1), box2); + gtk_box_append (GTK_BOX (box1), statusbar); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -826,24 +825,16 @@ static void set_selectable_recursive (GtkWidget *widget, gboolean setting) { - if (GTK_IS_CONTAINER (widget)) + if (GTK_IS_LABEL (widget)) + gtk_label_set_selectable (GTK_LABEL (widget), setting); + else { - GList *children; - GList *tmp; - - children = gtk_container_get_children (GTK_CONTAINER (widget)); - tmp = children; - while (tmp) - { - set_selectable_recursive (tmp->data, setting); + GtkWidget *child; - tmp = tmp->next; - } - g_list_free (children); - } - else if (GTK_IS_LABEL (widget)) - { - gtk_label_set_selectable (GTK_LABEL (widget), setting); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + set_selectable_recursive (child, setting); } } @@ -939,42 +930,42 @@ static void create_labels (GtkWidget *widget) button = create_sensitivity_control (hbox); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = create_selectable_control (hbox); - gtk_container_add (GTK_CONTAINER (vbox), button); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), button); + gtk_box_append (GTK_BOX (vbox), hbox); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); frame = gtk_frame_new ("Normal Label"); label = gtk_label_new ("This is a Normal label"); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Multi-line Label"); label = gtk_label_new ("This is a Multi-line label.\nSecond line\nThird line"); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Left Justified Label"); label = gtk_label_new ("This is a Left-Justified\nMulti-line label.\nThird line"); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Right Justified Label"); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START); label = gtk_label_new ("This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)"); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Internationalized Label"); label = gtk_label_new (NULL); @@ -987,13 +978,13 @@ static void create_labels (GtkWidget *widget) "Japanese <span lang=\"ja\">\345\205\203\346\260\227 \351\226\213\347\231\272</span>"); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Bidirection Label"); label = gtk_label_new ("\342\200\217Arabic \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205\n" "\342\200\217Hebrew \327\251\327\234\327\225\327\235"); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Links in a label"); label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\" title=\"plain text\">text</a> may be marked up\n" @@ -1001,11 +992,11 @@ static void create_labels (GtkWidget *widget) "or activated via <a href=\"keynav\">keynav</a>"); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); frame = gtk_frame_new ("Line wrapped label"); label = gtk_label_new ("This is an example of a line-wrapped label. It should not be taking "\ "up the entire "/* big space to test spacing */\ @@ -1017,7 +1008,7 @@ static void create_labels (GtkWidget *widget) gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Filled, wrapped label"); label = gtk_label_new ("This is an example of a line-wrapped, filled label. It should be taking "\ @@ -1030,14 +1021,14 @@ static void create_labels (GtkWidget *widget) gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Underlined label"); label = gtk_label_new ("This label is underlined!\n" "This one is underlined (\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257) in quite a funky fashion"); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); frame = gtk_frame_new ("Markup label"); label = gtk_label_new (NULL); @@ -1064,7 +1055,7 @@ static void create_labels (GtkWidget *widget) g_assert (gtk_label_get_mnemonic_keyval (GTK_LABEL (label)) == GDK_KEY_s); gtk_frame_set_child (GTK_FRAME (frame), label); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); } if (!gtk_widget_get_visible (window)) @@ -1173,7 +1164,7 @@ create_rotated_text (GtkWidget *widget) drawing_area = gtk_drawing_area_new (); gtk_widget_set_hexpand (drawing_area, TRUE); gtk_widget_set_vexpand (drawing_area, TRUE); - gtk_container_add (GTK_CONTAINER (content_area), drawing_area); + gtk_box_append (GTK_BOX (content_area), drawing_area); tile_pixbuf = gdk_pixbuf_new_from_file ("marble.xpm", NULL); @@ -1227,10 +1218,10 @@ create_pixbuf (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), box1); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gdk_surface = gtk_native_get_surface (GTK_NATIVE (window)); @@ -1238,34 +1229,34 @@ create_pixbuf (GtkWidget *widget) label = gtk_label_new ("Pixbuf\ntest"); box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box3), pixbufwid); - gtk_container_add (GTK_CONTAINER (box3), label); + gtk_box_append (GTK_BOX (box3), pixbufwid); + gtk_box_append (GTK_BOX (box3), label); gtk_button_set_child (GTK_BUTTON (button), box3); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); pixbufwid = new_pixbuf ("test.xpm", gdk_surface); label = gtk_label_new ("Pixbuf\ntest"); box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box3), pixbufwid); - gtk_container_add (GTK_CONTAINER (box3), label); + gtk_box_append (GTK_BOX (box3), pixbufwid); + gtk_box_append (GTK_BOX (box3), label); gtk_button_set_child (GTK_BUTTON (button), box3); gtk_widget_set_sensitive (button, FALSE); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -1302,15 +1293,15 @@ create_tooltips (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), box1); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_toggle_button_new_with_label ("button1"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_widget_set_tooltip_text (button, "This is button 1"); button = gtk_toggle_button_new_with_label ("button2"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_widget_set_tooltip_text (button, "This is button 2. This is also a really long tooltip which probably " @@ -1318,7 +1309,7 @@ create_tooltips (GtkWidget *widget) "Hopefully the wrapping will work correctly."); toggle = gtk_toggle_button_new_with_label ("Override TipsQuery Label"); - gtk_container_add (GTK_CONTAINER (box2), toggle); + gtk_box_append (GTK_BOX (box2), toggle); gtk_widget_set_tooltip_text (toggle, "Toggle TipsQuery view."); @@ -1333,27 +1324,27 @@ create_tooltips (GtkWidget *widget) g_object_new (gtk_button_get_type (), "label", "[?]", NULL); - gtk_container_add (GTK_CONTAINER (box3), button); + gtk_box_append (GTK_BOX (box3), button); gtk_widget_set_tooltip_text (button, "Start the Tooltips Inspector"); frame = g_object_new (gtk_frame_get_type (), "label", "ToolTips Inspector", "label_xalign", (double) 0.5, NULL); - gtk_container_add (GTK_CONTAINER (box2), frame); + gtk_box_append (GTK_BOX (box2), frame); gtk_frame_set_child (GTK_FRAME (frame), box3); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); gtk_widget_set_tooltip_text (button, "Push this button to close window"); @@ -1374,10 +1365,10 @@ pack_image (GtkWidget *box, const gchar *text, GtkWidget *image) { - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), gtk_label_new (text)); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), image); } @@ -1531,17 +1522,17 @@ create_listbox (GtkWidget *widget) 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 (hbox), scrolled); + gtk_box_append (GTK_BOX (hbox), scrolled); scrolled_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); 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); + gtk_box_append (GTK_BOX (scrolled_box), label); list = gtk_list_box_new(); gtk_list_box_set_adjustment (GTK_LIST_BOX (list), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled))); - gtk_container_add (GTK_CONTAINER (scrolled_box), list); + gtk_box_append (GTK_BOX (scrolled_box), list); for (i = 0; i < 1000; i++) { @@ -1552,30 +1543,30 @@ create_listbox (GtkWidget *widget) } vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); button = gtk_button_new_with_label ("sort"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (list_sort_clicked_cb), list); button = gtk_button_new_with_label ("filter odd"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (list_filter_odd_clicked_cb), list); button = gtk_button_new_with_label ("filter all"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (list_filter_all_clicked_cb), list); button = gtk_button_new_with_label ("unfilter"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (list_unfilter_clicked_cb), list); button = gtk_button_new_with_label ("add placeholder"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (add_placeholder_clicked_cb), list); button = gtk_button_new_with_label ("remove placeholder"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (remove_placeholder_clicked_cb), list); } @@ -1645,34 +1636,34 @@ create_key_lookup (GtkWidget *widget) box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_hexpand (box, TRUE); gtk_widget_set_vexpand (box, TRUE); - gtk_container_add (GTK_CONTAINER (content_area), box); + gtk_box_append (GTK_BOX (content_area), box); button = gtk_button_new_with_mnemonic ("Button 1 (_a)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 2 (_A)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 3 (_\321\204)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 4 (_\320\244)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 6 (_b)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 7", "<Alt><Shift>b"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 8", "<Alt>d"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 9", "<Alt>Cyrillic_ve"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 10 (_1)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_mnemonic ("Button 11 (_!)"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 12", "<Super>a"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 13", "<Hyper>a"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 14", "<Meta>a"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_signal_connect (window, "response", G_CALLBACK (gtk_window_destroy), NULL); @@ -1773,12 +1764,12 @@ create_modal_window (GtkWidget *widget) /* Pack widgets */ gtk_window_set_child (GTK_WINDOW (window), box1); - gtk_container_add (GTK_CONTAINER (box1), frame1); + gtk_box_append (GTK_BOX (box1), frame1); gtk_frame_set_child (GTK_FRAME (frame1), box2); - gtk_container_add (GTK_CONTAINER (box2), btnColor); - gtk_container_add (GTK_CONTAINER (box2), btnFile); - gtk_container_add (GTK_CONTAINER (box1), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (box1), btnClose); + gtk_box_append (GTK_BOX (box2), btnColor); + gtk_box_append (GTK_BOX (box2), btnFile); + gtk_box_append (GTK_BOX (box1), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (box1), btnClose); /* connect signals */ g_signal_connect_swapped (btnClose, "clicked", @@ -1863,7 +1854,7 @@ scrolled_windows_delete_cb (GtkWidget *widget, GtkWidget *scrollwin) { g_object_ref (scrollwin); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_parent), scrollwin); g_object_unref (scrollwin); @@ -1897,8 +1888,8 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin) if (sw_parent) { g_object_ref (scrollwin); - gtk_window_set_child (GTK_WINDOW (gtk_widget_get_parent (scrollwin)), NULL); - gtk_container_add (GTK_CONTAINER (sw_parent), scrollwin); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin); + gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin); g_object_unref (scrollwin); @@ -1919,7 +1910,7 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin) gtk_window_set_default_size (GTK_WINDOW (sw_float_parent), 200, 200); g_object_ref (scrollwin); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin); gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin); g_object_unref (scrollwin); @@ -1963,7 +1954,7 @@ create_scrolled_windows (GtkWidget *widget) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (content_area), scrolled_window); + gtk_box_append (GTK_BOX (content_area), scrolled_window); grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 10); @@ -2112,16 +2103,16 @@ create_entry (GtkWidget *widget) gtk_widget_set_margin_bottom (box2, 10); gtk_widget_set_margin_start (box2, 10); gtk_widget_set_margin_end (box2, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (box2), hbox); + gtk_box_append (GTK_BOX (box2), hbox); entry = gtk_entry_new (); gtk_editable_set_text (GTK_EDITABLE (entry), "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205"); gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5); gtk_widget_set_hexpand (entry, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); cb = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ()); @@ -2140,45 +2131,45 @@ create_entry (GtkWidget *widget) cb_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (cb)); gtk_editable_set_text (GTK_EDITABLE (cb_entry), "hello world \n\n\n foo"); gtk_editable_select_region (GTK_EDITABLE (cb_entry), 0, -1); - gtk_container_add (GTK_CONTAINER (box2), GTK_WIDGET (cb)); + gtk_box_append (GTK_BOX (box2), GTK_WIDGET (cb)); sensitive_check = gtk_check_button_new_with_label ("Sensitive"); - gtk_container_add (GTK_CONTAINER (box2), sensitive_check); + gtk_box_append (GTK_BOX (box2), sensitive_check); g_signal_connect (sensitive_check, "toggled", G_CALLBACK (entry_toggle_sensitive), entry); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sensitive_check), TRUE); has_frame_check = gtk_check_button_new_with_label("Has Frame"); - gtk_container_add (GTK_CONTAINER (box2), has_frame_check); + gtk_box_append (GTK_BOX (box2), has_frame_check); g_signal_connect (has_frame_check, "toggled", G_CALLBACK (entry_toggle_frame), entry); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (has_frame_check), TRUE); progress_check = gtk_check_button_new_with_label("Show Progress"); - gtk_container_add (GTK_CONTAINER (box2), progress_check); + gtk_box_append (GTK_BOX (box2), progress_check); g_signal_connect (progress_check, "toggled", G_CALLBACK (entry_toggle_progress), entry); progress_check = gtk_check_button_new_with_label("Pulse Progress"); - gtk_container_add (GTK_CONTAINER (box2), progress_check); + gtk_box_append (GTK_BOX (box2), progress_check); g_signal_connect (progress_check, "toggled", G_CALLBACK (entry_toggle_pulse), entry); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); gtk_widget_set_margin_top (box2, 10); gtk_widget_set_margin_bottom (box2, 10); gtk_widget_set_margin_start (box2, 10); gtk_widget_set_margin_end (box2, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -2210,7 +2201,7 @@ create_expander (GtkWidget *widget) expander = gtk_expander_new ("The Hidden"); - gtk_container_add (GTK_CONTAINER (box1), expander); + gtk_box_append (GTK_BOX (box1), expander); hidden = gtk_label_new ("Revealed!"); @@ -2282,10 +2273,10 @@ create_size_group_window (GdkDisplay *display, content_area = gtk_dialog_get_content_area (GTK_DIALOG (window)); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (content_area), vbox); + gtk_box_append (GTK_BOX (content_area), vbox); grid = gtk_grid_new (); - gtk_container_add (GTK_CONTAINER (vbox), grid); + gtk_box_append (GTK_BOX (content_area), grid); gtk_grid_set_row_spacing (GTK_GRID (grid), 5); gtk_grid_set_column_spacing (GTK_GRID (grid), 5); @@ -2346,19 +2337,19 @@ create_size_group_window (GdkDisplay *display, g_object_unref (vgroup2); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (content_area), hbox); spin_button = gtk_spin_button_new_with_range (1, 100, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE); gtk_widget_set_hexpand (spin_button, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), spin_button); + gtk_box_append (GTK_BOX (hbox), spin_button); g_signal_connect (spin_button, "value_changed", G_CALLBACK (size_group_hsize_changed), main_button); spin_button = gtk_spin_button_new_with_range (1, 100, 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE); gtk_widget_set_hexpand (spin_button, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), spin_button); + gtk_box_append (GTK_BOX (hbox), spin_button); g_signal_connect (spin_button, "value_changed", G_CALLBACK (size_group_vsize_changed), main_button); @@ -2601,7 +2592,7 @@ create_spins (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), main_vbox); frame = gtk_frame_new ("Not accelerated"); - gtk_container_add (GTK_CONTAINER (main_vbox), frame); + gtk_box_append (GTK_BOX (main_vbox), frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (frame), vbox); @@ -2609,16 +2600,16 @@ create_spins (GtkWidget *widget) /* Time, month, hex spinners */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_hexpand (vbox2, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); label = gtk_label_new ("Time :"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), label); + gtk_box_append (GTK_BOX (vbox2), label); adjustment = gtk_adjustment_new (0, 0, 1410, 30, 60, 0); spinner = gtk_spin_button_new (adjustment, 0, 0); @@ -2629,16 +2620,16 @@ create_spins (GtkWidget *widget) NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 5); - gtk_container_add (GTK_CONTAINER (vbox2), spinner); + gtk_box_append (GTK_BOX (vbox2), spinner); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_hexpand (vbox2, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); label = gtk_label_new ("Month :"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), label); + gtk_box_append (GTK_BOX (vbox2), label); adjustment = gtk_adjustment_new (1.0, 1.0, 12.0, 1.0, 5.0, 0.0); @@ -2655,16 +2646,16 @@ create_spins (GtkWidget *widget) NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 9); - gtk_container_add (GTK_CONTAINER (vbox2), spinner); + gtk_box_append (GTK_BOX (vbox2), spinner); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_hexpand (vbox2, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); label = gtk_label_new ("Hex :"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), label); + gtk_box_append (GTK_BOX (vbox2), label); adjustment = gtk_adjustment_new (0, 0, 255, 1, 16, 0); spinner = gtk_spin_button_new (adjustment, 0, 0); @@ -2679,67 +2670,67 @@ create_spins (GtkWidget *widget) NULL); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE); gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 4); - gtk_container_add (GTK_CONTAINER (vbox2), spinner); + gtk_box_append (GTK_BOX (vbox2), spinner); frame = gtk_frame_new ("Accelerated"); - gtk_container_add (GTK_CONTAINER (main_vbox), frame); + gtk_box_append (GTK_BOX (main_vbox), frame); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_frame_set_child (GTK_FRAME (frame), vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); label = gtk_label_new ("Value :"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), label); + gtk_box_append (GTK_BOX (vbox2), label); adjustment = gtk_adjustment_new (0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0); spinner1 = gtk_spin_button_new (adjustment, 1.0, 2); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE); - gtk_container_add (GTK_CONTAINER (vbox2), spinner1); + gtk_box_append (GTK_BOX (vbox2), spinner1); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); label = gtk_label_new ("Digits :"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), label); + gtk_box_append (GTK_BOX (vbox2), label); adjustment = gtk_adjustment_new (2, 1, 15, 1, 1, 0); spinner2 = gtk_spin_button_new (adjustment, 0.0, 0); g_signal_connect (adjustment, "value_changed", G_CALLBACK (change_digits), spinner2); - gtk_container_add (GTK_CONTAINER (vbox2), spinner2); + gtk_box_append (GTK_BOX (vbox2), spinner2); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_check_button_new_with_label ("Snap to 0.5-ticks"); g_signal_connect (button, "clicked", G_CALLBACK (toggle_snap), spinner1); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); button = gtk_check_button_new_with_label ("Numeric only input mode"); g_signal_connect (button, "clicked", G_CALLBACK (toggle_numeric), spinner1); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); val_label = gtk_label_new (""); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_button_new_with_label ("Value as Int"); gtk_widget_set_hexpand (button, TRUE); @@ -2747,7 +2738,7 @@ create_spins (GtkWidget *widget) g_signal_connect (button, "clicked", G_CALLBACK (get_value), GINT_TO_POINTER (1)); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Value as Float"); gtk_widget_set_hexpand (button, TRUE); @@ -2755,13 +2746,13 @@ create_spins (GtkWidget *widget) g_signal_connect (button, "clicked", G_CALLBACK (get_value), GINT_TO_POINTER (2)); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); - gtk_container_add (GTK_CONTAINER (vbox), val_label); + gtk_box_append (GTK_BOX (vbox), val_label); gtk_label_set_text (GTK_LABEL (val_label), "0"); frame = gtk_frame_new ("Using Convenience Constructor"); - gtk_container_add (GTK_CONTAINER (main_vbox), frame); + gtk_box_append (GTK_BOX (main_vbox), frame); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_frame_set_child (GTK_FRAME (frame), hbox); @@ -2774,18 +2765,18 @@ create_spins (GtkWidget *widget) gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), 0.0); g_signal_connect (spinner, "value_changed", G_CALLBACK (get_spin_value), val_label); - gtk_container_add (GTK_CONTAINER (hbox), spinner); - gtk_container_add (GTK_CONTAINER (hbox), val_label); + gtk_box_append (GTK_BOX (hbox), spinner); + gtk_box_append (GTK_BOX (hbox), val_label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (main_vbox), hbox); + gtk_box_append (GTK_BOX (main_vbox), hbox); button = gtk_button_new_with_label ("Close"); gtk_widget_set_hexpand (button, TRUE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); } if (!gtk_widget_get_visible (window)) @@ -2988,20 +2979,20 @@ set_cursor_from_name (GtkWidget *entry, static void change_cursor_theme (GtkWidget *widget, - gpointer data) + gpointer data) { #if defined(GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WAYLAND) const gchar *theme; gint size; - GList *children; GdkDisplay *display; + GtkWidget *entry; + GtkWidget *spin; - children = gtk_container_get_children (GTK_CONTAINER (data)); - - theme = gtk_editable_get_text (GTK_EDITABLE (children->next->data)); - size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data)); + entry = gtk_widget_get_next_sibling (gtk_widget_get_first_child (GTK_WIDGET (data))); + spin = gtk_widget_get_next_sibling (entry); - g_list_free (children); + theme = gtk_editable_get_text (GTK_EDITABLE (entry)); + size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin)); display = gtk_widget_get_display (widget); #ifdef GDK_WINDOWING_X11 @@ -3052,7 +3043,7 @@ create_cursors (GtkWidget *widget) "homogeneous", FALSE, "spacing", 5, NULL); - gtk_container_add (GTK_CONTAINER (main_vbox), vbox); + gtk_box_append (GTK_BOX (main_vbox), vbox); #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (vbox))) @@ -3070,21 +3061,21 @@ create_cursors (GtkWidget *widget) gtk_widget_set_margin_bottom (hbox, 5); gtk_widget_set_margin_start (hbox, 5); gtk_widget_set_margin_end (hbox, 5); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Cursor Theme:"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); entry = gtk_entry_new (); gtk_editable_set_text (GTK_EDITABLE (entry), "default"); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); size = gtk_spin_button_new_with_range (1.0, 128.0, 1.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0); gtk_widget_set_hexpand (size, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), size); + gtk_box_append (GTK_BOX (hbox), size); g_signal_connect (entry, "changed", G_CALLBACK (change_cursor_theme), hbox); @@ -3097,12 +3088,12 @@ create_cursors (GtkWidget *widget) gtk_widget_set_margin_bottom (hbox, 5); gtk_widget_set_margin_start (hbox, 5); gtk_widget_set_margin_end (hbox, 5); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Cursor Name:"); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); entry = gtk_entry_new (); completion = gtk_entry_completion_new (); @@ -3112,14 +3103,14 @@ create_cursors (GtkWidget *widget) gtk_entry_set_completion (GTK_ENTRY (entry), completion); g_object_unref (model); gtk_widget_set_hexpand (entry, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); frame = g_object_new (gtk_frame_get_type (), "label_xalign", 0.5, "label", "Cursor Area", NULL); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); darea = gtk_drawing_area_new (); gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (darea), 80); @@ -3136,21 +3127,21 @@ create_cursors (GtkWidget *widget) any = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (main_vbox), any); + gtk_box_append (GTK_BOX (main_vbox), any); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_margin_top (hbox, 10); gtk_widget_set_margin_bottom (hbox, 10); gtk_widget_set_margin_start (hbox, 10); gtk_widget_set_margin_end (hbox, 10); - gtk_container_add (GTK_CONTAINER (main_vbox), hbox); + gtk_box_append (GTK_BOX (main_vbox), hbox); button = gtk_button_new_with_label ("Close"); gtk_widget_set_hexpand (button, TRUE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_widget_show (window); @@ -3190,11 +3181,11 @@ create_color_selection (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), hbox); label = gtk_label_new ("Pick a color"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); picker = gtk_color_button_new (); gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (picker), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), picker); + gtk_box_append (GTK_BOX (hbox), picker); } if (!gtk_widget_get_visible (window)) @@ -3216,6 +3207,7 @@ static void orientable_toggle_orientation (GtkOrientable *orientable) { GtkOrientation orientation; + GtkWidget *child; orientation = gtk_orientable_get_orientation (orientable); gtk_orientable_set_orientation (orientable, @@ -3223,20 +3215,13 @@ orientable_toggle_orientation (GtkOrientable *orientable) GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL); - if (GTK_IS_CONTAINER (orientable)) - { - GList *children; - GList *child; - - children = gtk_container_get_children (GTK_CONTAINER (orientable)); - - for (child = children; child; child = child->next) - { - if (GTK_IS_ORIENTABLE (child->data)) - orientable_toggle_orientation (child->data); - } - g_list_free (children); + for (child = gtk_widget_get_first_child (GTK_WIDGET (orientable)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + { + if (GTK_IS_ORIENTABLE (child)) + orientable_toggle_orientation (GTK_ORIENTABLE (child)); } } @@ -3253,15 +3238,16 @@ flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data) static void set_direction_recurse (GtkWidget *widget, - gpointer data) + gpointer data) { GtkTextDirection *dir = data; - + GtkWidget *child; + gtk_widget_set_direction (widget, *dir); - if (GTK_IS_CONTAINER (widget)) - gtk_container_foreach (GTK_CONTAINER (widget), - set_direction_recurse, - data); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + set_direction_recurse (child, data); } static GtkWidget * @@ -3274,8 +3260,8 @@ create_forward_back (const char *title, GtkWidget *forward_button = gtk_button_new_with_label ("Forward"); gtk_frame_set_child (GTK_FRAME (frame), bbox); - gtk_container_add (GTK_CONTAINER (bbox), back_button); - gtk_container_add (GTK_CONTAINER (bbox), forward_button); + gtk_box_append (GTK_BOX (bbox), back_button); + gtk_box_append (GTK_BOX (bbox), forward_button); set_direction_recurse (frame, &text_dir); @@ -3302,7 +3288,7 @@ create_flipping (GtkWidget *widget) gtk_window_set_title (GTK_WINDOW (window), "Bidirectional Flipping"); check_button = gtk_check_button_new_with_label ("Right-to-left global direction"); - gtk_container_add (GTK_CONTAINER (content_area), check_button); + gtk_box_append (GTK_BOX (content_area), check_button); if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); @@ -3311,18 +3297,18 @@ create_flipping (GtkWidget *widget) G_CALLBACK (flipping_toggled_cb), NULL); check_button = gtk_check_button_new_with_label ("Toggle orientation of all boxes"); - gtk_container_add (GTK_CONTAINER (content_area), check_button); + gtk_box_append (GTK_BOX (content_area), check_button); g_signal_connect (check_button, "toggled", G_CALLBACK (flipping_orientation_toggled_cb), NULL); - gtk_container_add (GTK_CONTAINER (content_area), + gtk_box_append (GTK_BOX (content_area), create_forward_back ("Default", GTK_TEXT_DIR_NONE)); - gtk_container_add (GTK_CONTAINER (content_area), + gtk_box_append (GTK_BOX (content_area), create_forward_back ("Left-to-Right", GTK_TEXT_DIR_LTR)); - gtk_container_add (GTK_CONTAINER (content_area), + gtk_box_append (GTK_BOX (content_area), create_forward_back ("Right-to-Left", GTK_TEXT_DIR_RTL)); gtk_dialog_add_button (GTK_DIALOG (window), "Close", GTK_RESPONSE_CLOSE); @@ -3365,11 +3351,11 @@ create_font_selection (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), hbox); label = gtk_label_new ("Pick a font"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); picker = gtk_font_button_new (); gtk_font_button_set_use_font (GTK_FONT_BUTTON (picker), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), picker); + gtk_box_append (GTK_BOX (hbox), picker); } if (!gtk_widget_get_visible (window)) @@ -3388,24 +3374,25 @@ static void dialog_response_cb (GtkWidget *widget, gint response, gpointer unused) { GtkWidget *content_area; - GList *l, *children; + GtkWidget *child; if (response == GTK_RESPONSE_APPLY) { content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog_window)); - children = gtk_container_get_children (GTK_CONTAINER (content_area)); - for (l = children; l; l = l->next) + for (child = gtk_widget_get_first_child (content_area); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - if (GTK_IS_LABEL (l->data)) + if (GTK_IS_LABEL (child)) { - gtk_container_remove (GTK_CONTAINER (content_area), l->data); + gtk_box_remove (GTK_BOX (content_area), child); break; } } /* no label removed, so add one */ - if (l == NULL) + if (child == NULL) { GtkWidget *label; @@ -3414,11 +3401,8 @@ dialog_response_cb (GtkWidget *widget, gint response, gpointer unused) gtk_widget_set_margin_end (label, 10); gtk_widget_set_margin_top (label, 10); gtk_widget_set_margin_bottom (label, 10); - gtk_container_add (GTK_CONTAINER (content_area), - label); + gtk_box_append (GTK_BOX (content_area), label); } - - g_list_free (children); } } @@ -3546,7 +3530,7 @@ create_display_screen (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), vbox); frame = gtk_frame_new ("Select display"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 3); @@ -3569,10 +3553,10 @@ create_display_screen (GtkWidget *widget) applyb = gtk_button_new_with_mnemonic ("_Apply"); cancelb = gtk_button_new_with_mnemonic ("_Cancel"); - gtk_container_add (GTK_CONTAINER (vbox), bbox); + gtk_box_append (GTK_BOX (vbox), bbox); - gtk_container_add (GTK_CONTAINER (bbox), applyb); - gtk_container_add (GTK_CONTAINER (bbox), cancelb); + gtk_box_append (GTK_BOX (bbox), applyb); + gtk_box_append (GTK_BOX (bbox), cancelb); scr_dpy_data = g_new0 (ScreenDisplaySelection, 1); @@ -3628,7 +3612,7 @@ create_range_controls (GtkWidget *widget) box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); adjustment = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0); @@ -3637,17 +3621,17 @@ create_range_controls (GtkWidget *widget) gtk_widget_set_size_request (GTK_WIDGET (scale), 150, -1); gtk_scale_set_digits (GTK_SCALE (scale), 1); gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); - gtk_container_add (GTK_CONTAINER (box2), scale); + gtk_box_append (GTK_BOX (box2), scale); scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment)); - gtk_container_add (GTK_CONTAINER (box2), scrollbar); + gtk_box_append (GTK_BOX (box2), scrollbar); scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment)); gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); gtk_scale_set_format_value_func (GTK_SCALE (scale), (GtkScaleFormatValueFunc) reformat_value, NULL, NULL); - gtk_container_add (GTK_CONTAINER (box2), scale); + gtk_box_append (GTK_BOX (box2), scale); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); @@ -3655,38 +3639,38 @@ create_range_controls (GtkWidget *widget) gtk_widget_set_size_request (scale, -1, 200); gtk_scale_set_digits (GTK_SCALE (scale), 2); gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), scale); + gtk_box_append (GTK_BOX (hbox), scale); scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment)); gtk_widget_set_size_request (scale, -1, 200); gtk_scale_set_digits (GTK_SCALE (scale), 2); gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); gtk_range_set_inverted (GTK_RANGE (scale), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), scale); + gtk_box_append (GTK_BOX (hbox), scale); scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment)); gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); gtk_scale_set_format_value_func (GTK_SCALE (scale), (GtkScaleFormatValueFunc) reformat_value, NULL, NULL); - gtk_container_add (GTK_CONTAINER (hbox), scale); + gtk_box_append (GTK_BOX (hbox), scale); - gtk_container_add (GTK_CONTAINER (box2), hbox); + gtk_box_append (GTK_BOX (box2), hbox); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -3824,16 +3808,16 @@ create_pages (GtkNotebook *notebook, gint start, gint end) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_check_button_new_with_label ("Fill Tab"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_signal_connect (button, "toggled", G_CALLBACK (tab_fill), child); button = gtk_check_button_new_with_label ("Expand Tab"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "toggled", G_CALLBACK (tab_expand), child); @@ -3846,26 +3830,26 @@ create_pages (GtkNotebook *notebook, gint start, gint end) pixwid = gtk_image_new_from_pixbuf (book_closed); g_object_set_data (G_OBJECT (child), "tab_pixmap", pixwid); - gtk_container_add (GTK_CONTAINER (label_box), pixwid); + gtk_box_append (GTK_BOX (label_box), pixwid); gtk_widget_set_margin_start (pixwid, 3); gtk_widget_set_margin_end (pixwid, 3); gtk_widget_set_margin_bottom (pixwid, 1); gtk_widget_set_margin_top (pixwid, 1); label = gtk_label_new_with_mnemonic (accel_buffer); - gtk_container_add (GTK_CONTAINER (label_box), label); + gtk_box_append (GTK_BOX (label_box), label); menu_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); pixwid = gtk_image_new_from_pixbuf (book_closed); g_object_set_data (G_OBJECT (child), "menu_pixmap", pixwid); - gtk_container_add (GTK_CONTAINER (menu_box), pixwid); + gtk_box_append (GTK_BOX (menu_box), pixwid); gtk_widget_set_margin_start (pixwid, 3); gtk_widget_set_margin_end (pixwid, 3); gtk_widget_set_margin_bottom (pixwid, 1); gtk_widget_set_margin_top (pixwid, 1); label = gtk_label_new (buffer); - gtk_container_add (GTK_CONTAINER (menu_box), label); + gtk_box_append (GTK_BOX (menu_box), label); gtk_notebook_append_page_menu (notebook, child, label_box, menu_box); } @@ -3992,7 +3976,7 @@ create_notebook (GtkWidget *widget) G_CALLBACK (page_switch), NULL); gtk_notebook_set_tab_pos (GTK_NOTEBOOK (sample_notebook), GTK_POS_TOP); gtk_widget_set_vexpand (sample_notebook, TRUE); - gtk_container_add (GTK_CONTAINER (box1), sample_notebook); + gtk_box_append (GTK_BOX (box1), sample_notebook); gtk_widget_realize (sample_notebook); @@ -4005,62 +3989,62 @@ create_notebook (GtkWidget *widget) create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_check_button_new_with_label ("popup menu"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); g_signal_connect (button, "clicked", G_CALLBACK (notebook_popup), sample_notebook); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); label = gtk_label_new ("Notebook Style :"); - gtk_container_add (GTK_CONTAINER (box2), label); + gtk_box_append (GTK_BOX (box2), label); omenu = build_option_menu (items, G_N_ELEMENTS (items), 0, notebook_type_changed, sample_notebook); - gtk_container_add (GTK_CONTAINER (box2), omenu); + gtk_box_append (GTK_BOX (box2), omenu); button = gtk_button_new_with_label ("Show all Pages"); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); g_signal_connect (button, "clicked", G_CALLBACK (show_all_pages), sample_notebook); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_set_homogeneous (GTK_BOX (box2), TRUE); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("prev"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_notebook_prev_page), sample_notebook); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_button_new_with_label ("next"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_notebook_next_page), sample_notebook); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_button_new_with_label ("rotate"); g_signal_connect (button, "clicked", G_CALLBACK (rotate_notebook), sample_notebook); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box1), button); + gtk_box_append (GTK_BOX (box1), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -4179,7 +4163,7 @@ create_panes (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), vbox); vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (vbox), vpaned); + gtk_box_append (GTK_BOX (vbox), vpaned); hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned); @@ -4201,13 +4185,13 @@ create_panes (GtkWidget *widget) /* Now create toggle buttons to control sizing */ - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), create_pane_options (GTK_PANED (hpaned), "Horizontal", "Left", "Right")); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), create_pane_options (GTK_PANED (vpaned), "Vertical", "Top", @@ -4265,13 +4249,13 @@ paned_keyboard_window1 (GtkWidget *widget) gtk_frame_set_child (GTK_FRAME (frame1), vbox1); button7 = gtk_button_new_with_label ("button7"); - gtk_container_add (GTK_CONTAINER (vbox1), button7); + gtk_box_append (GTK_BOX (vbox1), button7); button8 = gtk_button_new_with_label ("button8"); - gtk_container_add (GTK_CONTAINER (vbox1), button8); + gtk_box_append (GTK_BOX (vbox1), button8); button9 = gtk_button_new_with_label ("button9"); - gtk_container_add (GTK_CONTAINER (vbox1), button9); + gtk_box_append (GTK_BOX (vbox1), button9); vpaned1 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); gtk_paned_set_end_child (GTK_PANED (hpaned1), vpaned1); @@ -4290,10 +4274,10 @@ paned_keyboard_window1 (GtkWidget *widget) gtk_frame_set_child (GTK_FRAME (frame5), hbox1); button5 = gtk_button_new_with_label ("button5"); - gtk_container_add (GTK_CONTAINER (hbox1), button5); + gtk_box_append (GTK_BOX (hbox1), button5); button6 = gtk_button_new_with_label ("button6"); - gtk_container_add (GTK_CONTAINER (hbox1), button6); + gtk_box_append (GTK_BOX (hbox1), button6); frame3 = gtk_frame_new (NULL); gtk_paned_set_end_child (GTK_PANED (vpaned1), frame3); @@ -4359,7 +4343,7 @@ paned_keyboard_window2 (GtkWidget *widget) gtk_paned_set_shrink_end_child (GTK_PANED (hpaned2), TRUE); vpaned2 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (hbox2), vpaned2); + gtk_box_append (GTK_BOX (hbox2), vpaned2); frame7 = gtk_frame_new (NULL); gtk_paned_set_start_child (GTK_PANED (vpaned2), frame7); @@ -4378,7 +4362,7 @@ paned_keyboard_window2 (GtkWidget *widget) gtk_frame_set_child (GTK_FRAME (frame8), button11); button10 = gtk_button_new_with_label ("button10"); - gtk_container_add (GTK_CONTAINER (hbox2), button10); + gtk_box_append (GTK_BOX (hbox2), button10); return window2; } @@ -4413,10 +4397,10 @@ paned_keyboard_window3 (GtkWidget *widget) 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); + gtk_box_append (GTK_BOX (vbox2), label1); hpaned3 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (vbox2), hpaned3); + gtk_box_append (GTK_BOX (vbox2), hpaned3); frame9 = gtk_frame_new (NULL); gtk_paned_set_start_child (GTK_PANED (hpaned3), frame9); @@ -4495,11 +4479,11 @@ paned_keyboard_window4 (GtkWidget *widget) 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); + gtk_box_append (GTK_BOX (vbox3), label2); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); hpaned6 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (vbox3), hpaned6); + gtk_box_append (GTK_BOX (vbox3), hpaned6); vpaned3 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); gtk_paned_set_start_child (GTK_PANED (hpaned6), vpaned3); @@ -4522,7 +4506,7 @@ paned_keyboard_window4 (GtkWidget *widget) gtk_paned_set_shrink_end_child (GTK_PANED (hpaned6), TRUE); vpaned4 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (hbox3), vpaned4); + gtk_box_append (GTK_BOX (hbox3), vpaned4); button21 = gtk_button_new_with_label ("button21"); gtk_paned_set_start_child (GTK_PANED (vpaned4), button21); @@ -4535,7 +4519,7 @@ paned_keyboard_window4 (GtkWidget *widget) gtk_paned_set_shrink_end_child (GTK_PANED (vpaned4), TRUE); vpaned5 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (hbox3), vpaned5); + gtk_box_append (GTK_BOX (hbox3), vpaned5); button23 = gtk_button_new_with_label ("button23"); gtk_paned_set_start_child (GTK_PANED (vpaned5), button23); @@ -4548,7 +4532,7 @@ paned_keyboard_window4 (GtkWidget *widget) gtk_paned_set_shrink_end_child (GTK_PANED (vpaned5), TRUE); vpaned6 = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_container_add (GTK_CONTAINER (hbox3), vpaned6); + gtk_box_append (GTK_BOX (hbox3), vpaned6); button25 = gtk_button_new_with_label ("button25"); gtk_paned_set_start_child (GTK_PANED (vpaned6), button25); @@ -4668,15 +4652,15 @@ create_wmhints (GtkWidget *widget) label = gtk_label_new ("Try iconizing me!"); gtk_widget_set_size_request (label, 150, 50); - gtk_container_add (GTK_CONTAINER (box1), label); + gtk_box_append (GTK_BOX (box1), label); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("close"); @@ -4685,7 +4669,7 @@ create_wmhints (GtkWidget *widget) G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); } @@ -4747,7 +4731,7 @@ tracking_label (GtkWidget *window) label = gtk_label_new ("<no window state events received>"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); g_object_set_data (G_OBJECT (label), "title", (gpointer)gtk_window_get_title (GTK_WINDOW (window))); g_signal_connect_object (gtk_native_get_surface (GTK_NATIVE (window)), "notify::state", @@ -4761,7 +4745,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_window_unminimize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Minimize"); g_signal_connect_object (button, @@ -4769,7 +4753,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_window_minimize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Fullscreen"); g_signal_connect_object (button, @@ -4777,7 +4761,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_window_fullscreen), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Unfullscreen"); g_signal_connect_object (button, @@ -4785,7 +4769,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_window_unfullscreen), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Present"); g_signal_connect_object (button, @@ -4793,7 +4777,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_window_present), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Show"); g_signal_connect_object (button, @@ -4801,7 +4785,7 @@ tracking_label (GtkWidget *window) G_CALLBACK (gtk_widget_show), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); return hbox; } @@ -4820,7 +4804,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_window_maximize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Unmaximize"); g_signal_connect_object (button, @@ -4828,7 +4812,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_window_unmaximize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Minimize"); g_signal_connect_object (button, @@ -4836,7 +4820,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_window_minimize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Fullscreen"); g_signal_connect_object (button, @@ -4844,7 +4828,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_window_fullscreen), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Unfullscreen"); g_signal_connect_object (button, @@ -4852,7 +4836,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_window_unfullscreen), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Hide (withdraw)"); g_signal_connect_object (button, @@ -4860,7 +4844,7 @@ get_state_controls (GtkWidget *window) G_CALLBACK (gtk_widget_hide), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); return vbox; } @@ -4919,10 +4903,10 @@ create_surface_states (GtkWidget *widget) gtk_widget_realize (normal); label = tracking_label (iconified); - gtk_container_add (GTK_CONTAINER (box1), label); + gtk_box_append (GTK_BOX (box1), label); label = tracking_label (normal); - gtk_container_add (GTK_CONTAINER (box1), label); + gtk_box_append (GTK_BOX (box1), label); gtk_widget_show (iconified); gtk_widget_show (normal); @@ -5045,19 +5029,19 @@ window_controls (GtkWidget *window) gtk_window_set_child (GTK_WINDOW (control_window), vbox); label = gtk_label_new ("<no size>"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0); spin = gtk_spin_button_new (adjustment, 0, 0); - gtk_container_add (GTK_CONTAINER (vbox), spin); + gtk_box_append (GTK_BOX (vbox), spin); g_object_set_data (G_OBJECT (control_window), "spin1", spin); adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0); spin = gtk_spin_button_new (adjustment, 0, 0); - gtk_container_add (GTK_CONTAINER (vbox), spin); + gtk_box_append (GTK_BOX (vbox), spin); g_object_set_data (G_OBJECT (control_window), "spin2", spin); @@ -5067,42 +5051,42 @@ window_controls (GtkWidget *window) G_CALLBACK (gtk_widget_queue_resize), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Resize"); g_signal_connect (button, "clicked", G_CALLBACK (set_size_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Set default size"); g_signal_connect (button, "clicked", G_CALLBACK (set_default_size_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Unset default size"); g_signal_connect (button, "clicked", G_CALLBACK (unset_default_size_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Set size request"); g_signal_connect (button, "clicked", G_CALLBACK (set_size_request_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label ("Unset size request"); g_signal_connect (button, "clicked", G_CALLBACK (unset_size_request_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_check_button_new_with_label ("Allow resize"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); @@ -5110,7 +5094,7 @@ window_controls (GtkWidget *window) "toggled", G_CALLBACK (resizable_callback), control_window); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_mnemonic ("_Show"); g_signal_connect_object (button, @@ -5118,7 +5102,7 @@ window_controls (GtkWidget *window) G_CALLBACK (gtk_widget_show), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_mnemonic ("_Hide"); g_signal_connect_object (button, @@ -5126,7 +5110,7 @@ window_controls (GtkWidget *window) G_CALLBACK (gtk_widget_hide), window, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); return control_window; } @@ -5357,10 +5341,10 @@ create_progress_bar (GtkWidget *widget) gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar"); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); - gtk_container_add (GTK_CONTAINER (content_area), vbox); + gtk_box_append (GTK_BOX (content_area), vbox); frame = gtk_frame_new ("Progress"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_frame_set_child (GTK_FRAME (frame), vbox2); @@ -5370,19 +5354,19 @@ create_progress_bar (GtkWidget *widget) PANGO_ELLIPSIZE_MIDDLE); gtk_widget_set_halign (pdata->pbar, GTK_ALIGN_CENTER); gtk_widget_set_valign (pdata->pbar, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), pdata->pbar); + gtk_box_append (GTK_BOX (vbox2), pdata->pbar); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER); gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), hbox); + gtk_box_append (GTK_BOX (vbox2), hbox); label = gtk_label_new ("Label updated by user :"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); pdata->label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), pdata->label); + gtk_box_append (GTK_BOX (hbox), pdata->label); frame = gtk_frame_new ("Options"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_frame_set_child (GTK_FRAME (frame), vbox2); @@ -5390,7 +5374,7 @@ create_progress_bar (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 (vbox2), grid); + gtk_box_append (GTK_BOX (vbox2), grid); label = gtk_label_new ("Orientation :"); gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); @@ -5419,14 +5403,14 @@ create_progress_bar (GtkWidget *widget) gtk_grid_attach (GTK_GRID (grid), hbox, 1, 2, 1, 1); label = gtk_label_new ("Text: "); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); pdata->entry = gtk_entry_new (); gtk_widget_set_hexpand (pdata->entry, TRUE); g_signal_connect (pdata->entry, "changed", G_CALLBACK (entry_changed), pdata); - gtk_container_add (GTK_CONTAINER (hbox), pdata->entry); + gtk_box_append (GTK_BOX (hbox), pdata->entry); gtk_widget_set_size_request (pdata->entry, 100, -1); label = gtk_label_new ("Ellipsize text :"); @@ -5535,26 +5519,26 @@ create_timeout_test (GtkWidget *widget) gtk_widget_set_margin_end (label, 10); gtk_widget_set_margin_top (label, 10); gtk_widget_set_margin_bottom (label, 10); - gtk_container_add (GTK_CONTAINER (content_area), label); + gtk_box_append (GTK_BOX (content_area), label); button = gtk_button_new_with_label ("close"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (action_area), button); + gtk_box_append (GTK_BOX (action_area), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); button = gtk_button_new_with_label ("start"); g_signal_connect (button, "clicked", G_CALLBACK(start_timeout_test), label); - gtk_container_add (GTK_CONTAINER (action_area), button); + gtk_box_append (GTK_BOX (action_area), button); button = gtk_button_new_with_label ("stop"); g_signal_connect (button, "clicked", G_CALLBACK (stop_timeout_test), NULL); - gtk_container_add (GTK_CONTAINER (action_area), button); + gtk_box_append (GTK_BOX (action_area), button); } if (!gtk_widget_get_visible (window)) @@ -5841,7 +5825,7 @@ create_native_dialogs (GtkWidget *widget) gtk_window_set_child (GTK_WINDOW (window), box); label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); combo = gtk_combo_box_text_new (); @@ -5854,7 +5838,7 @@ create_native_dialogs (GtkWidget *widget) g_signal_connect (combo, "changed", G_CALLBACK (native_action_changed), native); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GTK_FILE_CHOOSER_ACTION_OPEN); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); combo = gtk_combo_box_text_new (); @@ -5865,24 +5849,24 @@ create_native_dialogs (GtkWidget *widget) g_signal_connect (combo, "changed", G_CALLBACK (native_filter_changed), native); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); check_button = gtk_check_button_new_with_label ("Modal"); g_signal_connect (check_button, "toggled", G_CALLBACK (native_modal_toggle), native); - gtk_container_add (GTK_CONTAINER (box), check_button); + gtk_box_append (GTK_BOX (box), check_button); check_button = gtk_check_button_new_with_label ("Multiple select"); g_signal_connect (check_button, "toggled", G_CALLBACK (native_multi_select_toggle), native); - gtk_container_add (GTK_CONTAINER (box), check_button); + gtk_box_append (GTK_BOX (box), check_button); show_button = gtk_button_new_with_label ("Show"); hide_button = gtk_button_new_with_label ("Hide"); gtk_widget_set_sensitive (hide_button, FALSE); - gtk_container_add (GTK_CONTAINER (box), show_button); - gtk_container_add (GTK_CONTAINER (box), hide_button); + gtk_box_append (GTK_BOX (box), show_button); + gtk_box_append (GTK_BOX (box), hide_button); /* connect signals */ g_signal_connect (native, "response", @@ -6009,7 +5993,7 @@ create_main_window (void) gtk_get_minor_version ()); label = gtk_label_new (buffer); - gtk_container_add (GTK_CONTAINER (box1), label); + gtk_box_append (GTK_BOX (box1), label); gtk_widget_set_name (label, "testgtk-version-label"); scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -6021,7 +6005,7 @@ create_main_window (void) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (box1), scrolled_window); + gtk_box_append (GTK_BOX (box1), scrolled_window); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_margin_top (box2, 10); @@ -6041,11 +6025,14 @@ create_main_window (void) NULL); else gtk_widget_set_sensitive (button, FALSE); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); } separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box1), separator); + gtk_box_append (GTK_BOX (box1), separator); + + box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_mnemonic ("_Close"); gtk_widget_set_margin_top (button, 10); @@ -6055,7 +6042,7 @@ create_main_window (void) g_signal_connect (button, "clicked", G_CALLBACK (do_exit), window); - gtk_container_add (GTK_CONTAINER (box1), button); + gtk_box_append (GTK_BOX (box2), button); gtk_window_set_default_widget (GTK_WINDOW (window), button); gtk_widget_show (window); diff --git a/tests/testheaderbar.c b/tests/testheaderbar.c index 8094b29183..2390b438e5 100644 --- a/tests/testheaderbar.c +++ b/tests/testheaderbar.c @@ -85,11 +85,11 @@ change_header (GtkButton *button, gpointer data) gtk_widget_set_margin_top (header, 10); gtk_widget_set_margin_bottom (header, 10); label = gtk_label_new ("Label"); - gtk_container_add (GTK_CONTAINER (header), label); + gtk_box_append (GTK_BOX (header), label); widget = gtk_level_bar_new (); gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.4); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (header), widget); + gtk_box_append (GTK_BOX (header), widget); } else { @@ -145,7 +145,7 @@ main (int argc, char *argv[]) gtk_image_set_pixel_size (GTK_IMAGE (content), 512); gtk_widget_set_vexpand (content, TRUE); - gtk_container_add (GTK_CONTAINER (box), content); + gtk_box_append (GTK_BOX (box), content); footer = gtk_action_bar_new (); gtk_action_bar_set_center_widget (GTK_ACTION_BAR (footer), gtk_check_button_new_with_label ("Middle")); @@ -155,7 +155,7 @@ main (int argc, char *argv[]) button = gtk_button_new_with_label ("Fullscreen"); gtk_action_bar_pack_end (GTK_ACTION_BAR (footer), button); g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window); - gtk_container_add (GTK_CONTAINER (box), footer); + gtk_box_append (GTK_BOX (box), footer); gtk_widget_show (window); while (!done) diff --git a/tests/testheaderbar2.c b/tests/testheaderbar2.c index fda5016d84..309bbb594a 100644 --- a/tests/testheaderbar2.c +++ b/tests/testheaderbar2.c @@ -75,12 +75,12 @@ create_headerbar_inside_window (GtkApplication *app) header = gtk_header_bar_new (); gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE); - gtk_container_add (GTK_CONTAINER (box), header); + gtk_box_append (GTK_BOX (box), header); label = gtk_label_new ("This window has a headerbar inside the window and no titlebar"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_widget_show (window); } @@ -124,12 +124,12 @@ create_headerbar_overlay (GtkApplication *app) "mi eu ipsum vestibulum in venenatis enim commodo. " "Vivamus non malesuada ligula."); gtk_label_set_wrap (GTK_LABEL (label), TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new ("This window has a headerbar inside an overlay, so the text is visible underneath it"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_widget_show (window); } @@ -147,7 +147,7 @@ create_hiding_headerbar (GtkApplication *app) gtk_window_set_child (GTK_WINDOW (window), box); revealer = gtk_revealer_new (); - gtk_container_add (GTK_CONTAINER (box), revealer); + gtk_box_append (GTK_BOX (box), revealer); header = gtk_header_bar_new (); gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE); @@ -156,7 +156,7 @@ create_hiding_headerbar (GtkApplication *app) label = gtk_label_new ("This window's headerbar can be shown and hidden with animation"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER); @@ -164,17 +164,17 @@ create_hiding_headerbar (GtkApplication *app) gtk_widget_set_margin_bottom (hbox, 12); gtk_widget_set_margin_start (hbox, 12); gtk_widget_set_margin_end (hbox, 12); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); toggle = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (toggle), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), toggle); + gtk_box_append (GTK_BOX (hbox), toggle); g_object_bind_property (toggle, "active", revealer, "reveal-child", G_BINDING_SYNC_CREATE); label = gtk_label_new ("Show headerbar"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); gtk_widget_show (window); } @@ -195,7 +195,7 @@ create_fake_headerbar (GtkApplication *app) gtk_window_handle_set_child (GTK_WINDOW_HANDLE (handle), box); center_box = gtk_center_box_new (); - gtk_container_add (GTK_CONTAINER (box), center_box); + gtk_box_append (GTK_BOX (box), center_box); label = gtk_label_new ("Fake headerbar"); gtk_center_box_set_center_widget (GTK_CENTER_BOX (center_box), label); @@ -209,7 +209,7 @@ create_fake_headerbar (GtkApplication *app) label = gtk_label_new ("This window's titlebar is just a centerbox with a label and window controls.\nThe whole window is draggable."); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_vexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_widget_show (window); } @@ -253,7 +253,7 @@ app_activate_cb (GtkApplication *app) G_CALLBACK (buttons[i].cb), app, G_CONNECT_SWAPPED); - gtk_container_add (GTK_CONTAINER (box), btn); + gtk_box_append (GTK_BOX (box), btn); } gtk_widget_show (window); diff --git a/tests/testheightforwidth.c b/tests/testheightforwidth.c index f5d4afff0e..2d825b4158 100644 --- a/tests/testheightforwidth.c +++ b/tests/testheightforwidth.c @@ -676,7 +676,7 @@ create_window (void) g_signal_connect (button, "clicked", G_CALLBACK (test_clicked), &interfaces[i]); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); } return window; diff --git a/tests/testhover.c b/tests/testhover.c index daf4c1cb07..e493155eef 100644 --- a/tests/testhover.c +++ b/tests/testhover.c @@ -85,8 +85,8 @@ enter1_cb (GtkEventController *controller) { GtkWidget *box = gtk_event_controller_get_widget (controller); - gtk_container_remove (GTK_CONTAINER (box), gtk_widget_get_first_child (box)); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("HOVER!")); + gtk_box_remove (GTK_BOX (box), gtk_widget_get_first_child (box)); + gtk_box_append (GTK_BOX (box), gtk_label_new ("HOVER!")); } static void @@ -94,8 +94,8 @@ leave1_cb (GtkEventController *controller) { GtkWidget *box = gtk_event_controller_get_widget (controller); - gtk_container_remove (GTK_CONTAINER (box), gtk_widget_get_first_child (box)); - gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here")); + gtk_box_remove (GTK_BOX (box), gtk_widget_get_first_child (box)); + gtk_box_append (GTK_BOX (box), gtk_image_new_from_icon_name ("start-here")); } static void @@ -115,7 +115,7 @@ test1 (void) g_signal_connect (controller, "leave", G_CALLBACK (leave1_cb), NULL); gtk_widget_add_controller (box, controller); - gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here")); + gtk_box_append (GTK_BOX (box), gtk_image_new_from_icon_name ("start-here")); gtk_widget_show (win); @@ -159,8 +159,8 @@ test2 (void) g_signal_connect (controller, "leave", G_CALLBACK (leave2_cb), NULL); gtk_widget_add_controller (box, controller); - gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here")); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("HOVER!")); + gtk_box_append (GTK_BOX (box), gtk_image_new_from_icon_name ("start-here")); + gtk_box_append (GTK_BOX (box), gtk_label_new ("HOVER!")); gtk_widget_hide (gtk_widget_get_last_child (box)); gtk_widget_show (win); diff --git a/tests/testiconview-keynav.c b/tests/testiconview-keynav.c index 5c4dcdbac5..000304dc5d 100644 --- a/tests/testiconview-keynav.c +++ b/tests/testiconview-keynav.c @@ -254,10 +254,10 @@ main (int argc, char *argv[]) g_signal_connect (views.view1, "notify::has-focus", G_CALLBACK (focus_changed), &views); g_signal_connect (views.view2, "notify::has-focus", G_CALLBACK (focus_changed), &views); - gtk_container_add (GTK_CONTAINER (vbox), views.header1); - gtk_container_add (GTK_CONTAINER (vbox), views.view1); - gtk_container_add (GTK_CONTAINER (vbox), views.header2); - gtk_container_add (GTK_CONTAINER (vbox), views.view2); + gtk_box_append (GTK_BOX (vbox), views.header1); + gtk_box_append (GTK_BOX (vbox), views.view1); + gtk_box_append (GTK_BOX (vbox), views.header2); + gtk_box_append (GTK_BOX (vbox), views.view2); gtk_widget_show (window); diff --git a/tests/testiconview.c b/tests/testiconview.c index 5779b125a9..61e1a324f1 100644 --- a/tests/testiconview.c +++ b/tests/testiconview.c @@ -421,7 +421,7 @@ main (gint argc, gchar **argv) paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_vexpand (paned, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), paned); + gtk_box_append (GTK_BOX (vbox), paned); icon_list = gtk_icon_view_new (); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_list), GTK_SELECTION_MULTIPLE); @@ -537,43 +537,43 @@ main (gint argc, gchar **argv) bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign (bbox, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (vbox), bbox); + gtk_box_append (GTK_BOX (vbox), bbox); button = gtk_button_new_with_label ("Add some"); g_signal_connect (button, "clicked", G_CALLBACK (add_some), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Add many"); g_signal_connect (button, "clicked", G_CALLBACK (add_many), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Add large"); g_signal_connect (button, "clicked", G_CALLBACK (add_large), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Remove selected"); g_signal_connect (button, "clicked", G_CALLBACK (foreach_selected_remove), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Swap"); g_signal_connect (button, "clicked", G_CALLBACK (swap_rows), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign (bbox, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (vbox), bbox); + gtk_box_append (GTK_BOX (vbox), bbox); button = gtk_button_new_with_label ("Select all"); g_signal_connect (button, "clicked", G_CALLBACK (select_all), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Unselect all"); g_signal_connect (button, "clicked", G_CALLBACK (unselect_all), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_label ("Select nonexisting"); g_signal_connect (button, "clicked", G_CALLBACK (select_nonexisting), icon_list); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); icon_list = gtk_icon_view_new (); diff --git a/tests/testinfobar.c b/tests/testinfobar.c index ee7ab749fb..a49403d1ff 100644 --- a/tests/testinfobar.c +++ b/tests/testinfobar.c @@ -43,21 +43,21 @@ on_activate (GApplication *application, g_object_bind_property (widget, "active", info_bar, "visible", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); widget = gtk_toggle_button_new_with_label ("Toggle :revealed"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); g_object_bind_property (widget, "active", info_bar, "revealed", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); widget = gtk_toggle_button_new_with_label ("Toggle :show-close-button"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); g_object_bind_property (widget, "active", info_bar, "show-close-button", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), @@ -74,9 +74,9 @@ on_activate (GApplication *application, g_object_bind_property (widget, "active", info_bar, "message-type", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); - gtk_container_add (GTK_CONTAINER (box), info_bar); + gtk_box_append (GTK_BOX (box), info_bar); widget = gtk_button_new_with_label ("Un-reveal"); gtk_info_bar_add_action_widget (GTK_INFO_BAR (info_bar), widget, diff --git a/tests/testinhibitshortcuts.c b/tests/testinhibitshortcuts.c index abdf232569..967a3f0ed5 100644 --- a/tests/testinhibitshortcuts.c +++ b/tests/testinhibitshortcuts.c @@ -85,11 +85,11 @@ main (int argc, char *argv[]) text_view = gtk_text_view_new (); gtk_widget_set_hexpand (text_view, TRUE); gtk_widget_set_vexpand (text_view, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), text_view); + gtk_box_append (GTK_BOX (vbox), text_view); button = gtk_check_button_new_with_label ("Inhibit system keyboard shorcuts"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (on_button_toggle), surface); diff --git a/tests/testlevelbar.c b/tests/testlevelbar.c index e9fd02df91..5a79ec66ef 100644 --- a/tests/testlevelbar.c +++ b/tests/testlevelbar.c @@ -98,12 +98,12 @@ main (int argc, char *argv[]) gtk_widget_set_margin_bottom (box, 20); bar = create_level_bar (); gtk_window_set_child (GTK_WINDOW (window), box); - gtk_container_add (GTK_CONTAINER (box), bar); + gtk_box_append (GTK_BOX (box), bar); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (box), box2); - gtk_container_add (GTK_CONTAINER (box2), gtk_label_new ("Discrete")); + gtk_box_append (GTK_BOX (box), box2); + gtk_box_append (GTK_BOX (box2), gtk_label_new ("Discrete")); sw = gtk_switch_new (); - gtk_container_add (GTK_CONTAINER (box2), sw); + gtk_box_append (GTK_BOX (box2), sw); g_signal_connect (sw, "notify::active", G_CALLBACK (toggle), bar); gtk_widget_show (window); diff --git a/tests/testlist.c b/tests/testlist.c index c001651a4d..da44389d98 100644 --- a/tests/testlist.c +++ b/tests/testlist.c @@ -63,7 +63,6 @@ static void update_header_cb (Row *row, Row *before, gpointer data) { GtkWidget *hbox, *l, *b; - GList *children; if (before == NULL || (row->label != NULL && @@ -74,17 +73,15 @@ update_header_cb (Row *row, Row *before, gpointer data) { hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); l = gtk_label_new ("Header"); - gtk_container_add (GTK_CONTAINER (hbox), l); + gtk_box_append (GTK_BOX (hbox), l); b = gtk_button_new_with_label ("button"); - gtk_container_add (GTK_CONTAINER (hbox), b); + gtk_box_append (GTK_BOX (hbox), b); gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), hbox); } hbox = gtk_list_box_row_get_header(GTK_LIST_BOX_ROW (row)); - children = gtk_container_get_children (GTK_CONTAINER (hbox)); - l = children->data; - g_list_free (children); + l = gtk_widget_get_first_child (hbox); gtk_label_set_text (GTK_LABEL (l), g_strdup_printf ("Header %d", row->sort_id)); } else @@ -268,7 +265,7 @@ main (int argc, char *argv[]) list = gtk_list_box_new (); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), @@ -278,17 +275,17 @@ main (int argc, char *argv[]) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "GTK_SELECTION_BROWSE"); g_signal_connect (combo, "changed", G_CALLBACK (selection_mode_changed), list); - gtk_container_add (GTK_CONTAINER (vbox), combo); + gtk_box_append (GTK_BOX (vbox), combo); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_list_box_get_selection_mode (GTK_LIST_BOX (list))); check = gtk_check_button_new_with_label ("single click mode"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gtk_list_box_get_activate_on_single_click (GTK_LIST_BOX (list))); g_signal_connect (check, "toggled", G_CALLBACK (single_click_clicked), list); - gtk_container_add (GTK_CONTAINER (vbox), check); + gtk_box_append (GTK_BOX (vbox), check); scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), list); - gtk_container_add (GTK_CONTAINER (hbox), scrolled); + gtk_box_append (GTK_BOX (hbox), scrolled); g_signal_connect (list, "row-activated", G_CALLBACK (row_activated_cb), NULL); g_signal_connect (list, "row-selected", G_CALLBACK (row_selected_cb), NULL); @@ -306,14 +303,14 @@ main (int argc, char *argv[]) row_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); row_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); l = gtk_label_new ("da box for da man"); - gtk_container_add (GTK_CONTAINER (row_hbox), l); + gtk_box_append (GTK_BOX (row_hbox), l); check = gtk_check_button_new (); - gtk_container_add (GTK_CONTAINER (row_hbox), check); + gtk_box_append (GTK_BOX (row_hbox), check); button = gtk_button_new_with_label ("ya!"); - gtk_container_add (GTK_CONTAINER (row_hbox), button); - gtk_container_add (GTK_CONTAINER (row_vbox), row_hbox); + gtk_box_append (GTK_BOX (row_hbox), button); + gtk_box_append (GTK_BOX (row_vbox), row_hbox); check = gtk_check_button_new (); - gtk_container_add (GTK_CONTAINER (row_vbox), check); + gtk_box_append (GTK_BOX (row_vbox), check); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_vbox); gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); @@ -325,42 +322,42 @@ main (int argc, char *argv[]) gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); button = gtk_button_new_with_label ("sort"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (sort_clicked_cb), list); button = gtk_button_new_with_label ("reverse"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (reverse_sort_clicked_cb), list); button = gtk_button_new_with_label ("change"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (change_clicked_cb), row3); button = gtk_button_new_with_label ("filter"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (filter_clicked_cb), list); button = gtk_button_new_with_label ("unfilter"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (unfilter_clicked_cb), list); button = gtk_button_new_with_label ("add"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (add_clicked_cb), list); button = gtk_button_new_with_label ("separate"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (separate_clicked_cb), list); button = gtk_button_new_with_label ("unseparate"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (unseparate_clicked_cb), list); button = gtk_button_new_with_label ("visibility"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (visibility_clicked_cb), row3); gtk_widget_show (window); diff --git a/tests/testlist2.c b/tests/testlist2.c index bfb009be5b..a425428b34 100644 --- a/tests/testlist2.c +++ b/tests/testlist2.c @@ -20,10 +20,10 @@ remove_this_row (GtkButton *button, GtkWidget *child) revealer = gtk_revealer_new (); gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), TRUE); g_object_ref (child); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (child)), child); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (child)), child); gtk_revealer_set_child (GTK_REVEALER (revealer), child); g_object_unref (child); - gtk_container_add (GTK_CONTAINER (row), revealer); + gtk_box_append (GTK_BOX (row), revealer); g_signal_connect (revealer, "notify::child-revealed", G_CALLBACK (row_unrevealed), NULL); gtk_revealer_set_reveal_child (GTK_REVEALER (revealer), FALSE); @@ -40,8 +40,9 @@ row_revealed (GObject *revealer, GParamSpec *pspec, gpointer data) child = gtk_revealer_get_child (GTK_REVEALER (revealer)); g_object_ref (child); gtk_revealer_set_child (GTK_REVEALER (revealer), NULL); + gtk_widget_unparent (GTK_WIDGET (revealer)); - gtk_container_add (GTK_CONTAINER (row), child); + gtk_box_append (GTK_BOX (row), child); g_object_unref (child); } @@ -79,16 +80,16 @@ create_row (const gchar *text) row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); button = gtk_button_new_with_label ("x"); gtk_widget_set_hexpand (button, TRUE); gtk_widget_set_halign (button, GTK_ALIGN_END); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); g_signal_connect (button, "clicked", G_CALLBACK (remove_this_row), row); button = gtk_button_new_with_label ("+"); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); g_signal_connect (button, "clicked", G_CALLBACK (add_row_below), row); return row; diff --git a/tests/testlist3.c b/tests/testlist3.c index b067a5b42c..e3940a2c46 100644 --- a/tests/testlist3.c +++ b/tests/testlist3.c @@ -49,7 +49,7 @@ drag_drop (GtkDropTarget *dest, return FALSE; g_object_ref (source); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (source)), source); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (source)), source); gtk_list_box_insert (GTK_LIST_BOX (gtk_widget_get_parent (target)), source, pos); g_object_unref (source); @@ -70,8 +70,8 @@ create_row (const gchar *text) label = gtk_label_new (text); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box); gtk_widget_set_hexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), label); + gtk_box_append (GTK_BOX (box), image); source = gtk_drag_source_new (); gtk_drag_source_set_actions (source, GDK_ACTION_MOVE); @@ -145,7 +145,7 @@ main (int argc, char *argv[]) gtk_widget_set_margin_end (vbox, 12); gtk_widget_set_margin_top (vbox, 12); gtk_widget_set_margin_bottom (vbox, 12); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); list = gtk_list_box_new (); gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE); @@ -157,14 +157,14 @@ main (int argc, char *argv[]) sw = gtk_scrolled_window_new (NULL, NULL); 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_box_append (GTK_BOX (hbox), sw); 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", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "None"); @@ -172,7 +172,7 @@ main (int argc, char *argv[]) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Browse"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Multiple"); g_signal_connect (combo, "changed", G_CALLBACK (selection_mode_changed), list); - gtk_container_add (GTK_CONTAINER (vbox), combo); + gtk_box_append (GTK_BOX (vbox), combo); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_list_box_get_selection_mode (GTK_LIST_BOX (list))); for (i = 0; i < 20; i++) diff --git a/tests/testlist4.c b/tests/testlist4.c index d820d58b52..bae109f989 100644 --- a/tests/testlist4.c +++ b/tests/testlist4.c @@ -79,7 +79,7 @@ create_row (const gchar *text) row_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (row_content), label); + gtk_box_append (GTK_BOX (row_content), label); return row_content; } diff --git a/tests/testlockbutton.c b/tests/testlockbutton.c index da37f6c897..9832bb53cf 100644 --- a/tests/testlockbutton.c +++ b/tests/testlockbutton.c @@ -230,15 +230,15 @@ main (int argc, char *argv[]) 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); + gtk_box_append (GTK_BOX (box), allowed_button); can_acquire_button = gtk_check_button_new_with_label ("Can acquire"); - gtk_container_add (GTK_CONTAINER (box), can_acquire_button); + gtk_box_append (GTK_BOX (box), can_acquire_button); can_release_button = gtk_check_button_new_with_label ("Can release"); - gtk_container_add (GTK_CONTAINER (box), can_release_button); + gtk_box_append (GTK_BOX (box), can_release_button); success_button = gtk_check_button_new_with_label ("Will succeed"); - gtk_container_add (GTK_CONTAINER (box), success_button); + gtk_box_append (GTK_BOX (box), success_button); update = gtk_button_new_with_label ("Update"); - gtk_container_add (GTK_CONTAINER (box), update); + gtk_box_append (GTK_BOX (box), update); g_signal_connect (permission, "notify", G_CALLBACK (permission_changed), NULL); @@ -254,12 +254,12 @@ main (int argc, char *argv[]) gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); - gtk_container_add (GTK_CONTAINER (content), gtk_check_button_new_with_label ("Control 1")); - gtk_container_add (GTK_CONTAINER (content), gtk_check_button_new_with_label ("Control 2")); + gtk_box_append (GTK_BOX (content), gtk_check_button_new_with_label ("Control 1")); + gtk_box_append (GTK_BOX (content), gtk_check_button_new_with_label ("Control 2")); gtk_widget_set_sensitive (content, FALSE); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), content); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), button); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), content); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), button); gtk_widget_show (window); gtk_widget_show (dialog); diff --git a/tests/testlogout.c b/tests/testlogout.c index 1ea27335be..39a38b2b3a 100644 --- a/tests/testlogout.c +++ b/tests/testlogout.c @@ -92,7 +92,7 @@ activate (GtkApplication *app, gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - gtk_container_add (GTK_CONTAINER (box), grid); + gtk_box_append (GTK_BOX (box), grid); label = gtk_label_new ("Inhibitor"); gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); @@ -121,7 +121,7 @@ activate (GtkApplication *app, gtk_grid_attach (GTK_GRID (grid), button, 2, 6, 1, 1); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box), separator); + gtk_box_append (GTK_BOX (box), separator); grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c new file mode 100644 index 0000000000..3bf057648b --- /dev/null +++ b/tests/testmodelbutton.c @@ -0,0 +1,98 @@ +#include <gtk/gtk.h> +#include "gtk/gtkmodelbuttonprivate.h" + +static void +on_action_beep (GSimpleAction *action, + GVariant *parameter, + void *user_data) +{ + GdkDisplay *display = gdk_display_get_default (); + gdk_display_beep (display); +} + +static void +on_application_activate (GApplication *gapplication, + void *user_data) +{ + GtkApplication *application = GTK_APPLICATION (gapplication); + GtkCssProvider *css_provider = gtk_css_provider_new (); + GdkDisplay *display = gdk_display_get_default (); + + GSimpleAction *action; + GtkWidget *box; + GIcon *gicon; + GtkWidget *model_button; + GtkWidget *widget; + + gtk_css_provider_load_from_data (css_provider, + "window > box { padding: 0.5em; }" + "window > box > * { margin: 0.5em; }" + /* :iconic == FALSE */ + "modelbutton > check { background: red; }" + "modelbutton > radio { background: green; }" + "modelbutton > arrow { background: blue; }" + /* :iconic == TRUE */ + "button.model { background: yellow; }" + , -1); + g_assert (GDK_IS_DISPLAY (display)); + gtk_style_context_add_provider_for_display (display, + GTK_STYLE_PROVIDER (css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + action = g_simple_action_new ("beep", NULL); + g_signal_connect (action, "activate", G_CALLBACK (on_action_beep), NULL); + g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action)); + + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + + gicon = g_themed_icon_new ("face-smile"); + + model_button = g_object_new (g_type_from_name ("GtkModelButton"), + "action-name", "app.beep", + "text", "It’s-a-me! ModelButton", + "icon", gicon, + NULL); + gtk_box_append (GTK_BOX (box), model_button); + + g_object_unref (gicon); + + widget = gtk_combo_box_text_new (); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), + NULL, "GTK_BUTTON_ROLE_NORMAL"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), + NULL, "GTK_BUTTON_ROLE_CHECK"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), + NULL, "GTK_BUTTON_ROLE_RADIO"); + gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); + g_object_bind_property (widget, "active", + model_button, "role", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + gtk_box_append (GTK_BOX (box), widget); + + widget = gtk_toggle_button_new_with_label (":iconic"); + g_object_bind_property (widget, "active", + model_button, "iconic", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + gtk_box_append (GTK_BOX (box), widget); + + widget = gtk_window_new (); + gtk_box_append (GTK_BOX (widget), box); + gtk_widget_show (widget); + gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (widget)); +} + +int +main (int argc, + char *argv[]) +{ + GtkApplication *application = gtk_application_new ("org.gtk.test.modelbutton", + G_APPLICATION_FLAGS_NONE); + int result; + + g_signal_connect (application, "activate", + G_CALLBACK (on_application_activate), NULL); + + result = g_application_run (G_APPLICATION (application), argc, argv); + g_object_unref (application); + return result; +} diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c index b55028299b..dc6c6b2b15 100644 --- a/tests/testnotebookdnd.c +++ b/tests/testnotebookdnd.c @@ -96,7 +96,7 @@ remove_in_idle (gpointer data) tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (parent), child); g_print ("Removing tab: %s\n", gtk_label_get_text (GTK_LABEL (tab_label))); - gtk_container_remove (GTK_CONTAINER (parent), child); + gtk_box_remove (GTK_BOX (parent), child); return G_SOURCE_REMOVE; } @@ -202,13 +202,13 @@ create_notebook_non_dragable_content (const char **labels, /* Use GtkListBox since it bubbles up motion notify event, which can * experience more issues than GtkBox. */ page = gtk_list_box_new (); - gtk_container_add (GTK_CONTAINER (page), button); + gtk_box_append (GTK_BOX (page), button); button = gtk_button_new_with_label ("row 2"); - gtk_container_add (GTK_CONTAINER (page), button); + gtk_box_append (GTK_BOX (page), button); button = gtk_button_new_with_label ("third row"); - gtk_container_add (GTK_CONTAINER (page), button); + gtk_box_append (GTK_BOX (page), button); title = gtk_label_new (*labels); diff --git a/tests/testorientable.c b/tests/testorientable.c index 2413be638f..d312ec7207 100644 --- a/tests/testorientable.c +++ b/tests/testorientable.c @@ -69,17 +69,17 @@ main (int argc, char **argv) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); button = gtk_toggle_button_new_with_label ("Horizontal"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); /* GtkBox */ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); orientables = g_list_prepend (orientables, box); - gtk_container_add (GTK_CONTAINER (vbox), box); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (vbox), box); + gtk_box_append (GTK_BOX (box), gtk_button_new_with_label ("GtkBox 1")); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), gtk_button_new_with_label ("GtkBox 2")); - gtk_container_add (GTK_CONTAINER (box), + gtk_box_append (GTK_BOX (box), gtk_button_new_with_label ("GtkBox 3")); g_signal_connect (button, "toggled", diff --git a/tests/testoutsetshadowdrawing.c b/tests/testoutsetshadowdrawing.c index 49ee0d12f9..9056ed855c 100644 --- a/tests/testoutsetshadowdrawing.c +++ b/tests/testoutsetshadowdrawing.c @@ -116,52 +116,52 @@ main (int argc, char **argv) w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "one"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "two"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "three"); gtk_widget_set_opacity (w, 0.7); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "four"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "five"); - gtk_container_add (GTK_CONTAINER (top), w); + gtk_box_append (GTK_BOX (top), w); /* Bottom */ w = gtk_button_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_widget_add_css_class (w, "b1"); - gtk_container_add (GTK_CONTAINER (bottom), w); + gtk_box_append (GTK_BOX (bottom), w); /*w = gtk_button_new ();*/ /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/ /*gtk_widget_add_css_class (w, "b2");*/ - /*gtk_container_add (GTK_CONTAINER (bottom), w);*/ + /*gtk_box_append (GTK_BOX (bottom), w);*/ /*w = gtk_button_new ();*/ /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/ /*gtk_widget_add_css_class (w, "b3");*/ - /*gtk_container_add (GTK_CONTAINER (bottom), w);*/ + /*gtk_box_append (GTK_BOX (bottom), w);*/ /*w = gtk_button_new ();*/ /*gtk_widget_set_valign (w, GTK_ALIGN_CENTER);*/ /*gtk_widget_add_css_class (w, "b4");*/ - /*gtk_container_add (GTK_CONTAINER (bottom), w);*/ + /*gtk_box_append (GTK_BOX (bottom), w);*/ - gtk_container_add (GTK_CONTAINER (box), top); - gtk_container_add (GTK_CONTAINER (box), bottom); + gtk_box_append (GTK_BOX (box), top); + gtk_box_append (GTK_BOX (box), bottom); 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 d7187be70a..7c115a1a31 100644 --- a/tests/testoverlay.c +++ b/tests/testoverlay.c @@ -445,7 +445,7 @@ test_stacking (void) check2 = gtk_check_button_new_with_label ("Show overlay"); g_object_bind_property (child, "visible", check2, "active", G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (main_child), label); + gtk_box_append (GTK_BOX (main_child), label); gtk_overlay_set_child (GTK_OVERLAY (overlay), main_child); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child); gtk_grid_attach (GTK_GRID (grid), overlay, 1, 0, 1, 3); @@ -500,12 +500,12 @@ test_input_stacking (void) "But the entry does"); gtk_widget_set_margin_top (label, 8); gtk_widget_set_margin_bottom (label, 8); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); entry = gtk_entry_new (); gtk_widget_set_margin_top (entry, 8); gtk_widget_set_margin_bottom (entry, 8); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); gtk_window_set_child (GTK_WINDOW (win), overlay); diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c index e0de538221..c77e2a94f5 100644 --- a/tests/testoverlaystyleclass.c +++ b/tests/testoverlaystyleclass.c @@ -66,7 +66,7 @@ main (int argc, char *argv[]) label = gtk_label_new ("Main child"); gtk_widget_set_halign (label, GTK_ALIGN_CENTER); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (main_child), label); + gtk_box_append (GTK_BOX (main_child), label); child = gtk_label_new (NULL); str = g_strdup_printf ("%p", child); diff --git a/tests/testpixbuf-scale.c b/tests/testpixbuf-scale.c index eef877a2c1..2a67078858 100644 --- a/tests/testpixbuf-scale.c +++ b/tests/testpixbuf-scale.c @@ -120,13 +120,13 @@ main(int argc, char **argv) NULL); gtk_widget_set_halign (combo_box, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (vbox), combo_box); + gtk_box_append (GTK_BOX (vbox), combo_box); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); label = gtk_label_new ("Overall Alpha:"); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); adjustment = gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0); g_signal_connect (adjustment, "value_changed", @@ -135,7 +135,7 @@ main(int argc, char **argv) hscale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment); gtk_scale_set_digits (GTK_SCALE (hscale), 0); gtk_widget_set_hexpand (hscale, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), hscale); + gtk_box_append (GTK_BOX (hbox), hscale); /* Compute the size without the drawing area, so we know how big to make the default size */ gtk_widget_get_preferred_size ( (vbox), @@ -143,7 +143,7 @@ main(int argc, char **argv) darea = gtk_drawing_area_new (); gtk_widget_set_hexpand (darea, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), darea); + gtk_box_append (GTK_BOX (vbox), darea); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), draw_func, NULL, NULL); diff --git a/tests/testpopover.c b/tests/testpopover.c index be9a38fe19..6f62ca9f01 100644 --- a/tests/testpopover.c +++ b/tests/testpopover.c @@ -106,11 +106,11 @@ main (int argc, char *argv[]) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); button = gtk_menu_button_new (); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button1 = gtk_menu_button_new (); - gtk_container_add (GTK_CONTAINER (box), button1); + gtk_box_append (GTK_BOX (box), button1); button2 = gtk_menu_button_new (); - gtk_container_add (GTK_CONTAINER (box), button2); + gtk_box_append (GTK_BOX (box), button2); gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model); popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button))); diff --git a/tests/testrevealer2.c b/tests/testrevealer2.c index 577254ff61..d058451a39 100644 --- a/tests/testrevealer2.c +++ b/tests/testrevealer2.c @@ -39,7 +39,7 @@ on_activate (GApplication *app, revealer = gtk_revealer_new (); gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT); - gtk_container_add (GTK_CONTAINER (hbox), revealer); + gtk_box_append (GTK_BOX (hbox), revealer); sidebar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_size_request (sidebar, 150, -1); @@ -53,7 +53,7 @@ on_activate (GApplication *app, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_CENTER, NULL); - gtk_container_add (GTK_CONTAINER (hbox), img); + gtk_box_append (GTK_BOX (hbox), img); g_object_bind_property (sidebar_toggle, "active", revealer, "reveal-child", diff --git a/tests/testscale.c b/tests/testscale.c index 797f77d8da..86e9b47da2 100644 --- a/tests/testscale.c +++ b/tests/testscale.c @@ -135,7 +135,7 @@ int main (int argc, char *argv[]) flipbox = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); gtk_widget_set_hexpand (flipbox, TRUE); gtk_widget_set_vexpand (flipbox, TRUE); - gtk_container_add (GTK_CONTAINER (box1), box); + gtk_box_append (GTK_BOX (box1), box); gtk_window_set_child (GTK_WINDOW (window), box1); frame = gtk_frame_new ("No marks"); @@ -143,7 +143,7 @@ int main (int argc, char *argv[]) scales = g_slist_prepend (scales, scale); gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("With fill level"); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -152,7 +152,7 @@ int main (int argc, char *argv[]) gtk_range_set_show_fill_level (GTK_RANGE (scale), TRUE); gtk_range_set_fill_level (GTK_RANGE (scale), 50); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Simple marks"); extra_scale = scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -162,7 +162,7 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, NULL); gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, NULL); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Simple marks up"); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -172,7 +172,7 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL); gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, NULL); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Labeled marks"); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); @@ -184,7 +184,7 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]); gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Some labels"); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -194,7 +194,7 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL); gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, labels[2]); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Above and below"); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -205,7 +205,7 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[2], GTK_POS_BOTTOM, bath_labels[2]); gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[3], GTK_POS_TOP, bath_labels[3]); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); frame = gtk_frame_new ("Positions"); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); @@ -216,28 +216,28 @@ int main (int argc, char *argv[]) gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[2], GTK_POS_TOP, pos_labels[2]); gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]); gtk_frame_set_child (GTK_FRAME (frame), scale); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - gtk_container_add (GTK_CONTAINER (box1), box2); + gtk_box_append (GTK_BOX (box1), box2); button = gtk_button_new_with_label ("Flip"); g_signal_connect (button, "clicked", G_CALLBACK (flip), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_button_new_with_label ("Invert"); g_signal_connect (button, "clicked", G_CALLBACK (invert), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_toggle_button_new_with_label ("Trough"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_signal_connect (button, "toggled", G_CALLBACK (trough), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_widget_show (window); button = gtk_toggle_button_new_with_label ("Extra"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE); g_signal_connect (button, "toggled", G_CALLBACK (extra), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_widget_show (window); while (!done) diff --git a/tests/testscrolledge.c b/tests/testscrolledge.c index 150d6fa936..1e1c45c065 100644 --- a/tests/testscrolledge.c +++ b/tests/testscrolledge.c @@ -114,8 +114,8 @@ main (int argc, char *argv[]) gtk_widget_set_margin_bottom (popup, 40); label = gtk_label_new ("Getting more rows..."); spinner = gtk_spinner_new (); - gtk_container_add (GTK_CONTAINER (popup), label); - gtk_container_add (GTK_CONTAINER (popup), spinner); + gtk_box_append (GTK_BOX (popup), label); + gtk_box_append (GTK_BOX (popup), spinner); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), popup); gtk_widget_hide (popup); diff --git a/tests/testscrolledwindow.c b/tests/testscrolledwindow.c index c6b6ebf12b..c485a3148c 100644 --- a/tests/testscrolledwindow.c +++ b/tests/testscrolledwindow.c @@ -84,11 +84,11 @@ scrollable_policy (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_window_set_child (GTK_WINDOW (window), hbox); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); frame = gtk_frame_new ("Scrolled Window"); gtk_widget_set_hexpand (frame, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), frame); + gtk_box_append (GTK_BOX (hbox), frame); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), @@ -117,14 +117,14 @@ scrollable_policy (void) gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE); cntl = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_expander_set_child (GTK_EXPANDER (expander), cntl); - gtk_container_add (GTK_CONTAINER (vbox), expander); + gtk_box_append (GTK_BOX (vbox), expander); /* Add Horizontal policy control here */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); widget = gtk_label_new ("hscroll-policy"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum"); @@ -132,8 +132,8 @@ scrollable_policy (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (cntl), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (cntl), hbox); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (horizontal_policy_changed), viewport); @@ -143,7 +143,7 @@ scrollable_policy (void) widget = gtk_label_new ("vscroll-policy"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum"); @@ -151,8 +151,8 @@ scrollable_policy (void) gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (cntl), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (cntl), hbox); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (vertical_policy_changed), viewport); @@ -162,12 +162,12 @@ scrollable_policy (void) widget = gtk_label_new ("min-content-width"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (cntl), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (cntl), hbox); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (content_width_changed), swindow); @@ -176,12 +176,12 @@ scrollable_policy (void) widget = gtk_label_new ("min-content-height"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (cntl), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (cntl), hbox); g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (content_height_changed), swindow); @@ -189,7 +189,7 @@ scrollable_policy (void) /* Add Kinetic scrolling control here */ widget = gtk_check_button_new_with_label ("Kinetic scrolling"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (cntl), widget); + gtk_box_append (GTK_BOX (cntl), widget); g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (kinetic_scrolling_changed), swindow); @@ -201,7 +201,7 @@ scrollable_policy (void) widget = gtk_menu_button_new (); gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), popover); gtk_menu_button_set_label (GTK_MENU_BUTTON (widget), "Popover"); - gtk_container_add (GTK_CONTAINER (cntl), widget); + gtk_box_append (GTK_BOX (cntl), widget); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_popover_set_child (GTK_POPOVER (popover), vbox); @@ -211,7 +211,7 @@ scrollable_policy (void) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (vbox), swindow); + gtk_box_append (GTK_BOX (vbox), swindow); /* Listbox */ listbox = gtk_list_box_new (); @@ -222,11 +222,11 @@ scrollable_policy (void) widget = gtk_label_new ("min-content-width"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), "value", @@ -236,13 +236,13 @@ scrollable_policy (void) widget = gtk_label_new ("min-content-height"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), "value", @@ -255,11 +255,11 @@ scrollable_policy (void) widget = gtk_label_new ("max-content-width"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), "value", @@ -269,12 +269,12 @@ scrollable_policy (void) widget = gtk_label_new ("max-content-height"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), "value", @@ -287,15 +287,15 @@ scrollable_policy (void) widget = gtk_button_new_with_label ("Remove"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), widget); g_signal_connect (widget, "clicked", G_CALLBACK (remove_row), listbox); widget = gtk_button_new_with_label ("Add"); gtk_widget_set_hexpand (widget, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), widget); + gtk_box_append (GTK_BOX (vbox), hbox); g_signal_connect (widget, "clicked", G_CALLBACK (add_row), listbox); diff --git a/tests/testselectionmode.c b/tests/testselectionmode.c index 65747dbfe8..7157c8ec02 100644 --- a/tests/testselectionmode.c +++ b/tests/testselectionmode.c @@ -28,14 +28,14 @@ selectable_row_init (SelectableRow *row) gtk_widget_set_margin_bottom (row->check, 10); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row->box); - gtk_container_add (GTK_CONTAINER (row->box), row->revealer); + gtk_box_append (GTK_BOX (row->box), row->revealer); gtk_revealer_set_child (GTK_REVEALER (row->revealer), row->check); } static void selectable_row_add (SelectableRow *row, GtkWidget *child) { - gtk_container_add (GTK_CONTAINER (row->box), child); + gtk_box_append (GTK_BOX (row->box), child); } static void diff --git a/tests/testsensitive.c b/tests/testsensitive.c index 7f8b0be77e..88eccfb1b5 100644 --- a/tests/testsensitive.c +++ b/tests/testsensitive.c @@ -65,15 +65,15 @@ int main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (window), box); w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 15); - gtk_container_add (GTK_CONTAINER (box), w); - gtk_container_add (GTK_CONTAINER (w), gtk_entry_new ()); + gtk_box_append (GTK_BOX (box), w); + gtk_box_append (GTK_BOX (w), gtk_entry_new ()); bu = gtk_button_new_with_label ("Bu"); - gtk_container_add (GTK_CONTAINER (w), bu); + gtk_box_append (GTK_BOX (w), bu); c = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (c), TRUE); gtk_widget_set_halign (c, GTK_ALIGN_CENTER); gtk_widget_set_valign (c, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), c); + gtk_box_append (GTK_BOX (box), c); g_signal_connect (bu, "clicked", G_CALLBACK (set_insensitive), w); g_signal_connect (bu, "state-flags-changed", G_CALLBACK (state_flags_changed), NULL); diff --git a/tests/testsounds.c b/tests/testsounds.c index 3a62f69fae..31c65fa31c 100644 --- a/tests/testsounds.c +++ b/tests/testsounds.c @@ -53,11 +53,11 @@ int main (int argc, char *argv[]) button = gtk_button_new_with_label ("Α"); g_signal_connect (button, "clicked", G_CALLBACK (enter), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Ω"); g_signal_connect (button, "clicked", G_CALLBACK (leave), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_window_present (GTK_WINDOW (window)); diff --git a/tests/testspinbutton.c b/tests/testspinbutton.c index ca1ff40b67..ef8f2db648 100644 --- a/tests/testspinbutton.c +++ b/tests/testspinbutton.c @@ -48,7 +48,7 @@ prepare_window_for_orientation (GtkOrientation orientation) 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); + gtk_box_append (GTK_BOX (mainbox), wrap_button); for (max = 9; max <= 999999999; max = max * 10 + 9) { @@ -65,8 +65,8 @@ prepare_window_for_orientation (GtkOrientation orientation) g_object_bind_property (wrap_button, "active", spin, "wrap", G_BINDING_SYNC_CREATE); GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_container_add (GTK_CONTAINER (hbox), spin); - gtk_container_add (GTK_CONTAINER (mainbox), hbox); + gtk_box_append (GTK_BOX (hbox), spin); + gtk_box_append (GTK_BOX (mainbox), hbox); } gtk_widget_show (window); diff --git a/tests/teststack.c b/tests/teststack.c index 561eb0373e..af111d1dd6 100644 --- a/tests/teststack.c +++ b/tests/teststack.c @@ -129,7 +129,7 @@ main (gint argc, gtk_window_set_child (GTK_WINDOW (window), box); switcher = gtk_stack_switcher_new (); - gtk_container_add (GTK_CONTAINER (box), switcher); + gtk_box_append (GTK_BOX (box), switcher); stack = gtk_stack_new (); @@ -143,11 +143,11 @@ main (gint argc, sidebar = gtk_stack_sidebar_new (); gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack)); layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (layout), sidebar); + gtk_box_append (GTK_BOX (layout), sidebar); gtk_widget_set_hexpand (stack, TRUE); - gtk_container_add (GTK_CONTAINER (layout), stack); + gtk_box_append (GTK_BOX (layout), stack); - gtk_container_add (GTK_CONTAINER (box), layout); + gtk_box_append (GTK_BOX (box), layout); gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack)); @@ -188,47 +188,47 @@ main (gint argc, gtk_stack_add_titled (GTK_STACK (stack), w3, "3", "3"); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new_with_label ("1"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w1); button = gtk_button_new_with_label ("2"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w2); button = gtk_button_new_with_label ("3"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child, w3); button = gtk_button_new_with_label ("1"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "1"); button = gtk_button_new_with_label ("2"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "2"); button = gtk_button_new_with_label ("3"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) set_visible_child_name, (gpointer) "3"); button = gtk_check_button_new (); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_stack_get_hhomogeneous (GTK_STACK (stack))); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) toggle_hhomogeneous, NULL); button = gtk_check_button_new_with_label ("homogeneous"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), gtk_stack_get_vhomogeneous (GTK_STACK (stack))); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) toggle_vhomogeneous, NULL); button = gtk_toggle_button_new_with_label ("Add icon"); g_signal_connect (button, "toggled", (GCallback) toggle_icon_name, NULL); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); combo = gtk_combo_box_text_new (); class = g_type_class_ref (GTK_TYPE_STACK_TRANSITION_TYPE); @@ -236,21 +236,21 @@ main (gint argc, gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), class->values[i].value_nick); g_type_class_unref (class); - gtk_container_add (GTK_CONTAINER (hbox), combo); + gtk_box_append (GTK_BOX (hbox), combo); g_signal_connect (combo, "changed", (GCallback) toggle_transitions, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_box_append (GTK_BOX (box), hbox); button = gtk_button_new_with_label ("<"); g_signal_connect (button, "clicked", (GCallback) on_back_button_clicked, stack); g_signal_connect (stack, "notify::visible-child-name", (GCallback)update_back_button_sensitivity, button); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label (">"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", (GCallback) on_forward_button_clicked, stack); g_signal_connect (stack, "notify::visible-child-name", (GCallback)update_forward_button_sensitivity, button); diff --git a/tests/testswitch.c b/tests/testswitch.c index 0a3644ab6b..015700d1f4 100644 --- a/tests/testswitch.c +++ b/tests/testswitch.c @@ -26,12 +26,12 @@ make_switch (gboolean is_on, sw = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (sw), is_on); - gtk_container_add (GTK_CONTAINER (hbox), sw); + gtk_box_append (GTK_BOX (hbox), sw); gtk_widget_set_sensitive (sw, is_sensitive); label = gtk_label_new (is_on ? "Enabled" : "Disabled"); gtk_widget_set_hexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); g_object_bind_property_full (sw, "active", label, "label", @@ -116,18 +116,18 @@ make_delayed_switch (gboolean is_on, sw = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (sw), is_on); - gtk_container_add (GTK_CONTAINER (hbox), sw); + gtk_box_append (GTK_BOX (hbox), sw); gtk_widget_set_sensitive (sw, is_sensitive); g_signal_connect (sw, "state-set", G_CALLBACK (set_state), NULL); spinner = gtk_spinner_new (); - gtk_container_add (GTK_CONTAINER (hbox), spinner); + gtk_box_append (GTK_BOX (hbox), spinner); gtk_widget_set_opacity (spinner, 0.0); label = gtk_label_new (is_on ? "Enabled" : "Disabled"); gtk_widget_set_hexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); g_object_bind_property_full (sw, "active", label, "label", @@ -137,7 +137,7 @@ make_delayed_switch (gboolean is_on, NULL, NULL); check = gtk_check_button_new (); - gtk_container_add (GTK_CONTAINER (hbox), check); + gtk_box_append (GTK_BOX (hbox), check); g_object_bind_property (sw, "state", check, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); @@ -176,19 +176,19 @@ int main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (window), vbox); hbox = make_switch (FALSE, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); hbox = make_switch (TRUE, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); hbox = make_switch (FALSE, FALSE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); hbox = make_switch (TRUE, FALSE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); hbox = make_delayed_switch (FALSE, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); while (!done) g_main_context_iteration (NULL, TRUE); diff --git a/tests/testtextview2.c b/tests/testtextview2.c index b7a2af89c3..9d4b6c9c54 100644 --- a/tests/testtextview2.c +++ b/tests/testtextview2.c @@ -200,7 +200,7 @@ main (int argc, char *argv[]) gtk_widget_set_hexpand (sw, TRUE); gtk_widget_set_vexpand (sw, TRUE); gtk_window_set_child (GTK_WINDOW (window), box); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); tv = gtk_text_view_new (); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); @@ -214,33 +214,33 @@ main (int argc, char *argv[]) box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); g_object_set (box, "margin-start", 10, "margin-end", 10, NULL); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); the_mark = gtk_text_mark_new ("my mark", TRUE); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); mark_check = gtk_check_button_new_with_label ("Mark"); g_signal_connect (mark_check, "notify::active", G_CALLBACK (update_mark_exists), NULL); - gtk_container_add (GTK_CONTAINER (box2), mark_check); + gtk_box_append (GTK_BOX (box2), mark_check); mark_visible = gtk_check_button_new_with_label ("Visible"); g_signal_connect (mark_visible, "notify::active", G_CALLBACK (update_mark_visible), NULL); - gtk_container_add (GTK_CONTAINER (box2), mark_visible); - gtk_container_add (GTK_CONTAINER (box2), gtk_label_new ("Position:")); + gtk_box_append (GTK_BOX (box2), mark_visible); + gtk_box_append (GTK_BOX (box2), gtk_label_new ("Position:")); position_spin = gtk_spin_button_new_with_range (0, len, 1); g_signal_connect (position_spin, "value-changed", G_CALLBACK (update_mark_position), NULL); - gtk_container_add (GTK_CONTAINER (box2), position_spin); + gtk_box_append (GTK_BOX (box2), position_spin); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); g_object_set (box, "margin-start", 10, "margin-end", 10, NULL); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); button = gtk_toggle_button_new_with_label ("Random marks"); g_signal_connect (button, "notify::active", G_CALLBACK (toggle_marks), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_toggle_button_new_with_label ("Wandering cursor"); g_signal_connect (button, "notify::active", G_CALLBACK (toggle_cursor), NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); gtk_widget_show (window); diff --git a/tests/testtoolbar2.c b/tests/testtoolbar2.c index 50698713d8..82343293f9 100644 --- a/tests/testtoolbar2.c +++ b/tests/testtoolbar2.c @@ -16,10 +16,10 @@ int main (int argc, char *argv[]) box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_window_set_child (GTK_WINDOW (window), box); frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (box), frame); + gtk_box_append (GTK_BOX (box), frame); view = gtk_text_view_new (); gtk_widget_set_vexpand (view, TRUE); - gtk_container_add (GTK_CONTAINER (box), view); + gtk_box_append (GTK_BOX (box), view); box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_margin_start (box3, 10); gtk_widget_set_margin_end (box3, 10); @@ -28,11 +28,11 @@ int main (int argc, char *argv[]) gtk_widget_add_css_class (box3, GTK_STYLE_CLASS_LINKED); button = gtk_button_new_from_icon_name ("document-new-symbolic"); - gtk_container_add (GTK_CONTAINER (box3), button); + gtk_box_append (GTK_BOX (box3), button); button = gtk_button_new_from_icon_name ("document-open-symbolic"); - gtk_container_add (GTK_CONTAINER (box3), button); + gtk_box_append (GTK_BOX (box3), button); button = gtk_button_new_from_icon_name ("document-save-symbolic"); - gtk_container_add (GTK_CONTAINER (box3), button); + gtk_box_append (GTK_BOX (box3), button); gtk_frame_set_child (GTK_FRAME (frame), box3); diff --git a/tests/testtooltips.c b/tests/testtooltips.c index f4b384f6dc..10d4ca4083 100644 --- a/tests/testtooltips.c +++ b/tests/testtooltips.c @@ -309,13 +309,13 @@ main (int argc, char *argv[]) gtk_widget_set_margin_top (tooltip, 20); gtk_widget_set_margin_bottom (tooltip, 20); gtk_widget_set_halign (tooltip, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), tooltip); + gtk_box_append (GTK_BOX (box), tooltip); /* A check button using the tooltip-markup property */ button = gtk_check_button_new_with_label ("This one uses the tooltip-markup property"); gtk_widget_set_tooltip_text (button, "Hello, I am a static tooltip."); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); text = gtk_widget_get_tooltip_text (button); markup = gtk_widget_get_tooltip_markup (button); @@ -328,13 +328,13 @@ main (int argc, char *argv[]) g_object_set (button, "has-tooltip", TRUE, NULL); g_signal_connect (button, "query-tooltip", G_CALLBACK (query_tooltip_cb), NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); /* A label */ button = gtk_label_new ("I am just a label"); gtk_label_set_selectable (GTK_LABEL (button), FALSE); gtk_widget_set_tooltip_text (button, "Label & and tooltip"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); text = gtk_widget_get_tooltip_text (button); markup = gtk_widget_get_tooltip_markup (button); @@ -346,7 +346,7 @@ main (int argc, char *argv[]) button = gtk_label_new ("I am a selectable label"); gtk_label_set_selectable (GTK_LABEL (button), TRUE); gtk_widget_set_tooltip_markup (button, "<b>Another</b> Label tooltip"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); text = gtk_widget_get_tooltip_text (button); markup = gtk_widget_get_tooltip_markup (button); @@ -358,7 +358,7 @@ main (int argc, char *argv[]) button = gtk_button_new_with_label ("This one is insensitive"); gtk_widget_set_sensitive (button, FALSE); g_object_set (button, "tooltip-text", "Insensitive!", NULL); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); /* Testcases from Kris without a tree view don't exist. */ tree_view = gtk_tree_view_new_with_model (create_model ()); @@ -381,7 +381,7 @@ main (int argc, char *argv[]) gtk_tree_view_column_set_clickable (column, TRUE); g_object_set (gtk_tree_view_column_get_button (column), "tooltip-text", "Header", NULL); - gtk_container_add (GTK_CONTAINER (box), tree_view); + gtk_box_append (GTK_BOX (box), tree_view); /* And a text view for Matthias */ buffer = gtk_text_buffer_new (NULL); @@ -405,7 +405,7 @@ main (int argc, char *argv[]) g_signal_connect (text_view, "query-tooltip", G_CALLBACK (query_tooltip_text_view_cb), tag); - gtk_container_add (GTK_CONTAINER (box), text_view); + gtk_box_append (GTK_BOX (box), text_view); /* Drawing area */ drawing_area = gtk_drawing_area_new (); @@ -416,12 +416,12 @@ main (int argc, char *argv[]) g_object_set (drawing_area, "has-tooltip", TRUE, NULL); g_signal_connect (drawing_area, "query-tooltip", G_CALLBACK (query_tooltip_drawing_area_cb), NULL); - gtk_container_add (GTK_CONTAINER (box), drawing_area); + gtk_box_append (GTK_BOX (box), drawing_area); button = gtk_menu_button_new (); gtk_widget_set_halign (button, GTK_ALIGN_CENTER); gtk_menu_button_set_label (GTK_MENU_BUTTON (button), "Custom tooltip I"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); popover = gtk_popover_new (); gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); @@ -429,23 +429,23 @@ main (int argc, char *argv[]) button = gtk_label_new ("Hidden here"); custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom")); - gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL)); + gtk_box_append (GTK_BOX (custom), gtk_label_new ("See, custom")); + gtk_box_append (GTK_BOX (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL)); g_object_ref_sink (custom); g_object_set (button, "has-tooltip", TRUE, NULL); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); g_signal_connect (button, "query-tooltip", G_CALLBACK (query_tooltip_label_cb), custom); button = gtk_label_new ("Custom tooltip II"); custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom too")); - gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL)); + gtk_box_append (GTK_BOX (custom), gtk_label_new ("See, custom too")); + gtk_box_append (GTK_BOX (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL)); g_object_ref_sink (custom); g_object_set (button, "has-tooltip", TRUE, NULL); g_signal_connect (button, "query-tooltip", G_CALLBACK (query_tooltip_label_cb), custom); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); /* Done! */ gtk_widget_show (window); diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c index f7bafa571b..3612a9269d 100644 --- a/tests/testtreecolumns.c +++ b/tests/testtreecolumns.c @@ -783,7 +783,7 @@ main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (window), vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Left Pane */ cell = gtk_cell_renderer_text_new (); @@ -800,50 +800,50 @@ main (int argc, char *argv[]) gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); - gtk_container_add (GTK_CONTAINER (hbox), swindow); + gtk_box_append (GTK_BOX (hbox), swindow); /* Middle Pane */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); bbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox2), bbox); + gtk_box_append (GTK_BOX (vbox2), bbox); button = gtk_button_new_with_mnemonic ("<< (_Q)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_mnemonic (">> (_W)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); bbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox2), bbox); + gtk_box_append (GTK_BOX (vbox2), bbox); button = gtk_button_new_with_mnemonic ("<< (_E)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); button = gtk_button_new_with_mnemonic (">> (_R)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); - gtk_container_add (GTK_CONTAINER (bbox), button); + gtk_box_append (GTK_BOX (bbox), button); /* Right Pane */ vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); + gtk_box_append (GTK_BOX (hbox), vbox2); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -858,7 +858,7 @@ main (int argc, char *argv[]) gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), top_right_tree_view); - gtk_container_add (GTK_CONTAINER (vbox2), swindow); + gtk_box_append (GTK_BOX (vbox2), swindow); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -872,7 +872,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 (bottom_right_tree_view), column); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), bottom_right_tree_view); - gtk_container_add (GTK_CONTAINER (vbox2), swindow); + gtk_box_append (GTK_BOX (vbox2), swindow); /* Drag and Drop */ @@ -902,13 +902,13 @@ main (int argc, char *argv[]) GDK_ACTION_MOVE); gdk_content_formats_unref (targets); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_button_new_with_mnemonic ("_Add new Column"); g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_widget_show (window); diff --git a/tests/testtreecolumnsizing.c b/tests/testtreecolumnsizing.c index a9709aae47..71a03a5016 100644 --- a/tests/testtreecolumnsizing.c +++ b/tests/testtreecolumnsizing.c @@ -202,7 +202,7 @@ main (int argc, char **argv) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), BORDER_EXPAND); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), ALL_EXPAND); - gtk_container_add (GTK_CONTAINER (vbox), combo_box); + gtk_box_append (GTK_BOX (vbox), combo_box); /* Scrolled window and tree view */ sw = gtk_scrolled_window_new (NULL, NULL); @@ -210,7 +210,7 @@ main (int argc, char **argv) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), sw); + gtk_box_append (GTK_BOX (vbox), sw); tree_view = gtk_tree_view_new_with_model (create_model ()); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tree_view); @@ -233,7 +233,7 @@ main (int argc, char **argv) button = gtk_toggle_button_new_with_label ("Toggle long content row"); g_signal_connect (button, "toggled", G_CALLBACK (toggle_long_content_row), tree_view); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); /* Set up option menu callback and default item */ g_signal_connect (combo_box, "changed", diff --git a/tests/testtreednd.c b/tests/testtreednd.c index 76483dd6b4..736b071c9a 100644 --- a/tests/testtreednd.c +++ b/tests/testtreednd.c @@ -123,8 +123,8 @@ main (int argc, char *argv[]) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_window_set_child (GTK_WINDOW (window), box); - gtk_container_add (GTK_CONTAINER (box), get_dragsource ()); - gtk_container_add (GTK_CONTAINER (box), get_droptarget ()); + gtk_box_append (GTK_BOX (box), get_dragsource ()); + gtk_box_append (GTK_BOX (box), get_droptarget ()); gtk_widget_show (window); diff --git a/tests/testtreeedit.c b/tests/testtreeedit.c index fb8b4825de..0ed30af13b 100644 --- a/tests/testtreeedit.c +++ b/tests/testtreeedit.c @@ -210,7 +210,7 @@ create_control (GtkWidget *box, gint number, gint cntl, CallbackData *data) checkbutton = gtk_check_button_new_with_label (name); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cntl == CNTL_FIXED); - gtk_container_add (GTK_CONTAINER (box), checkbutton); + gtk_box_append (GTK_BOX (box), checkbutton); g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data); g_free (name); @@ -259,7 +259,7 @@ main (gint argc, gchar **argv) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); tree_model = create_model (); tree_view = gtk_tree_view_new_with_model (tree_model); @@ -364,11 +364,11 @@ main (gint argc, gchar **argv) 800, 250); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Alignment controls */ cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); - gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox); + gtk_box_append (GTK_BOX (hbox), cntl_vbox); create_control (cntl_vbox, 1, CNTL_ALIGN, &callback[0]); create_control (cntl_vbox, 2, CNTL_ALIGN, &callback[1]); @@ -377,7 +377,7 @@ main (gint argc, gchar **argv) /* Expand controls */ cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); - gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox); + gtk_box_append (GTK_BOX (hbox), cntl_vbox); create_control (cntl_vbox, 1, CNTL_EXPAND, &callback[0]); create_control (cntl_vbox, 2, CNTL_EXPAND, &callback[1]); @@ -386,7 +386,7 @@ main (gint argc, gchar **argv) /* Fixed controls */ cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); - gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox); + gtk_box_append (GTK_BOX (hbox), cntl_vbox); create_control (cntl_vbox, 1, CNTL_FIXED, &callback[0]); create_control (cntl_vbox, 2, CNTL_FIXED, &callback[1]); diff --git a/tests/testtreeflow.c b/tests/testtreeflow.c index 10a5894d74..8088e9aaef 100644 --- a/tests/testtreeflow.c +++ b/tests/testtreeflow.c @@ -148,14 +148,14 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Reflow test"); 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_box_append (GTK_BOX (vbox), gtk_label_new ("Incremental Reflow Test")); 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, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); initialize_model (); tree_view = gtk_tree_view_new_with_model (model); @@ -171,9 +171,9 @@ main (int argc, char *argv[]) NULL); 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); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_label_set_use_markup (GTK_LABEL (gtk_button_get_child (GTK_BUTTON (button))), TRUE); g_signal_connect (button, "clicked", G_CALLBACK (futz), NULL); g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL); diff --git a/tests/testtreefocus.c b/tests/testtreefocus.c index 4c4928b9b3..cc071f1a1a 100644 --- a/tests/testtreefocus.c +++ b/tests/testtreefocus.c @@ -364,14 +364,14 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet"); 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_box_append (GTK_BOX (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet")); 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); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); model = make_model (); tree_view = gtk_tree_view_new_with_model (model); @@ -479,14 +479,14 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Model"); 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_box_append (GTK_BOX (vbox), gtk_label_new ("The model revealed")); 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); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); tree_view = gtk_tree_view_new_with_model (model); diff --git a/tests/testtreelistmodel.c b/tests/testtreelistmodel.c index 303951d077..74a312be26 100644 --- a/tests/testtreelistmodel.c +++ b/tests/testtreelistmodel.c @@ -182,7 +182,7 @@ create_widget_for_model (gpointer item, { child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_size_request (child, 16 * depth, 0); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); } if (gtk_tree_list_row_is_expandable (item)) @@ -195,7 +195,7 @@ create_widget_for_model (gpointer item, gtk_button_set_has_frame (GTK_BUTTON (title), FALSE); g_object_bind_property (item, "expanded", title, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); g_object_set_data_full (G_OBJECT (title), "make-sure-its-not-unreffed", g_object_ref (item), g_object_unref); - gtk_container_add (GTK_CONTAINER (child), title); + gtk_box_append (GTK_BOX (child), title); arrow = g_object_new (GTK_TYPE_SPINNER, "css-name", "arrow", NULL); gtk_button_set_child (GTK_BUTTON (title), arrow); @@ -204,7 +204,7 @@ create_widget_for_model (gpointer item, { child = gtk_image_new (); /* empty whatever */ } - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); info = gtk_tree_list_row_get_item (item); @@ -212,14 +212,14 @@ create_widget_for_model (gpointer item, if (icon) { child = gtk_image_new_from_gicon (icon); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); } file = g_object_get_data (G_OBJECT (info), "file"); child = gtk_label_new (g_file_get_basename (file)); g_object_unref (info); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); return row; } @@ -330,15 +330,15 @@ main (int argc, char *argv[]) gtk_window_set_child (GTK_WINDOW (win), vbox); search_entry = gtk_search_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), search_entry); + gtk_box_append (GTK_BOX (vbox), search_entry); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (search_entry), hbox); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); listbox = gtk_list_box_new (); gtk_widget_set_hexpand (listbox, TRUE); - gtk_container_add (GTK_CONTAINER (hbox), listbox); + gtk_box_append (GTK_BOX (hbox), listbox); if (argc > 1) root = g_file_new_for_commandline_arg (argv[1]); @@ -372,14 +372,14 @@ main (int argc, char *argv[]) g_signal_connect (filter, "items-changed", G_CALLBACK (update_adjustment), adjustment); scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, adjustment); - gtk_container_add (GTK_CONTAINER (hbox), scrollbar); + gtk_box_append (GTK_BOX (hbox), scrollbar); statusbar = gtk_statusbar_new (); gtk_widget_add_tick_callback (statusbar, (GtkTickCallback) update_statusbar, NULL, NULL); g_object_set_data (G_OBJECT (statusbar), "model", filter); g_signal_connect_swapped (filter, "items-changed", G_CALLBACK (update_statusbar), statusbar); update_statusbar (GTK_STATUSBAR (statusbar)); - gtk_container_add (GTK_CONTAINER (vbox), statusbar); + gtk_box_append (GTK_BOX (vbox), statusbar); g_object_unref (tree); g_object_unref (filter); diff --git a/tests/testtreesort.c b/tests/testtreesort.c index dbb6ad52df..c4d29c8ed8 100644 --- a/tests/testtreesort.c +++ b/tests/testtreesort.c @@ -122,20 +122,20 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Words, words, words - Window 1"); 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_box_append (GTK_BOX (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_window_set_child (GTK_WINDOW (window), vbox); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); button = gtk_button_new_with_label ("Switch search method"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); scrolled_window = gtk_scrolled_window_new (NULL, NULL); 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_widget_set_vexpand (scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); @@ -250,7 +250,7 @@ main (int argc, char *argv[]) "Words, words, words - window 2"); g_signal_connect (window2, "destroy", G_CALLBACK (quit_cb), &done); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (vbox2), + gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeStore of window 1")); gtk_window_set_child (GTK_WINDOW (window2), vbox2); @@ -260,7 +260,7 @@ main (int argc, char *argv[]) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window2, TRUE); - gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window2); + gtk_box_append (GTK_BOX (vbox2), scrolled_window2); tree_view2 = gtk_tree_view_new_with_model (smodel); @@ -317,7 +317,7 @@ main (int argc, char *argv[]) "Words, words, words - Window 3"); g_signal_connect (window3, "destroy", G_CALLBACK (quit_cb), &done); vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (vbox3), + gtk_box_append (GTK_BOX (vbox3), gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeModelSort of window 2")); gtk_window_set_child (GTK_WINDOW (window3), vbox3); @@ -327,7 +327,7 @@ main (int argc, char *argv[]) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled_window3, TRUE); - gtk_container_add (GTK_CONTAINER (vbox3), scrolled_window3); + gtk_box_append (GTK_BOX (vbox3), scrolled_window3); tree_view3 = gtk_tree_view_new_with_model (ssmodel); diff --git a/tests/testtreeview.c b/tests/testtreeview.c index a14c45040c..58f7ffe91c 100644 --- a/tests/testtreeview.c +++ b/tests/testtreeview.c @@ -722,7 +722,7 @@ main (int argc, for (i = 0; i < MODEL_LAST; i++) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), model_names[i]); - gtk_container_add (GTK_CONTAINER (box), combo_box); + gtk_box_append (GTK_BOX (box), combo_box); g_signal_connect (combo_box, "changed", G_CALLBACK (model_selected), @@ -734,7 +734,7 @@ main (int argc, for (i = 0; i < COLUMNS_LAST; i++) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), column_type_names[i]); - gtk_container_add (GTK_CONTAINER (box), combo_box); + gtk_box_append (GTK_BOX (box), combo_box); set_columns_type (GTK_TREE_VIEW (tv), COLUMNS_LOTS); gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), COLUMNS_LOTS); @@ -751,7 +751,7 @@ main (int argc, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (box), sw); + gtk_box_append (GTK_BOX (box), sw); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); diff --git a/tests/testvolumebutton.c b/tests/testvolumebutton.c index 9c5424ed50..b86577a696 100644 --- a/tests/testvolumebutton.c +++ b/tests/testvolumebutton.c @@ -78,9 +78,9 @@ main (int argc, NULL); 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); + gtk_box_append (GTK_BOX (vbox), box); + gtk_box_append (GTK_BOX (box), button); + gtk_box_append (GTK_BOX (box), button2); gtk_widget_show (window); g_timeout_add (4000, (GSourceFunc) show_error, window); diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c index 3dc684d74c..aead504f9b 100644 --- a/tests/testwidgettransforms.c +++ b/tests/testwidgettransforms.c @@ -321,7 +321,7 @@ main (int argc, char **argv) gtk_button_set_label (GTK_BUTTON (toggle_button), "Picking"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_button), do_picking); g_signal_connect (toggle_button, "toggled", G_CALLBACK (toggled_cb), NULL); - gtk_container_add (GTK_CONTAINER (titlebar), toggle_button); + gtk_box_append (GTK_BOX (titlebar), toggle_button); test_widget = gtk_button_new (); gtk_widget_set_size_request (test_widget, TEST_WIDGET_MIN_SIZE, TEST_WIDGET_MIN_SIZE); @@ -333,14 +333,14 @@ main (int argc, char **argv) gtk_widget_set_halign (test_child, GTK_ALIGN_CENTER); gtk_widget_set_valign (test_child, GTK_ALIGN_CENTER); gtk_widget_set_size_request (test_child, TEST_WIDGET_MIN_SIZE / 2, TEST_WIDGET_MIN_SIZE / 2); - gtk_container_add (GTK_CONTAINER (test_widget), test_child); + gtk_box_append (GTK_BOX (test_widget), test_child); gtk_transform_tester_set_test_widget (GTK_TRANSFORM_TESTER (transform_tester), test_widget); gtk_widget_set_vexpand (transform_tester, TRUE); - gtk_container_add (GTK_CONTAINER (box), transform_tester); - gtk_container_add (GTK_CONTAINER (box), matrix_chooser); + gtk_box_append (GTK_BOX (box), transform_tester); + gtk_box_append (GTK_BOX (box), matrix_chooser); gtk_window_set_child (GTK_WINDOW (window), box); gtk_window_set_default_size ((GtkWindow *)window, 200, 200); diff --git a/tests/testwindowsize.c b/tests/testwindowsize.c index 13f78d21ed..961843cc05 100644 --- a/tests/testwindowsize.c +++ b/tests/testwindowsize.c @@ -56,7 +56,7 @@ show_dialog (void) gtk_window_set_resizable (GTK_WINDOW (dialog), resizable); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label); label = gtk_label_new ("? x ?"); diff --git a/tests/treestoretest.c b/tests/treestoretest.c index bd61bbdbfe..efb2444cee 100644 --- a/tests/treestoretest.c +++ b/tests/treestoretest.c @@ -344,7 +344,7 @@ make_window (gint view_type) /* Put them together */ 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_box_append (GTK_BOX (vbox), scrolled_window); gtk_window_set_child (GTK_WINDOW (window), vbox); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, @@ -353,7 +353,7 @@ make_window (gint view_type) /* buttons */ button = gtk_button_new_with_label ("gtk_tree_store_remove"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), button); @@ -365,9 +365,9 @@ make_window (gint view_type) button = gtk_button_new_with_label ("gtk_tree_store_insert"); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (hbox), button); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), button); + gtk_box_append (GTK_BOX (hbox), entry); g_object_set_data (G_OBJECT (button), "user_data", entry); g_signal_connect (button, "clicked", G_CALLBACK (iter_insert), @@ -376,9 +376,9 @@ make_window (gint view_type) button = gtk_button_new_with_label ("gtk_tree_store_set"); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (hbox), button); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), button); + gtk_box_append (GTK_BOX (hbox), entry); g_object_set_data (G_OBJECT (button), "user_data", entry); g_signal_connect (button, "clicked", G_CALLBACK (iter_change), @@ -387,16 +387,16 @@ make_window (gint view_type) button = gtk_button_new_with_label ("gtk_tree_store_insert_with_values"); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (hbox), button); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), button); + gtk_box_append (GTK_BOX (hbox), entry); g_object_set_data (G_OBJECT (button), "user_data", entry); g_signal_connect (button, "clicked", G_CALLBACK (iter_insert_with_values), tree_view); button = gtk_button_new_with_label ("gtk_tree_store_insert_before"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (iter_insert_before), tree_view); @@ -406,7 +406,7 @@ make_window (gint view_type) gtk_widget_set_sensitive (button, FALSE); button = gtk_button_new_with_label ("gtk_tree_store_insert_after"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (iter_insert_after), tree_view); @@ -416,13 +416,13 @@ make_window (gint view_type) gtk_widget_set_sensitive (button, FALSE); button = gtk_button_new_with_label ("gtk_tree_store_prepend"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (iter_prepend), tree_view); button = gtk_button_new_with_label ("gtk_tree_store_append"); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); g_signal_connect (button, "clicked", G_CALLBACK (iter_append), tree_view); |