diff --git a/demos/constraint-editor/constraint-editor-window.c b/demos/constraint-editor/constraint-editor-window.c index bf18b6acc1..001eab3ba2 100644 --- a/demos/constraint-editor/constraint-editor-window.c +++ b/demos/constraint-editor/constraint-editor-window.c @@ -608,7 +608,7 @@ create_widget_func (gpointer item, gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_hexpand (label, TRUE); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item)) { @@ -616,18 +616,18 @@ create_widget_func (gpointer item, gtk_button_set_has_frame (GTK_BUTTON (button), FALSE); g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win); g_object_set_data (G_OBJECT (row), "edit", button); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); gtk_button_set_has_frame (GTK_BUTTON (button), FALSE); g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } else if (GTK_IS_WIDGET (item)) { button = gtk_button_new_from_icon_name ("edit-delete-symbolic"); gtk_button_set_has_frame (GTK_BUTTON (button), FALSE); g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } g_free (freeme); diff --git a/demos/gtk-demo/assistant.c b/demos/gtk-demo/assistant.c index c1da7b02e6..53bc8db5a4 100644 --- a/demos/gtk-demo/assistant.c +++ b/demos/gtk-demo/assistant.c @@ -95,12 +95,12 @@ create_page1 (GtkWidget *assistant) gtk_widget_set_margin_bottom (box, 12); label = gtk_label_new ("You must fill out this entry to continue:"); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); gtk_widget_set_valign (entry, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (on_entry_changed), assistant); @@ -123,7 +123,7 @@ create_page2 (GtkWidget *assistant) checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue " "even if you do not check this"); gtk_widget_set_valign (checkbutton, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), checkbutton); + gtk_box_append (GTK_BOX (box), checkbutton); gtk_assistant_append_page (GTK_ASSISTANT (assistant), box); gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE); diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c index fbecef7506..45556a2ed6 100644 --- a/demos/gtk-demo/clipboard.c +++ b/demos/gtk-demo/clipboard.c @@ -120,66 +120,66 @@ do_clipboard (GtkWidget *do_widget) label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_widget_set_margin_start (hbox, 8); gtk_widget_set_margin_end (hbox, 8); gtk_widget_set_margin_top (hbox, 8); gtk_widget_set_margin_bottom (hbox, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Create the first entry */ entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); /* Create the button */ button = gtk_button_new_with_mnemonic (_("_Copy")); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", G_CALLBACK (copy_button_clicked), entry); label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_widget_set_margin_start (hbox, 8); gtk_widget_set_margin_end (hbox, 8); gtk_widget_set_margin_top (hbox, 8); gtk_widget_set_margin_bottom (hbox, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Create the second entry */ entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); /* Create the button */ button = gtk_button_new_with_mnemonic (_("_Paste")); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); g_signal_connect (button, "clicked", G_CALLBACK (paste_button_clicked), entry); label = gtk_label_new ("Images can be transferred via the clipboard, too"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_widget_set_margin_start (hbox, 8); gtk_widget_set_margin_end (hbox, 8); gtk_widget_set_margin_top (hbox, 8); gtk_widget_set_margin_bottom (hbox, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Create the first image */ image = demo_image_new ("dialog-warning"); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); /* Create the second image */ image = demo_image_new ("process-stop"); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); /* Create the third image */ image = demo_image_new ("weather-clear"); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c index 2be94b3c8c..3ed180a9b5 100644 --- a/demos/gtk-demo/combobox.c +++ b/demos/gtk-demo/combobox.c @@ -328,7 +328,7 @@ do_combobox (GtkWidget *do_widget) * insensitive rows */ frame = gtk_frame_new ("Items with icons"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_margin_start (box, 5); @@ -340,7 +340,7 @@ do_combobox (GtkWidget *do_widget) model = create_icon_store (); combo = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); @@ -372,7 +372,7 @@ do_combobox (GtkWidget *do_widget) /* A combobox demonstrating trees. */ frame = gtk_frame_new ("Where are we ?"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_margin_start (box, 5); @@ -384,7 +384,7 @@ do_combobox (GtkWidget *do_widget) model = create_capital_store (); combo = gtk_combo_box_new_with_model (model); g_object_unref (model); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); @@ -403,7 +403,7 @@ do_combobox (GtkWidget *do_widget) /* A GtkComboBoxEntry with validation */ frame = gtk_frame_new ("Editable"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_margin_start (box, 5); @@ -414,7 +414,7 @@ do_combobox (GtkWidget *do_widget) combo = gtk_combo_box_text_new_with_entry (); fill_combo_entry (combo); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); entry = g_object_new (TYPE_MASK_ENTRY, NULL); MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$"; @@ -423,7 +423,7 @@ do_combobox (GtkWidget *do_widget) /* A combobox with string IDs */ frame = gtk_frame_new ("String IDs"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_margin_start (box, 5); @@ -436,13 +436,13 @@ do_combobox (GtkWidget *do_widget) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible"); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); entry = gtk_entry_new (); g_object_bind_property (combo, "active-id", entry, "text", G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c index b6c5df0bd3..fc6eb5d72b 100644 --- a/demos/gtk-demo/constraints.c +++ b/demos/gtk-demo/constraints.c @@ -271,10 +271,10 @@ do_constraints (GtkWidget *do_widget) grid = g_object_new (simple_grid_get_type (), NULL); gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); - gtk_container_add (GTK_CONTAINER (box), grid); + gtk_box_append (GTK_BOX (box), grid); button = gtk_button_new_with_label ("Close"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_widget_set_hexpand (grid, TRUE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints2.c index 2a9477e048..0e2502505a 100644 --- a/demos/gtk-demo/constraints2.c +++ b/demos/gtk-demo/constraints2.c @@ -227,10 +227,10 @@ do_constraints2 (GtkWidget *do_widget) grid = g_object_new (interactive_grid_get_type (), NULL); gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); - gtk_container_add (GTK_CONTAINER (box), grid); + gtk_box_append (GTK_BOX (box), grid); button = gtk_button_new_with_label ("Close"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_widget_set_hexpand (grid, TRUE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints3.c index 0edc5b8ebd..64d484abb6 100644 --- a/demos/gtk-demo/constraints3.c +++ b/demos/gtk-demo/constraints3.c @@ -147,10 +147,10 @@ do_constraints3 (GtkWidget *do_widget) grid = g_object_new (vfl_grid_get_type (), NULL); gtk_widget_set_hexpand (grid, TRUE); gtk_widget_set_vexpand (grid, TRUE); - gtk_container_add (GTK_CONTAINER (box), grid); + gtk_box_append (GTK_BOX (box), grid); button = gtk_button_new_with_label ("Close"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_widget_set_hexpand (grid, TRUE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c index c81047b3cc..45e3538803 100644 --- a/demos/gtk-demo/css_accordion.c +++ b/demos/gtk-demo/css_accordion.c @@ -9,9 +9,13 @@ static void apply_css (GtkWidget *widget, GtkStyleProvider *provider) { + GtkWidget *child; + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); - if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + apply_css (child, provider); } GtkWidget * @@ -36,22 +40,22 @@ do_css_accordion (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), container); child = gtk_button_new_with_label ("This"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new_with_label ("Is"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new_with_label ("A"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new_with_label ("CSS"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new_with_label ("Accordion"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new_with_label (":-)"); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css"); diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c index fed09bb1e5..cd51fc9d76 100644 --- a/demos/gtk-demo/css_basics.c +++ b/demos/gtk-demo/css_basics.c @@ -55,9 +55,13 @@ css_text_changed (GtkTextBuffer *buffer, static void apply_css (GtkWidget *widget, GtkStyleProvider *provider) { + GtkWidget *child; + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); - if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + apply_css (child, provider); } GtkWidget * @@ -93,7 +97,7 @@ do_css_basics (GtkWidget *do_widget) container = gtk_scrolled_window_new (NULL, NULL); gtk_window_set_child (GTK_WINDOW (window), container); child = gtk_text_view_new_with_buffer (text); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); g_signal_connect (text, "changed", G_CALLBACK (css_text_changed), provider); diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c index f9a66a5b35..55af50c00c 100644 --- a/demos/gtk-demo/css_multiplebgs.c +++ b/demos/gtk-demo/css_multiplebgs.c @@ -69,9 +69,13 @@ drawing_area_draw (GtkDrawingArea *da, static void apply_css (GtkWidget *widget, GtkStyleProvider *provider) { + GtkWidget *child; + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); - if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + apply_css (child, provider); } GtkWidget * @@ -100,7 +104,7 @@ do_css_multiplebgs (GtkWidget *do_widget) gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (child), drawing_area_draw, NULL, NULL); - gtk_container_add (GTK_CONTAINER (container), child); + gtk_box_append (GTK_BOX (container), child); child = gtk_button_new (); gtk_overlay_add_overlay (GTK_OVERLAY (container), child); diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c index b05e208edc..88dd41e8fd 100644 --- a/demos/gtk-demo/css_pixbufs.c +++ b/demos/gtk-demo/css_pixbufs.c @@ -55,9 +55,13 @@ css_text_changed (GtkTextBuffer *buffer, static void apply_css (GtkWidget *widget, GtkStyleProvider *provider) { + GtkWidget *child; + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); - if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + apply_css (child, provider); } GtkWidget * diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c index ba94b888f2..54c6a3c4c8 100644 --- a/demos/gtk-demo/css_shadows.c +++ b/demos/gtk-demo/css_shadows.c @@ -53,9 +53,13 @@ css_text_changed (GtkTextBuffer *buffer, static void apply_css (GtkWidget *widget, GtkStyleProvider *provider) { + GtkWidget *child; + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT); - if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider); + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + apply_css (child, provider); } static GtkWidget * @@ -68,13 +72,13 @@ create_toolbar (void) gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER); item = gtk_button_new_from_icon_name ("go-next"); - gtk_container_add (GTK_CONTAINER (toolbar), item); + gtk_box_append (GTK_BOX (toolbar), item); item = gtk_button_new_from_icon_name ("go-previous"); - gtk_container_add (GTK_CONTAINER (toolbar), item); + gtk_box_append (GTK_BOX (toolbar), item); item = gtk_button_new_with_label ("Hello World"); - gtk_container_add (GTK_CONTAINER (toolbar), item); + gtk_box_append (GTK_BOX (toolbar), item); return toolbar; } diff --git a/demos/gtk-demo/demotaggedentry.c b/demos/gtk-demo/demotaggedentry.c index ba2b348839..ed92460e0c 100644 --- a/demos/gtk-demo/demotaggedentry.c +++ b/demos/gtk-demo/demotaggedentry.c @@ -49,7 +49,7 @@ demo_tagged_entry_init (DemoTaggedEntry *entry) gtk_widget_set_vexpand (priv->entry, TRUE); gtk_widget_set_hexpand (priv->box, FALSE); gtk_widget_set_vexpand (priv->box, FALSE); - gtk_container_add (GTK_CONTAINER (priv->box), priv->entry); + gtk_box_append (GTK_BOX (priv->box), priv->entry); gtk_editable_init_delegate (GTK_EDITABLE (entry)); } @@ -188,7 +188,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry, g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); - gtk_container_add (GTK_CONTAINER (priv->box), tag); + gtk_box_append (GTK_BOX (priv->box), tag); } void @@ -201,7 +201,7 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry, g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); if (sibling == NULL) - gtk_container_add (GTK_CONTAINER (priv->box), tag); + gtk_box_append (GTK_BOX (priv->box), tag); else gtk_box_insert_child_after (GTK_BOX (priv->box), tag, sibling); } @@ -214,7 +214,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry, g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry)); - gtk_container_remove (GTK_CONTAINER (priv->box), tag); + gtk_box_remove (GTK_BOX (priv->box), tag); } struct _DemoTaggedEntryTag @@ -268,7 +268,7 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag) tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_parent (tag->box, GTK_WIDGET (tag)); tag->label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (tag->box), tag->label); + gtk_box_append (GTK_BOX (tag->box), tag->label); gesture = gtk_gesture_click_new (); g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag); @@ -460,7 +460,7 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag, if (!has_close_button && tag->button) { - gtk_container_remove (GTK_CONTAINER (tag->box), tag->button); + gtk_box_remove (GTK_BOX (tag->box), tag->button); tag->button = NULL; } else if (has_close_button && tag->button == NULL) @@ -469,11 +469,11 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag, image = gtk_image_new_from_icon_name ("window-close-symbolic"); tag->button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (tag->button), image); + gtk_box_append (GTK_BOX (tag->button), image); gtk_widget_set_halign (tag->button, GTK_ALIGN_CENTER); gtk_widget_set_valign (tag->button, GTK_ALIGN_CENTER); gtk_button_set_has_frame (GTK_BUTTON (tag->button), FALSE); - gtk_container_add (GTK_CONTAINER (tag->box), tag->button); + gtk_box_append (GTK_BOX (tag->box), tag->button); g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag); } diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c index 673a6e21f2..99953a5cb5 100644 --- a/demos/gtk-demo/dialog.c +++ b/demos/gtk-demo/dialog.c @@ -56,16 +56,16 @@ interactive_dialog_clicked (GtkButton *button, content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); - gtk_container_add (GTK_CONTAINER (content_area), hbox); + gtk_box_append (GTK_BOX (content_area), hbox); image = gtk_image_new_from_icon_name ("dialog-question"); gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE); - gtk_container_add (GTK_CONTAINER (hbox), image); + gtk_box_append (GTK_BOX (hbox), image); table = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (table), 4); gtk_grid_set_column_spacing (GTK_GRID (table), 4); - gtk_container_add (GTK_CONTAINER (hbox), table); + gtk_box_append (GTK_BOX (hbox), table); label = gtk_label_new_with_mnemonic ("_Entry 1"); gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1); local_entry1 = gtk_entry_new (); @@ -127,29 +127,29 @@ do_dialog (GtkWidget *do_widget) /* Standard message dialog */ 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 ("_Message Dialog"); g_signal_connect (button, "clicked", G_CALLBACK (message_dialog_clicked), NULL); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); - gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); /* Interactive dialog*/ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); button = gtk_button_new_with_mnemonic ("_Interactive Dialog"); g_signal_connect (button, "clicked", G_CALLBACK (interactive_dialog_clicked), NULL); - gtk_container_add (GTK_CONTAINER (hbox), vbox2); - gtk_container_add (GTK_CONTAINER (vbox2), button); + gtk_box_append (GTK_BOX (hbox), vbox2); + gtk_box_append (GTK_BOX (vbox2), button); table = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (table), 4); gtk_grid_set_column_spacing (GTK_GRID (table), 4); - gtk_container_add (GTK_CONTAINER (hbox), table); + gtk_box_append (GTK_BOX (hbox), table); label = gtk_label_new_with_mnemonic ("_Entry 1"); gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1); diff --git a/demos/gtk-demo/dnd.c b/demos/gtk-demo/dnd.c index ac9a8ab9f1..a3445e774f 100644 --- a/demos/gtk-demo/dnd.c +++ b/demos/gtk-demo/dnd.c @@ -204,30 +204,30 @@ pressed_cb (GtkGesture *gesture, gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE); gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1}); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (menu), box); + gtk_box_append (GTK_BOX (menu), box); item = gtk_button_new_with_label ("New"); gtk_button_set_has_frame (GTK_BUTTON (item), FALSE); g_signal_connect (item, "clicked", G_CALLBACK (new_item_cb), widget); - gtk_container_add (GTK_CONTAINER (box), item); + gtk_box_append (GTK_BOX (box), item); item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box), item); + gtk_box_append (GTK_BOX (box), item); item = gtk_button_new_with_label ("Edit"); gtk_button_set_has_frame (GTK_BUTTON (item), FALSE); gtk_widget_set_sensitive (item, child != NULL && child != widget); g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child); - gtk_container_add (GTK_CONTAINER (box), item); + gtk_box_append (GTK_BOX (box), item); item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box), item); + gtk_box_append (GTK_BOX (box), item); item = gtk_button_new_with_label ("Delete"); gtk_button_set_has_frame (GTK_BUTTON (item), FALSE); gtk_widget_set_sensitive (item, child != NULL && child != widget); g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child); - gtk_container_add (GTK_CONTAINER (box), item); + gtk_box_append (GTK_BOX (box), item); gtk_popover_popup (GTK_POPOVER (menu)); } @@ -444,10 +444,10 @@ do_dnd (GtkWidget *do_widget) 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); n_items = 0; @@ -468,7 +468,7 @@ do_dnd (GtkWidget *do_widget) 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"); @@ -485,7 +485,7 @@ do_dnd (GtkWidget *do_widget) "rgba", &rgba, "selectable", FALSE, NULL); - gtk_container_add (GTK_CONTAINER (box3), swatch); + gtk_box_append (GTK_BOX (box3), swatch); } } diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c index 4309d99573..63e4bd6812 100644 --- a/demos/gtk-demo/drawingarea.c +++ b/demos/gtk-demo/drawingarea.c @@ -213,11 +213,11 @@ do_drawingarea (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Checkerboard pattern"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_vexpand (frame, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); da = gtk_drawing_area_new (); gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100); @@ -232,11 +232,11 @@ do_drawingarea (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Scribble area"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_vexpand (frame, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); da = gtk_drawing_area_new (); gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100); diff --git a/demos/gtk-demo/editable_cells.c b/demos/gtk-demo/editable_cells.c index 05ed5fe7ba..ef6ead843f 100644 --- a/demos/gtk-demo/editable_cells.c +++ b/demos/gtk-demo/editable_cells.c @@ -361,7 +361,7 @@ do_editable_cells (GtkWidget *do_widget) gtk_widget_set_margin_bottom (vbox, 5); gtk_window_set_child (GTK_WINDOW (window), vbox); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Shopping list (you can edit the cells!)")); sw = gtk_scrolled_window_new (NULL, NULL); @@ -369,7 +369,7 @@ do_editable_cells (GtkWidget *do_widget) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (vbox), sw); + gtk_box_append (GTK_BOX (vbox), sw); /* create models */ items_model = create_items_model (); @@ -391,17 +391,17 @@ do_editable_cells (GtkWidget *do_widget) /* some buttons */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); button = gtk_button_new_with_label ("Add item"); g_signal_connect (button, "clicked", G_CALLBACK (add_item), treeview); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); button = gtk_button_new_with_label ("Remove item"); g_signal_connect (button, "clicked", G_CALLBACK (remove_item), treeview); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_window_set_default_size (GTK_WINDOW (window), 320, 200); } diff --git a/demos/gtk-demo/entry_completion.c b/demos/gtk-demo/entry_completion.c index 6a23b78d67..6e2d28400c 100644 --- a/demos/gtk-demo/entry_completion.c +++ b/demos/gtk-demo/entry_completion.c @@ -61,11 +61,11 @@ do_entry_completion (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing total or gnome for example."); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Create our entry */ entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); /* Create the completion object */ completion = gtk_entry_completion_new (); diff --git a/demos/gtk-demo/entry_undo.c b/demos/gtk-demo/entry_undo.c index 39bebb8d30..752d87849c 100644 --- a/demos/gtk-demo/entry_undo.c +++ b/demos/gtk-demo/entry_undo.c @@ -37,12 +37,12 @@ do_entry_undo (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Use Primary+z or Primary+Shift+z to undo or redo changes"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Create our entry */ entry = gtk_entry_new (); gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), entry); + gtk_box_append (GTK_BOX (vbox), entry); } if (!gtk_widget_get_visible (window)) diff --git a/demos/gtk-demo/expander.c b/demos/gtk-demo/expander.c index 63ef27081d..46ccff1833 100644 --- a/demos/gtk-demo/expander.c +++ b/demos/gtk-demo/expander.c @@ -79,8 +79,8 @@ do_expander (GtkWidget *do_widget) "innuendo, just to make you scroll down or " "resize the window. Do it already !", -1); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); - gtk_container_add (GTK_CONTAINER (expander), sw); - gtk_container_add (GTK_CONTAINER (area), expander); + gtk_box_append (GTK_BOX (expander), sw); + gtk_box_append (GTK_BOX (area), expander); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_cb), window); diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c index 07f343e70e..98370776ea 100644 --- a/demos/gtk-demo/font_features.c +++ b/demos/gtk-demo/font_features.c @@ -194,7 +194,7 @@ add_check_group (GtkWidget *box, pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); - gtk_container_add (GTK_CONTAINER (group), label); + gtk_box_append (GTK_BOX (group), label); for (i = 0; tags[i]; i++) { @@ -211,7 +211,7 @@ add_check_group (GtkWidget *box, g_signal_connect (feat, "notify::inconsistent", G_CALLBACK (update_display), NULL); g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL); - gtk_container_add (GTK_CONTAINER (group), feat); + gtk_box_append (GTK_BOX (group), feat); item = g_new (FeatureItem, 1); item->name = tags[i]; @@ -223,7 +223,7 @@ add_check_group (GtkWidget *box, feature_items = g_list_prepend (feature_items, item); } - gtk_container_add (GTK_CONTAINER (box), group); + gtk_box_append (GTK_BOX (box), group); } static void @@ -248,7 +248,7 @@ add_radio_group (GtkWidget *box, pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); - gtk_container_add (GTK_CONTAINER (group), label); + gtk_box_append (GTK_BOX (group), label); for (i = 0; tags[i]; i++) { @@ -268,7 +268,7 @@ add_radio_group (GtkWidget *box, g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL); g_object_set_data (G_OBJECT (feat), "default", group_button); - gtk_container_add (GTK_CONTAINER (group), feat); + gtk_box_append (GTK_BOX (group), feat); item = g_new (FeatureItem, 1); item->name = tags[i]; @@ -280,7 +280,7 @@ add_radio_group (GtkWidget *box, feature_items = g_list_prepend (feature_items, item); } - gtk_container_add (GTK_CONTAINER (box), group); + gtk_box_append (GTK_BOX (box), group); } static void diff --git a/demos/gtk-demo/gears.c b/demos/gtk-demo/gears.c index e7a198e55b..54dfa5f0f3 100644 --- a/demos/gtk-demo/gears.c +++ b/demos/gtk-demo/gears.c @@ -53,7 +53,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); gtk_widget_show (label); adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0); @@ -63,7 +63,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); gtk_widget_show (slider); @@ -111,19 +111,19 @@ do_gears (GtkWidget *do_widget) 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); gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label)); } diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c index 8de86d1765..5c2fb898c3 100644 --- a/demos/gtk-demo/glarea.c +++ b/demos/gtk-demo/glarea.c @@ -354,7 +354,7 @@ create_axis_slider (int axis) } label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_widget_show (label); adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0); @@ -362,7 +362,7 @@ create_axis_slider (int axis) 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); gtk_widget_show (slider); @@ -406,7 +406,7 @@ create_glarea_window (GtkWidget *do_widget) 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); /* We need to initialize and free GL resources, so we use * the realize and unrealize signals on the widget @@ -418,15 +418,15 @@ create_glarea_window (GtkWidget *do_widget) 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); return window; diff --git a/demos/gtk-demo/headerbar.c b/demos/gtk-demo/headerbar.c index 7f1acfa652..dcb15a51c7 100644 --- a/demos/gtk-demo/headerbar.c +++ b/demos/gtk-demo/headerbar.c @@ -43,10 +43,10 @@ do_headerbar (GtkWidget *do_widget) gtk_widget_add_css_class (box, "linked"); button = gtk_button_new (); gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic")); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new (); gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic")); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box); diff --git a/demos/gtk-demo/iconview.c b/demos/gtk-demo/iconview.c index 45dc455e41..f214013c78 100644 --- a/demos/gtk-demo/iconview.c +++ b/demos/gtk-demo/iconview.c @@ -266,14 +266,14 @@ do_iconview (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), vbox); tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), tool_bar); + gtk_box_append (GTK_BOX (vbox), tool_bar); up_button = gtk_button_new_with_mnemonic ("_Up"); gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE); - gtk_container_add (GTK_CONTAINER (tool_bar), up_button); + gtk_box_append (GTK_BOX (tool_bar), up_button); home_button = gtk_button_new_with_mnemonic ("_Home"); - gtk_container_add (GTK_CONTAINER (tool_bar), home_button); + gtk_box_append (GTK_BOX (tool_bar), home_button); sw = gtk_scrolled_window_new (NULL, NULL); @@ -283,7 +283,7 @@ do_iconview (GtkWidget *do_widget) GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (sw, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), sw); + gtk_box_append (GTK_BOX (vbox), sw); /* Create the store and fill it with the contents of '/' */ parent = g_strdup ("/"); diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c index 8dc68de316..90684bc0ed 100644 --- a/demos/gtk-demo/images.c +++ b/demos/gtk-demo/images.c @@ -293,24 +293,16 @@ static void toggle_sensitivity_callback (GtkWidget *togglebutton, gpointer user_data) { - GtkContainer *container = user_data; - GList *list; - GList *tmp; + GtkWidget *child; - list = gtk_container_get_children (container); - - tmp = list; - while (tmp != NULL) + for (child = gtk_widget_get_first_child (GTK_WIDGET (user_data)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { /* don't disable our toggle */ - if (GTK_WIDGET (tmp->data) != togglebutton) - gtk_widget_set_sensitive (GTK_WIDGET (tmp->data), - !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton))); - - tmp = tmp->next; + if (child != togglebutton) + gtk_widget_set_sensitive (child, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton))); } - - g_list_free (list); } @@ -348,20 +340,20 @@ do_images (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), base_vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16); - gtk_container_add (GTK_CONTAINER (base_vbox), hbox); + gtk_box_append (GTK_BOX (base_vbox), hbox); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Image loaded from a file"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); image = gtk_image_new_from_icon_name ("gtk3-demo"); gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE); @@ -374,12 +366,12 @@ do_images (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Animation loaded from a file"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif"); @@ -390,12 +382,12 @@ do_images (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Symbolic themed icon"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic"); image = gtk_image_new_from_gicon (gicon); @@ -406,17 +398,17 @@ do_images (GtkWidget *do_widget) /* Progressive */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Progressive image loading"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); /* Create an empty image for now; the progressive loader * will create the pixbuf and fill it in. @@ -428,17 +420,17 @@ do_images (GtkWidget *do_widget) /* Video */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Displaying video"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); frame = gtk_frame_new (NULL); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); video = gtk_video_new_for_resource ("/images/gtk-logo.webm"); gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE); @@ -446,22 +438,22 @@ do_images (GtkWidget *do_widget) /* Widget paintables */ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "GtkWidgetPaintable"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); paintable = gtk_widget_paintable_new (do_widget); picture = gtk_picture_new_for_paintable (paintable); gtk_widget_set_size_request (picture, 100, 100); gtk_widget_set_valign (picture, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (vbox), picture); + gtk_box_append (GTK_BOX (vbox), picture); /* Sensitivity control */ button = gtk_toggle_button_new_with_mnemonic ("_Insensitive"); - gtk_container_add (GTK_CONTAINER (base_vbox), button); + gtk_box_append (GTK_BOX (base_vbox), button); g_signal_connect (button, "toggled", G_CALLBACK (toggle_sensitivity_callback), diff --git a/demos/gtk-demo/infobar.c b/demos/gtk-demo/infobar.c index 12fbe71c5b..786babbec6 100644 --- a/demos/gtk-demo/infobar.c +++ b/demos/gtk-demo/infobar.c @@ -66,73 +66,73 @@ do_infobar (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), vbox); bar = gtk_info_bar_new (); - gtk_container_add (GTK_CONTAINER (vbox), bar); + gtk_box_append (GTK_BOX (vbox), bar); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO); label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0); - gtk_container_add (GTK_CONTAINER (bar), label); + gtk_box_append (GTK_BOX (bar), label); button = gtk_toggle_button_new_with_label ("Message"); g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (actions), button); + gtk_box_append (GTK_BOX (actions), button); bar = gtk_info_bar_new (); - gtk_container_add (GTK_CONTAINER (vbox), bar); + gtk_box_append (GTK_BOX (vbox), bar); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING); label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0); - gtk_container_add (GTK_CONTAINER (bar), label); + gtk_box_append (GTK_BOX (bar), label); button = gtk_toggle_button_new_with_label ("Warning"); g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (actions), button); + gtk_box_append (GTK_BOX (actions), button); bar = gtk_info_bar_new_with_buttons (_("_OK"), GTK_RESPONSE_OK, NULL); gtk_info_bar_set_show_close_button (GTK_INFO_BAR (bar), TRUE); g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window); - gtk_container_add (GTK_CONTAINER (vbox), bar); + gtk_box_append (GTK_BOX (vbox), bar); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION); label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0); - gtk_container_add (GTK_CONTAINER (bar), label); + gtk_box_append (GTK_BOX (bar), label); gtk_info_bar_set_default_response (GTK_INFO_BAR (bar), GTK_RESPONSE_OK); button = gtk_toggle_button_new_with_label ("Question"); g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (actions), button); + gtk_box_append (GTK_BOX (actions), button); bar = gtk_info_bar_new (); - gtk_container_add (GTK_CONTAINER (vbox), bar); + gtk_box_append (GTK_BOX (vbox), bar); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR); label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0); - gtk_container_add (GTK_CONTAINER (bar), label); + gtk_box_append (GTK_BOX (bar), label); button = gtk_toggle_button_new_with_label ("Error"); g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (actions), button); + gtk_box_append (GTK_BOX (actions), button); bar = gtk_info_bar_new (); - gtk_container_add (GTK_CONTAINER (vbox), bar); + gtk_box_append (GTK_BOX (vbox), bar); gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER); label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER"); gtk_label_set_wrap (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0); - gtk_container_add (GTK_CONTAINER (bar), label); + gtk_box_append (GTK_BOX (bar), label); button = gtk_toggle_button_new_with_label ("Other"); g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (actions), button); + gtk_box_append (GTK_BOX (actions), button); frame = gtk_frame_new ("An example of different info bars"); gtk_widget_set_margin_top (frame, 8); gtk_widget_set_margin_bottom (frame, 8); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); gtk_widget_set_halign (actions, GTK_ALIGN_CENTER); diff --git a/demos/gtk-demo/list_store.c b/demos/gtk-demo/list_store.c index da9e9d18d8..9a196dcb09 100644 --- a/demos/gtk-demo/list_store.c +++ b/demos/gtk-demo/list_store.c @@ -267,14 +267,14 @@ do_list_store (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), vbox); label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though)."); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (vbox), sw); + gtk_box_append (GTK_BOX (vbox), sw); /* create tree model */ model = create_model (); diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c index ae67cf91df..69cbb8b334 100644 --- a/demos/gtk-demo/listbox.c +++ b/demos/gtk-demo/listbox.c @@ -357,11 +357,11 @@ do_listbox (GtkWidget *do_widget) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_window_set_child (GTK_WINDOW (window), vbox); label = gtk_label_new ("Messages from GTK and friends"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_widget_set_vexpand (scrolled, TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled); + gtk_box_append (GTK_BOX (vbox), scrolled); listbox = gtk_list_box_new (); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox); diff --git a/demos/gtk-demo/overlay.c b/demos/gtk-demo/overlay.c index 61037b3401..425caf1469 100644 --- a/demos/gtk-demo/overlay.c +++ b/demos/gtk-demo/overlay.c @@ -66,7 +66,7 @@ do_overlay (GtkWidget *do_widget) gtk_widget_set_can_target (label, FALSE); 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); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox); @@ -76,7 +76,7 @@ do_overlay (GtkWidget *do_widget) gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number"); 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 (window), overlay); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); diff --git a/demos/gtk-demo/panes.c b/demos/gtk-demo/panes.c index f47cc32b60..e756a181e3 100644 --- a/demos/gtk-demo/panes.c +++ b/demos/gtk-demo/panes.c @@ -128,7 +128,7 @@ do_panes (GtkWidget *do_widget) gtk_widget_set_margin_end (vpaned, 5); gtk_widget_set_margin_top (vpaned, 5); gtk_widget_set_margin_bottom (vpaned, 5); - 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); @@ -150,13 +150,13 @@ do_panes (GtkWidget *do_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", diff --git a/demos/gtk-demo/password_entry.c b/demos/gtk-demo/password_entry.c index 478bcf2c08..fd72e148a8 100644 --- a/demos/gtk-demo/password_entry.c +++ b/demos/gtk-demo/password_entry.c @@ -61,7 +61,7 @@ do_password_entry (GtkWidget *do_widget) "activates-default", TRUE, NULL); g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); entry2 = gtk_password_entry_new (); gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry2), TRUE); @@ -70,7 +70,7 @@ do_password_entry (GtkWidget *do_widget) "activates-default", TRUE, NULL); g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL); - gtk_container_add (GTK_CONTAINER (box), entry2); + gtk_box_append (GTK_BOX (box), entry2); button = gtk_button_new_with_mnemonic ("_Done"); gtk_widget_add_css_class (button, "suggested-action"); diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c index a387a6cf7f..0af45dc017 100644 --- a/demos/gtk-demo/rotated_text.c +++ b/demos/gtk-demo/rotated_text.c @@ -188,7 +188,7 @@ do_rotated_text (GtkWidget *do_widget) /* Add a drawing area */ drawing_area = gtk_drawing_area_new (); - gtk_container_add (GTK_CONTAINER (box), drawing_area); + gtk_box_append (GTK_BOX (box), drawing_area); gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), @@ -197,7 +197,7 @@ do_rotated_text (GtkWidget *do_widget) /* And a label */ label = gtk_label_new (text); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); /* Set up fancy stuff on the label */ layout = gtk_label_get_layout (GTK_LABEL (label)); diff --git a/demos/gtk-demo/search_entry.c b/demos/gtk-demo/search_entry.c index c48e88b3b3..aa3872b858 100644 --- a/demos/gtk-demo/search_entry.c +++ b/demos/gtk-demo/search_entry.c @@ -273,23 +273,23 @@ do_search_entry (GtkWidget *do_widget) label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "Search entry demo"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), hbox); /* Create our entry */ entry = gtk_entry_new (); gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, "edit-find-symbolic"); - gtk_container_add (GTK_CONTAINER (hbox), entry); + gtk_box_append (GTK_BOX (hbox), entry); /* Create the find and cancel buttons */ notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); - gtk_container_add (GTK_CONTAINER (hbox), notebook); + gtk_box_append (GTK_BOX (hbox), notebook); find_button = gtk_button_new_with_label ("Find"); g_signal_connect (find_button, "clicked", diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c index a2033d1e8b..29d417adf1 100644 --- a/demos/gtk-demo/search_entry2.c +++ b/demos/gtk-demo/search_entry2.c @@ -81,38 +81,38 @@ do_search_entry2 (GtkWidget *do_widget) entry = gtk_search_entry_new (); container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_widget_set_halign (container, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (container), entry); + gtk_box_append (GTK_BOX (container), entry); searchbar = gtk_search_bar_new (); gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_EDITABLE (entry)); gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE); gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container); - gtk_container_add (GTK_CONTAINER (vbox), searchbar); + gtk_box_append (GTK_BOX (vbox), searchbar); /* Hook the search bar to key presses */ gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), window); /* Help */ label = gtk_label_new ("Start Typing to search"); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Toggle button */ button = gtk_toggle_button_new_with_label ("Search"); g_object_bind_property (button, "active", searchbar, "search-mode-enabled", G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); /* Result */ 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 ("Result:"); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_margin_start (label, 6); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); g_signal_connect (entry, "search-changed", G_CALLBACK (search_changed_cb), label); @@ -120,15 +120,15 @@ do_search_entry2 (GtkWidget *do_widget) G_CALLBACK (changed_cb), label); 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 ("Signal:"); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_margin_start (label, 6); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); g_signal_connect (entry, "search-changed", G_CALLBACK (search_changed), label); diff --git a/demos/gtk-demo/sidebar.c b/demos/gtk-demo/sidebar.c index 965c6d7598..4ff4aa17b9 100644 --- a/demos/gtk-demo/sidebar.c +++ b/demos/gtk-demo/sidebar.c @@ -47,14 +47,14 @@ do_sidebar (GtkWidget *do_widget) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); sidebar = gtk_stack_sidebar_new (); - gtk_container_add (GTK_CONTAINER (box), sidebar); + gtk_box_append (GTK_BOX (box), sidebar); stack = gtk_stack_new (); gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN); gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack)); gtk_widget_set_hexpand (stack, TRUE); - gtk_container_add (GTK_CONTAINER (box), stack); + gtk_box_append (GTK_BOX (box), stack); for (i=0; (c = *(pages+i)) != NULL; i++ ) { diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c index e61d5ac758..a3e3547b8b 100644 --- a/demos/gtk-demo/sizegroup.c +++ b/demos/gtk-demo/sizegroup.c @@ -118,7 +118,7 @@ do_sizegroup (GtkWidget *do_widget) /* Create one frame holding color options */ frame = gtk_frame_new ("Color Options"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); table = gtk_grid_new (); gtk_widget_set_margin_start (table, 5); @@ -134,7 +134,7 @@ do_sizegroup (GtkWidget *do_widget) /* And another frame holding line style options */ frame = gtk_frame_new ("Line Options"); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); table = gtk_grid_new (); gtk_widget_set_margin_start (table, 5); @@ -150,7 +150,7 @@ do_sizegroup (GtkWidget *do_widget) /* And a check button to turn grouping on and off */ check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping"); - gtk_container_add (GTK_CONTAINER (vbox), check_button); + gtk_box_append (GTK_BOX (vbox), check_button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); g_signal_connect (check_button, "toggled", diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c index 09e8c4bdbd..dbe8129e60 100644 --- a/demos/gtk-demo/sliding_puzzle.c +++ b/demos/gtk-demo/sliding_puzzle.c @@ -387,7 +387,7 @@ add_choice (GtkWidget *container, icon = gtk_image_new_from_paintable (paintable); gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE); - gtk_container_add (GTK_CONTAINER (container), icon); + gtk_box_append (GTK_BOX (container), icon); } GtkWidget * diff --git a/demos/gtk-demo/spinner.c b/demos/gtk-demo/spinner.c index 4582728646..21c33441e9 100644 --- a/demos/gtk-demo/spinner.c +++ b/demos/gtk-demo/spinner.c @@ -55,34 +55,34 @@ do_spinner (GtkWidget *do_widget) gtk_widget_set_margin_end (vbox, 5); gtk_widget_set_margin_top (vbox, 5); gtk_widget_set_margin_bottom (vbox, 5); - gtk_container_add (GTK_CONTAINER (content_area), vbox); + gtk_box_append (GTK_BOX (content_area), vbox); /* Sensitive */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); spinner = gtk_spinner_new (); - gtk_container_add (GTK_CONTAINER (hbox), spinner); - gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ()); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), spinner); + gtk_box_append (GTK_BOX (hbox), gtk_entry_new ()); + gtk_box_append (GTK_BOX (vbox), hbox); spinner_sensitive = spinner; /* Disabled */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); spinner = gtk_spinner_new (); - gtk_container_add (GTK_CONTAINER (hbox), spinner); - gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ()); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + gtk_box_append (GTK_BOX (hbox), spinner); + gtk_box_append (GTK_BOX (hbox), gtk_entry_new ()); + gtk_box_append (GTK_BOX (vbox), hbox); spinner_unsensitive = spinner; gtk_widget_set_sensitive (hbox, FALSE); button = gtk_button_new_with_label (_("Play")); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_play_clicked), spinner); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); button = gtk_button_new_with_label (_("Stop")); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_stop_clicked), spinner); - gtk_container_add (GTK_CONTAINER (vbox), button); + gtk_box_append (GTK_BOX (vbox), button); /* Start by default to test for: * https://bugzilla.gnome.org/show_bug.cgi?id=598496 */ diff --git a/demos/gtk-demo/tagged_entry.c b/demos/gtk-demo/tagged_entry.c index a17e2d1188..50020c19cf 100644 --- a/demos/gtk-demo/tagged_entry.c +++ b/demos/gtk-demo/tagged_entry.c @@ -82,19 +82,19 @@ do_tagged_entry (GtkWidget *do_widget) gtk_window_set_child (GTK_WINDOW (window), box); entry = demo_tagged_entry_new (); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_halign (box2, GTK_ALIGN_END); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); button = gtk_button_new_with_mnemonic ("Add _Tag"); g_signal_connect (button, "clicked", G_CALLBACK (add_tag), entry); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_check_button_new_with_mnemonic ("_Spinner"); g_signal_connect (button, "toggled", G_CALLBACK (toggle_spinner), entry); - gtk_container_add (GTK_CONTAINER (box2), button); + gtk_box_append (GTK_BOX (box2), button); button = gtk_button_new_with_mnemonic ("_Done"); gtk_widget_add_css_class (button, "suggested-action"); diff --git a/demos/gtk-demo/textscroll.c b/demos/gtk-demo/textscroll.c index 6e2b4045fc..8d79d084f4 100644 --- a/demos/gtk-demo/textscroll.c +++ b/demos/gtk-demo/textscroll.c @@ -157,7 +157,7 @@ create_text_view (GtkWidget *hbox, guint timeout; swindow = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (hbox), swindow); + gtk_box_append (GTK_BOX (hbox), swindow); textview = gtk_text_view_new (); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview); diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index d37d7d2b7d..d2d1f50304 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -403,7 +403,7 @@ do_tree_store (GtkWidget *do_widget) gtk_widget_set_margin_bottom (vbox, 8); gtk_window_set_child (GTK_WINDOW (window), vbox); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet")); sw = gtk_scrolled_window_new (NULL, NULL); @@ -411,7 +411,7 @@ do_tree_store (GtkWidget *do_widget) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (vbox), sw); + gtk_box_append (GTK_BOX (vbox), sw); /* create model */ model = create_model (); diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c index 0c036a4965..9859a9551b 100644 --- a/demos/node-editor/node-editor-window.c +++ b/demos/node-editor/node-editor-window.c @@ -787,13 +787,13 @@ node_editor_window_create_renderer_widget (gpointer item, gtk_widget_set_size_request (box, 120, 90); label = gtk_label_new (g_object_get_data (G_OBJECT (paintable), "description")); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); picture = gtk_picture_new_for_paintable (paintable); /* don't ever scale up, we want to be as accurate as possible */ gtk_widget_set_halign (picture, GTK_ALIGN_CENTER); gtk_widget_set_valign (picture, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (box), picture); + gtk_box_append (GTK_BOX (box), picture); row = gtk_list_box_row_new (); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box); diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index c394886b9a..46cac4a989 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -891,12 +891,12 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget) { if (silver) { - gtk_container_remove (GTK_CONTAINER (widget), silver); + gtk_list_box_remove (GTK_LIST_BOX (widget), silver); g_object_set_data (G_OBJECT (widget), "Silver", NULL); } if (gold) { - gtk_container_remove (GTK_CONTAINER (widget), gold); + gtk_list_box_remove (GTK_LIST_BOX (widget), gold); g_object_set_data (G_OBJECT (widget), "Gold", NULL); } @@ -926,7 +926,7 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget) "margin-bottom", 6, "xalign", 0.0, NULL); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); gdk_rgba_parse (&rgba, color); swatch = g_object_new (g_type_from_name ("GtkColorSwatch"), "rgba", &rgba, @@ -941,8 +941,8 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget) "height-request", 24, NULL); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), swatch); - gtk_container_add (GTK_CONTAINER (row), box); + gtk_box_append (GTK_BOX (box), swatch); + gtk_box_append (GTK_BOX (row), box); gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1); row = gtk_widget_get_parent (row); gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); @@ -1044,7 +1044,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser) "hexpand", TRUE, "xalign", 0.0, NULL); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); gdk_rgba_parse (&rgba, colors[i].color); swatch = g_object_new (g_type_from_name ("GtkColorSwatch"), "rgba", &rgba, @@ -1059,8 +1059,8 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser) "height-request", 24, NULL); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), swatch); - gtk_container_add (GTK_CONTAINER (row), box); + gtk_box_append (GTK_BOX (box), swatch); + gtk_box_append (GTK_BOX (row), box); gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1); row = gtk_widget_get_parent (row); gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE); @@ -1288,10 +1288,7 @@ close_selection_dialog (GtkWidget *dialog, gint response, GtkWidget *tv) if (response == GTK_RESPONSE_CANCEL) return; - box = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - children = gtk_container_get_children (GTK_CONTAINER (box)); - box = children->data; - g_list_free (children); + box = gtk_widget_get_first_child (gtk_dialog_get_content_area (GTK_DIALOG (dialog))); g_assert (GTK_IS_FLOW_BOX (box)); children = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (box)); diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c index 2a1858e978..93eca8f0e7 100644 --- a/docs/tools/widgets.c +++ b/docs/tools/widgets.c @@ -44,7 +44,7 @@ new_widget_info (const char *name, info->window = gtk_window_new (); info->include_decorations = FALSE; gtk_widget_show (widget); - gtk_container_add (GTK_CONTAINER (info->window), widget); + gtk_box_append (GTK_BOX (info->window), widget); } info->no_focus = TRUE; @@ -92,9 +92,9 @@ create_switch (void) widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); sw = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (sw), TRUE); - gtk_container_add (GTK_CONTAINER (widget), sw); + gtk_box_append (GTK_BOX (widget), sw); sw = gtk_switch_new (); - gtk_container_add (GTK_CONTAINER (widget), sw); + gtk_box_append (GTK_BOX (widget), sw); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); @@ -151,16 +151,16 @@ create_menu_button (void) widget = gtk_menu_button_new (); image = gtk_image_new (); gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic"); - gtk_container_add (GTK_CONTAINER (widget), image); + gtk_box_append (GTK_BOX (widget), image); menu = gtk_popover_new (); gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), menu); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Menu Button")); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Menu Button")); return new_widget_info ("menu-button", vbox, SMALL); } @@ -209,8 +209,8 @@ create_lockbutton (void) widget = gtk_lock_button_new (g_object_new (G_TYPE_TEST_PERMISSION, NULL)); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Lock Button")); gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER); gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER); @@ -253,11 +253,11 @@ create_radio (void) widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); radio = gtk_radio_button_new_with_mnemonic (NULL, "Radio Button _One"); - gtk_container_add (GTK_CONTAINER (widget), radio); + gtk_box_append (GTK_BOX (widget), radio); radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button _Two"); - gtk_container_add (GTK_CONTAINER (widget), radio); + gtk_box_append (GTK_BOX (widget), radio); radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button T_hree"); - gtk_container_add (GTK_CONTAINER (widget), radio); + gtk_box_append (GTK_BOX (widget), radio); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); @@ -288,8 +288,8 @@ create_accel_label (void) gtk_widget_hide (button); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (box), widget); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), widget); + gtk_box_append (GTK_BOX (box), button); gtk_accel_label_set_accel (GTK_ACCEL_LABEL (widget), GDK_KEY_Q, GDK_CONTROL_MASK); @@ -369,7 +369,7 @@ create_info_bar (void) widget = gtk_info_bar_new (); gtk_info_bar_set_show_close_button (GTK_INFO_BAR (widget), TRUE); gtk_info_bar_set_message_type (GTK_INFO_BAR (widget), GTK_MESSAGE_INFO); - gtk_container_add (GTK_CONTAINER (widget), + gtk_box_append (GTK_BOX (widget), gtk_label_new ("Info Bar")); gtk_widget_set_halign (widget, GTK_ALIGN_FILL); @@ -394,16 +394,16 @@ create_search_bar (void) entry = gtk_search_entry_new (); gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar"); - gtk_container_add (GTK_CONTAINER (widget), entry); + gtk_box_append (GTK_BOX (widget), entry); gtk_widget_show (entry); gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (widget), TRUE); gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (widget), TRUE); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); view = gtk_text_view_new (); - gtk_container_add (GTK_CONTAINER (box), view); + gtk_box_append (GTK_BOX (box), view); info = new_widget_info ("search-bar", box, SMALL); @@ -421,16 +421,16 @@ create_action_bar (void) box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); view = gtk_text_view_new (); - gtk_container_add (GTK_CONTAINER (box), view); + gtk_box_append (GTK_BOX (box), view); widget = gtk_action_bar_new (); button = gtk_button_new_from_icon_name ("object-select-symbolic"); gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (widget), button); + gtk_box_append (GTK_BOX (widget), button); button = gtk_button_new_from_icon_name ("call-start-symbolic"); gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (widget), button); + gtk_box_append (GTK_BOX (widget), button); g_object_set (gtk_widget_get_parent (button), "margin-start", 6, "margin-end", 6, @@ -441,7 +441,7 @@ create_action_bar (void) gtk_widget_show (widget); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); info = new_widget_info ("action-bar", box, SMALL); @@ -456,7 +456,7 @@ create_text_view (void) widget = gtk_frame_new (NULL); text_view = gtk_text_view_new (); - gtk_container_add (GTK_CONTAINER (widget), text_view); + gtk_box_append (GTK_BOX (widget), text_view); /* Bad hack to add some size to the widget */ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), "Multiline\nText\n\n", -1); @@ -498,7 +498,7 @@ create_tree_view (void) g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, "xalign", 0.5, NULL), "text", 2, NULL); gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view)); - gtk_container_add (GTK_CONTAINER (widget), tree_view); + gtk_box_append (GTK_BOX (widget), tree_view); info = new_widget_info ("list-and-tree", widget, MEDIUM); info->no_focus = FALSE; @@ -532,11 +532,11 @@ create_icon_view (void) gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), 0); gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), 1); - gtk_container_add (GTK_CONTAINER (widget), icon_view); + gtk_box_append (GTK_BOX (widget), icon_view); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Icon View")); info = new_widget_info ("icon-view", vbox, MEDIUM); @@ -559,8 +559,8 @@ create_color_button (void) picker = gtk_color_button_new_with_rgba (&color); gtk_widget_set_halign (picker, GTK_ALIGN_CENTER); gtk_widget_set_valign (picker, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), picker); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), picker); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Color Button")); return new_widget_info ("color-button", vbox, SMALL); @@ -576,8 +576,8 @@ create_font_button (void) picker = gtk_font_button_new_with_font ("Sans Serif 10"); gtk_widget_set_halign (picker, GTK_ALIGN_CENTER); gtk_widget_set_valign (picker, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), picker); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), picker); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Font Button")); return new_widget_info ("font-button", vbox, SMALL); @@ -599,13 +599,13 @@ create_file_button (void) gtk_widget_set_size_request (picker, 150, -1); gtk_widget_set_halign (picker, GTK_ALIGN_CENTER); gtk_widget_set_valign (picker, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), picker); - gtk_container_add (GTK_CONTAINER (vbox2), + gtk_box_append (GTK_BOX (vbox2), picker); + gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("File Button (Files)")); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), vbox2); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); @@ -619,10 +619,10 @@ create_file_button (void) g_object_unref (file); gtk_widget_set_halign (picker, GTK_ALIGN_CENTER); gtk_widget_set_valign (picker, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox2), picker); - gtk_container_add (GTK_CONTAINER (vbox2), + gtk_box_append (GTK_BOX (vbox2), picker); + gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("File Button (Select Folder)")); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), vbox2); return new_widget_info ("file-button", vbox, MEDIUM); @@ -637,12 +637,12 @@ create_separator (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), + gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); - gtk_container_add (GTK_CONTAINER (hbox), + gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL, "label", "Horizontal and Vertical\nSeparators", "justify", GTK_JUSTIFY_CENTER, @@ -673,7 +673,7 @@ create_panes (void) gtk_paned_set_resize_end_child (GTK_PANED (pane), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (pane), FALSE); - gtk_container_add (GTK_CONTAINER (hbox), pane); + gtk_box_append (GTK_BOX (hbox), pane); pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL); frame = gtk_frame_new (""); @@ -686,10 +686,10 @@ create_panes (void) gtk_paned_set_resize_end_child (GTK_PANED (pane), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (pane), FALSE); - gtk_container_add (GTK_CONTAINER (hbox), pane); + gtk_box_append (GTK_BOX (hbox), pane); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL, "label", "Horizontal and Vertical\nPanes", "justify", GTK_JUSTIFY_CENTER, @@ -852,8 +852,8 @@ create_progressbar (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); gtk_widget_set_halign (widget, GTK_ALIGN_FILL); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Progress Bar")); return new_widget_info ("progressbar", vbox, SMALL); @@ -869,8 +869,8 @@ create_level_bar (void) gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.333); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Level Bar")); return new_widget_info ("levelbar", vbox, SMALL); @@ -903,8 +903,8 @@ create_scrollbar (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); gtk_widget_set_halign (widget, GTK_ALIGN_FILL); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Scrollbar")); return new_widget_info ("scrollbar", vbox, SMALL); @@ -921,8 +921,8 @@ create_spinbutton (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); gtk_widget_set_halign (widget, GTK_ALIGN_FILL); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Spin Button")); return new_widget_info ("spinbutton", vbox, SMALL); @@ -936,13 +936,13 @@ create_statusbar (void) GtkWidget *vbox; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Status Bar")); widget = gtk_statusbar_new (); gtk_widget_set_halign (widget, GTK_ALIGN_FILL); gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on..."); - gtk_container_add (GTK_CONTAINER (vbox), widget); + gtk_box_append (GTK_BOX (vbox), widget); info = new_widget_info ("statusbar", vbox, SMALL); @@ -958,14 +958,14 @@ create_scales (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); - gtk_container_add (GTK_CONTAINER (hbox), + gtk_box_append (GTK_BOX (hbox), gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.0, 100.0, 1.0)); - gtk_container_add (GTK_CONTAINER (hbox), + gtk_box_append (GTK_BOX (hbox), gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 0.0, 100.0, 1.0)); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), hbox); + gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL, "label", "Horizontal and Vertical\nScales", "justify", GTK_JUSTIFY_CENTER, @@ -984,8 +984,8 @@ create_image (void) gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Image")); return new_widget_info ("image", vbox, SMALL); @@ -1004,8 +1004,8 @@ create_spinner (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3); gtk_widget_set_halign (widget, GTK_ALIGN_CENTER); gtk_widget_set_valign (widget, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Spinner")); return new_widget_info ("spinner", vbox, SMALL); @@ -1022,10 +1022,10 @@ create_volume_button (void) gtk_widget_set_size_request (widget, 100, 250); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (widget), box); + gtk_box_append (GTK_BOX (widget), box); button = gtk_volume_button_new (); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33); popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button)); @@ -1074,8 +1074,8 @@ create_appchooserbutton (void) picker = gtk_app_chooser_button_new ("text/plain"); gtk_widget_set_halign (picker, GTK_ALIGN_CENTER); gtk_widget_set_valign (picker, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (vbox), picker); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), picker); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Application Button")); return new_widget_info ("appchooserbutton", vbox, SMALL); @@ -1171,9 +1171,9 @@ create_stack (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), switcher); - gtk_container_add (GTK_CONTAINER (vbox), stack); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), switcher); + gtk_box_append (GTK_BOX (vbox), stack); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Stack")); return new_widget_info ("stack", vbox, ASIS); @@ -1204,9 +1204,9 @@ create_stack_switcher (void) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), switcher); - gtk_container_add (GTK_CONTAINER (vbox), stack); - gtk_container_add (GTK_CONTAINER (vbox), + gtk_box_append (GTK_BOX (vbox), switcher); + gtk_box_append (GTK_BOX (vbox), stack); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Stack Switcher")); return new_widget_info ("stackswitcher", vbox, ASIS); @@ -1239,9 +1239,9 @@ create_sidebar (void) frame = gtk_frame_new (NULL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), sidebar); - gtk_container_add (GTK_CONTAINER (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); - gtk_container_add (GTK_CONTAINER (hbox), stack); + gtk_box_append (GTK_BOX (hbox), sidebar); + gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); + gtk_box_append (GTK_BOX (hbox), stack); gtk_frame_set_child (GTK_FRAME (frame), hbox); return new_widget_info ("sidebar", frame, ASIS); @@ -1264,33 +1264,33 @@ create_list_box (void) button = gtk_label_new ("List Box"); gtk_widget_set_hexpand (button, TRUE); gtk_widget_set_halign (button, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line One")); + gtk_box_append (GTK_BOX (row), gtk_label_new ("Line One")); button = gtk_check_button_new (); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_set_hexpand (button, TRUE); gtk_widget_set_halign (button, GTK_ALIGN_END); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); gtk_list_box_select_row (GTK_LIST_BOX (list), GTK_LIST_BOX_ROW (gtk_widget_get_parent (row))); row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Two")); + gtk_box_append (GTK_BOX (row), gtk_label_new ("Line Two")); button = gtk_button_new_with_label ("2"); gtk_widget_set_hexpand (button, TRUE); gtk_widget_set_halign (button, GTK_ALIGN_END); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Three")); + gtk_box_append (GTK_BOX (row), gtk_label_new ("Line Three")); button = gtk_entry_new (); gtk_widget_set_hexpand (button, TRUE); gtk_widget_set_halign (button, GTK_ALIGN_END); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); gtk_list_box_insert (GTK_LIST_BOX (list), row, -1); - gtk_container_add (GTK_CONTAINER (widget), list); + gtk_box_append (GTK_BOX (widget), list); info = new_widget_info ("list-box", widget, MEDIUM); info->no_focus = FALSE; @@ -1315,24 +1315,24 @@ create_flow_box (void) gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (box), 2); gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_BROWSE); button = gtk_label_new ("Child One"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = gtk_button_new_with_label ("Child Two"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - gtk_container_add (GTK_CONTAINER (child), gtk_label_new ("Child Three")); + gtk_box_append (GTK_BOX (child), gtk_label_new ("Child Three")); button = gtk_check_button_new (); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - gtk_container_add (GTK_CONTAINER (child), button); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (child), button); + gtk_box_append (GTK_BOX (box), child); gtk_flow_box_select_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (gtk_widget_get_parent (child))); - gtk_container_add (GTK_CONTAINER (widget), box); + gtk_box_append (GTK_BOX (widget), box); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (vbox), widget); - gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Flow Box")); + gtk_box_append (GTK_BOX (vbox), widget); + gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Flow Box")); info = new_widget_info ("flow-box", vbox, ASIS); info->no_focus = FALSE; @@ -1349,7 +1349,7 @@ create_gl_area (void) widget = gtk_frame_new (NULL); gears = gtk_gears_new (); - gtk_container_add (GTK_CONTAINER (widget), gears); + gtk_box_append (GTK_BOX (widget), gears); info = new_widget_info ("glarea", widget, MEDIUM); diff --git a/examples/application10/exampleappwin.c b/examples/application10/exampleappwin.c new file mode 100644 index 0000000000..ba0ffd94b6 --- /dev/null +++ b/examples/application10/exampleappwin.c @@ -0,0 +1,293 @@ +#include + +#include "exampleapp.h" +#include "exampleappwin.h" + +struct _ExampleAppWindow +{ + GtkApplicationWindow parent; + + GSettings *settings; + GtkWidget *stack; + GtkWidget *search; + GtkWidget *searchbar; + GtkWidget *searchentry; + GtkWidget *gears; + GtkWidget *sidebar; + GtkWidget *words; + GtkWidget *lines; + GtkWidget *lines_label; +}; + +G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW) + +static void +search_text_changed (GtkEntry *entry, + ExampleAppWindow *win) +{ + const gchar *text; + GtkWidget *tab; + GtkWidget *view; + GtkTextBuffer *buffer; + GtkTextIter start, match_start, match_end; + + text = gtk_editable_get_text (GTK_EDITABLE (entry)); + + if (text[0] == '\0') + return; + + tab = gtk_stack_get_visible_child (GTK_STACK (win->stack)); + view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab)); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + + /* Very simple-minded search implementation */ + gtk_text_buffer_get_start_iter (buffer, &start); + if (gtk_text_iter_forward_search (&start, text, GTK_TEXT_SEARCH_CASE_INSENSITIVE, + &match_start, &match_end, NULL)) + { + gtk_text_buffer_select_range (buffer, &match_start, &match_end); + gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (view), &match_start, + 0.0, FALSE, 0.0, 0.0); + } +} + +static void +find_word (GtkButton *button, + ExampleAppWindow *win) +{ + const gchar *word; + + word = gtk_button_get_label (button); + gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word); +} + +static void +update_words (ExampleAppWindow *win) +{ + GHashTable *strings; + GHashTableIter iter; + GtkWidget *tab, *view, *row; + GtkTextBuffer *buffer; + GtkTextIter start, end; + gchar *word, *key; + GtkWidget *child; + + tab = gtk_stack_get_visible_child (GTK_STACK (win->stack)); + + if (tab == NULL) + return; + + view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab)); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + + strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + + gtk_text_buffer_get_start_iter (buffer, &start); + while (!gtk_text_iter_is_end (&start)) + { + while (!gtk_text_iter_starts_word (&start)) + { + if (!gtk_text_iter_forward_char (&start)) + goto done; + } + end = start; + if (!gtk_text_iter_forward_word_end (&end)) + goto done; + word = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); + g_hash_table_add (strings, g_utf8_strdown (word, -1)); + g_free (word); + start = end; + } + +done: + while ((child = gtk_widget_get_first_child (win->words))) + gtk_list_box_remove (GTK_LIST_BOX (win->words), child); + + g_hash_table_iter_init (&iter, strings); + while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL)) + { + row = gtk_button_new_with_label (key); + g_signal_connect (row, "clicked", + G_CALLBACK (find_word), win); + gtk_box_append (GTK_BOX (win->words), row); + } + + g_hash_table_unref (strings); +} + +static void +update_lines (ExampleAppWindow *win) +{ + GtkWidget *tab, *view; + GtkTextBuffer *buffer; + int count; + gchar *lines; + + tab = gtk_stack_get_visible_child (GTK_STACK (win->stack)); + + if (tab == NULL) + return; + + view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab)); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + + count = gtk_text_buffer_get_line_count (buffer); + lines = g_strdup_printf ("%d", count); + gtk_label_set_text (GTK_LABEL (win->lines), lines); + g_free (lines); +} + +static void +visible_child_changed (GObject *stack, + GParamSpec *pspec, + ExampleAppWindow *win) +{ + if (gtk_widget_in_destruction (GTK_WIDGET (stack))) + return; + + gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE); + update_words (win); + update_lines (win); +} + +static void +words_changed (GObject *sidebar, + GParamSpec *pspec, + ExampleAppWindow *win) +{ + update_words (win); +} + +static void +example_app_window_init (ExampleAppWindow *win) +{ + GtkBuilder *builder; + GMenuModel *menu; + GAction *action; + + gtk_widget_init_template (GTK_WIDGET (win)); + win->settings = g_settings_new ("org.gtk.exampleapp"); + + g_settings_bind (win->settings, "transition", + win->stack, "transition-type", + G_SETTINGS_BIND_DEFAULT); + + g_settings_bind (win->settings, "show-words", + win->sidebar, "reveal-child", + G_SETTINGS_BIND_DEFAULT); + + g_object_bind_property (win->search, "active", + win->searchbar, "search-mode-enabled", + G_BINDING_BIDIRECTIONAL); + + g_signal_connect (win->sidebar, "notify::reveal-child", + G_CALLBACK (words_changed), win); + + builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui"); + menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu")); + gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (win->gears), menu); + g_object_unref (builder); + + action = g_settings_create_action (win->settings, "show-words"); + g_action_map_add_action (G_ACTION_MAP (win), action); + g_object_unref (action); + + action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible"); + g_action_map_add_action (G_ACTION_MAP (win), action); + g_object_unref (action); + + g_object_bind_property (win->lines, "visible", + win->lines_label, "visible", + G_BINDING_DEFAULT); + + g_object_set (gtk_settings_get_default (), "gtk-shell-shows-app-menu", FALSE, NULL); + gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (win), TRUE); +} + +static void +example_app_window_dispose (GObject *object) +{ + ExampleAppWindow *win; + + win = EXAMPLE_APP_WINDOW (object); + + g_clear_object (&win->settings); + + G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object); +} + +static void +example_app_window_class_init (ExampleAppWindowClass *class) +{ + G_OBJECT_CLASS (class)->dispose = example_app_window_dispose; + + gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class), + "/org/gtk/exampleapp/window.ui"); + + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, words); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines); + gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines_label); + + gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed); + gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed); +} + +ExampleAppWindow * +example_app_window_new (ExampleApp *app) +{ + return g_object_new (EXAMPLE_APP_WINDOW_TYPE, "application", app, NULL); +} + +void +example_app_window_open (ExampleAppWindow *win, + GFile *file) +{ + gchar *basename; + GtkWidget *scrolled, *view; + gchar *contents; + gsize length; + GtkTextBuffer *buffer; + GtkTextTag *tag; + GtkTextIter start_iter, end_iter; + + basename = g_file_get_basename (file); + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_hexpand (scrolled, TRUE); + gtk_widget_set_vexpand (scrolled, TRUE); + view = gtk_text_view_new (); + gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); + gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view); + gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + + if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL)) + { + gtk_text_buffer_set_text (buffer, contents, length); + g_free (contents); + } + + tag = gtk_text_buffer_create_tag (buffer, NULL, NULL); + g_settings_bind (win->settings, "font", + tag, "font", + G_SETTINGS_BIND_DEFAULT); + + gtk_text_buffer_get_start_iter (buffer, &start_iter); + gtk_text_buffer_get_end_iter (buffer, &end_iter); + gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter); + + g_free (basename); + + gtk_widget_set_sensitive (win->search, TRUE); + + update_words (win); + update_lines (win); +} diff --git a/examples/application8/exampleappwin.c b/examples/application8/exampleappwin.c index 1ae4756d02..f30895b035 100644 --- a/examples/application8/exampleappwin.c +++ b/examples/application8/exampleappwin.c @@ -67,8 +67,8 @@ update_words (ExampleAppWindow *win) GtkWidget *tab, *view, *row; GtkTextBuffer *buffer; GtkTextIter start, end; - GList *children, *l; gchar *word, *key; + GtkWidget *child; tab = gtk_stack_get_visible_child (GTK_STACK (win->stack)); @@ -98,10 +98,8 @@ update_words (ExampleAppWindow *win) } done: - children = gtk_container_get_children (GTK_CONTAINER (win->words)); - for (l = children; l; l = l->next) - gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data)); - g_list_free (children); + while ((child = gtk_widget_get_first_child (win->words))) + gtk_list_box_remove (GTK_LIST_BOX (win->words), child); g_hash_table_iter_init (&iter, strings); while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL)) @@ -109,7 +107,7 @@ done: row = gtk_button_new_with_label (key); g_signal_connect (row, "clicked", G_CALLBACK (find_word), win); - gtk_container_add (GTK_CONTAINER (win->words), row); + gtk_box_append (GTK_BOX (win->words), row); } g_hash_table_unref (strings); diff --git a/examples/application9/exampleappwin.c b/examples/application9/exampleappwin.c index c585094f4c..c77a124f3d 100644 --- a/examples/application9/exampleappwin.c +++ b/examples/application9/exampleappwin.c @@ -69,8 +69,8 @@ update_words (ExampleAppWindow *win) GtkWidget *tab, *view, *row; GtkTextBuffer *buffer; GtkTextIter start, end; - GList *children, *l; gchar *word, *key; + GtkWidget *child; tab = gtk_stack_get_visible_child (GTK_STACK (win->stack)); @@ -100,10 +100,8 @@ update_words (ExampleAppWindow *win) } done: - children = gtk_container_get_children (GTK_CONTAINER (win->words)); - for (l = children; l; l = l->next) - gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data)); - g_list_free (children); + while ((child = gtk_widget_get_first_child (win->words))) + gtk_list_box_remove (GTK_LIST_BOX (win->words), child); g_hash_table_iter_init (&iter, strings); while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL)) @@ -111,7 +109,7 @@ done: row = gtk_button_new_with_label (key); g_signal_connect (row, "clicked", G_CALLBACK (find_word), win); - gtk_container_add (GTK_CONTAINER (win->words), row); + gtk_box_append (GTK_BOX (win->words), row); } g_hash_table_unref (strings); diff --git a/examples/bp/bloatpad.c b/examples/bp/bloatpad.c index 0da7402374..c2ea00b07f 100644 --- a/examples/bp/bloatpad.c +++ b/examples/bp/bloatpad.c @@ -228,27 +228,27 @@ new_window (GApplication *app, button = gtk_toggle_button_new (); gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-left"); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left"); - gtk_container_add (GTK_CONTAINER (toolbar), button); + gtk_box_append (GTK_BOX (toolbar), button); button = gtk_toggle_button_new (); gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-center"); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center"); - gtk_container_add (GTK_CONTAINER (toolbar), button); + gtk_box_append (GTK_BOX (toolbar), button); button = gtk_toggle_button_new (); gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-right"); gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right"); - gtk_container_add (GTK_CONTAINER (toolbar), button); + gtk_box_append (GTK_BOX (toolbar), button); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_set_halign (box, GTK_ALIGN_END); label = gtk_label_new ("Fullscreen:"); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); sw = gtk_switch_new (); gtk_widget_set_valign (sw, GTK_ALIGN_CENTER); gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen"); - gtk_container_add (GTK_CONTAINER (box), sw); - gtk_container_add (GTK_CONTAINER (toolbar), box); + gtk_box_append (GTK_BOX (box), sw); + gtk_box_append (GTK_BOX (toolbar), box); gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1); @@ -406,12 +406,12 @@ edit_accels (GSimpleAction *action, gtk_window_set_application (GTK_WINDOW (dialog), app); actions = gtk_application_list_action_descriptions (app); combo = gtk_combo_box_text_new (); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo); for (i = 0; actions[i]; i++) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]); g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), entry); + gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), entry); gtk_dialog_add_button (GTK_DIALOG (dialog), "Close", GTK_RESPONSE_CLOSE); gtk_dialog_add_button (GTK_DIALOG (dialog), "Set", GTK_RESPONSE_APPLY); g_signal_connect (dialog, "response", G_CALLBACK (response), dialog); diff --git a/examples/hello-world.c b/examples/hello-world.c index 5ee7062788..f4c058e978 100644 --- a/examples/hello-world.c +++ b/examples/hello-world.c @@ -25,7 +25,7 @@ activate (GtkApplication *app, button = gtk_button_new_with_label ("Hello World"); g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); gtk_widget_show (window); } diff --git a/examples/search-bar.c b/examples/search-bar.c index c39dc8c140..5790852957 100644 --- a/examples/search-bar.c +++ b/examples/search-bar.c @@ -23,10 +23,10 @@ activate_cb (GtkApplication *app, entry = gtk_search_entry_new (); gtk_widget_set_hexpand (entry, TRUE); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); menu_button = gtk_menu_button_new (); - gtk_container_add (GTK_CONTAINER (box), menu_button); + gtk_box_append (GTK_BOX (box), menu_button); gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_EDITABLE (entry)); gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (search_bar), window); diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c index 9ac1cd5a13..2048a7c0b3 100644 --- a/gtk/a11y/gtklabelaccessible.c +++ b/gtk/a11y/gtklabelaccessible.c @@ -445,29 +445,6 @@ gtk_label_accessible_ref_relation_set (AtkObject *obj) AtkObject *accessible_array[1]; AtkRelation* relation; - if (!gtk_widget_get_can_focus (mnemonic_widget)) - { - /* - * Handle the case where a GtkFileChooserButton is specified - * as the mnemonic widget. use the combobox which is a child of the - * GtkFileChooserButton as the mnemonic widget. See bug #359843. - */ - if (GTK_IS_BOX (mnemonic_widget)) - { - GList *list, *tmpl; - - list = gtk_container_get_children (GTK_CONTAINER (mnemonic_widget)); - if (g_list_length (list) == 2) - { - tmpl = g_list_last (list); - if (GTK_IS_COMBO_BOX(tmpl->data)) - { - mnemonic_widget = GTK_WIDGET(tmpl->data); - } - } - g_list_free (list); - } - } accessible_array[0] = gtk_widget_get_accessible (mnemonic_widget); relation = atk_relation_new (accessible_array, 1, ATK_RELATION_LABEL_FOR); diff --git a/gtk/a11y/gtknotebookpageaccessible.c b/gtk/a11y/gtknotebookpageaccessible.c index dcdfe16f03..09d089ebe3 100644 --- a/gtk/a11y/gtknotebookpageaccessible.c +++ b/gtk/a11y/gtknotebookpageaccessible.c @@ -36,31 +36,25 @@ G_DEFINE_TYPE_WITH_CODE (GtkNotebookPageAccessible, gtk_notebook_page_accessible static GtkWidget * -find_label_child (GtkContainer *container) +find_label_child (GtkWidget *widget) { - GList *children, *tmp_list; GtkWidget *child; - children = gtk_container_get_children (container); - - child = NULL; - for (tmp_list = children; tmp_list != NULL; tmp_list = tmp_list->next) + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - if (GTK_IS_LABEL (tmp_list->data)) + if (GTK_IS_LABEL (child)) + return child; + else { - child = GTK_WIDGET (tmp_list->data); - break; - } - else if (GTK_IS_CONTAINER (tmp_list->data)) - { - child = find_label_child (GTK_CONTAINER (tmp_list->data)); - if (child) - break; + GtkWidget *w = find_label_child (child); + if (w) + return w; } } - g_list_free (children); - return child; + return NULL; } static GtkWidget * @@ -81,10 +75,7 @@ get_label_from_notebook_page (GtkNotebookPageAccessible *page) if (GTK_IS_LABEL (child)) return child; - if (GTK_IS_CONTAINER (child)) - child = find_label_child (GTK_CONTAINER (child)); - - return child; + return find_label_child (child); } static const gchar * diff --git a/gtk/a11y/gtkscrolledwindowaccessible.c b/gtk/a11y/gtkscrolledwindowaccessible.c index e18a5980ae..fc2822686e 100644 --- a/gtk/a11y/gtkscrolledwindowaccessible.c +++ b/gtk/a11y/gtkscrolledwindowaccessible.c @@ -99,12 +99,11 @@ gtk_scrolled_window_accessible_initialize (AtkObject *obj, obj->role = ATK_ROLE_SCROLL_PANE; } -static gint +static int gtk_scrolled_window_accessible_get_n_children (AtkObject *object) { GtkWidget *widget; GtkScrolledWindow *scrolled_window; - GList *children; gint n_children; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); @@ -113,10 +112,9 @@ gtk_scrolled_window_accessible_get_n_children (AtkObject *object) scrolled_window = GTK_SCROLLED_WINDOW (widget); - children = gtk_container_get_children (GTK_CONTAINER (widget)); - n_children = g_list_length (children); - g_list_free (children); - + n_children = 0; + if (gtk_scrolled_window_get_child (scrolled_window)) + n_children++; if (gtk_scrolled_window_get_hscrollbar (scrolled_window)) n_children++; if (gtk_scrolled_window_get_vscrollbar (scrolled_window)) @@ -132,9 +130,8 @@ gtk_scrolled_window_accessible_ref_child (AtkObject *obj, GtkWidget *widget; GtkScrolledWindow *scrolled_window; GtkWidget *hscrollbar, *vscrollbar; - GList *children, *tmp_list; - gint n_children; - AtkObject *accessible = NULL; + GtkWidget *c; + GtkWidget *chosen = NULL; g_return_val_if_fail (child >= 0, NULL); @@ -143,35 +140,21 @@ gtk_scrolled_window_accessible_ref_child (AtkObject *obj, return NULL; scrolled_window = GTK_SCROLLED_WINDOW (widget); + c = gtk_scrolled_window_get_child (scrolled_window); hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window); vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window); - children = gtk_container_get_children (GTK_CONTAINER (widget)); - n_children = g_list_length (children); + if (child == 2) + chosen = vscrollbar; + else if (child == 1) + chosen = c ? hscrollbar : vscrollbar; + else if (child == 0) + chosen = c ? c : (hscrollbar ? hscrollbar : vscrollbar); - if (child == n_children) - { - if (gtk_scrolled_window_get_hscrollbar (scrolled_window)) - accessible = gtk_widget_get_accessible (hscrollbar); - else if (gtk_scrolled_window_get_vscrollbar (scrolled_window)) - accessible = gtk_widget_get_accessible (vscrollbar); - } - else if (child == n_children + 1 && - gtk_scrolled_window_get_hscrollbar (scrolled_window) && - gtk_scrolled_window_get_vscrollbar (scrolled_window)) - accessible = gtk_widget_get_accessible (vscrollbar); - else if (child < n_children) - { - tmp_list = g_list_nth (children, child); - if (tmp_list) - accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data)); - } + if (chosen) + return g_object_ref (gtk_widget_get_accessible (chosen)); - g_list_free (children); - if (accessible) - g_object_ref (accessible); - - return accessible; + return NULL; } static void diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c index 43b9c8cb9a..0587a33973 100644 --- a/gtk/a11y/gtkwidgetaccessible.c +++ b/gtk/a11y/gtkwidgetaccessible.c @@ -399,7 +399,7 @@ gtk_widget_accessible_get_index_in_parent (AtkObject *accessible) GtkWidget *widget; GtkWidget *parent_widget; gint index; - GList *children; + GtkWidget *ch; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); @@ -436,24 +436,13 @@ gtk_widget_accessible_get_index_in_parent (AtkObject *accessible) } parent_widget = gtk_widget_get_parent (widget); - if (GTK_IS_CONTAINER (parent_widget)) + for (ch = gtk_widget_get_first_child (parent_widget), index = 0; + ch != NULL; + ch = gtk_widget_get_next_sibling (ch), index++) { - children = gtk_container_get_children (GTK_CONTAINER (parent_widget)); - index = g_list_index (children, widget); - g_list_free (children); + if (ch == widget) + break; } - else if (GTK_IS_WIDGET (parent_widget)) - { - GtkWidget *child; - - for (child = gtk_widget_get_first_child (parent_widget), index = 0; child; child = gtk_widget_get_next_sibling (child), index++) - { - if (child == widget) - break; - } - } - else - index = -1; return index; } diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c index 13a3dac85e..77a1981a3b 100644 --- a/gtk/gtkactionbar.c +++ b/gtk/gtkactionbar.c @@ -226,7 +226,7 @@ void gtk_action_bar_pack_start (GtkActionBar *action_bar, GtkWidget *child) { - gtk_container_add (GTK_CONTAINER (action_bar->start_box), child); + gtk_box_append (GTK_BOX (action_bar->start_box), child); } /** @@ -256,9 +256,9 @@ gtk_action_bar_remove (GtkActionBar *action_bar, GtkWidget *child) { if (gtk_widget_get_parent (child) == action_bar->start_box) - gtk_container_remove (GTK_CONTAINER (action_bar->start_box), child); + gtk_box_remove (GTK_BOX (action_bar->start_box), child); else if (gtk_widget_get_parent (child) == action_bar->end_box) - gtk_container_remove (GTK_CONTAINER (action_bar->end_box), child); + gtk_box_remove (GTK_BOX (action_bar->end_box), child); else if (child == gtk_center_box_get_center_widget (GTK_CENTER_BOX (action_bar->center_box))) gtk_center_box_set_center_widget (GTK_CENTER_BOX (action_bar->center_box), NULL); else diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c index be0e9c6c4d..3a6d5a97e3 100644 --- a/gtk/gtkappchooserdialog.c +++ b/gtk/gtkappchooserdialog.c @@ -317,7 +317,7 @@ construct_appchooser_widget (GtkAppChooserDialog *self) /* Need to build the appchooser widget after, because of the content-type construct-only property */ self->app_chooser_widget = gtk_app_chooser_widget_new (self->content_type); gtk_widget_set_vexpand (self->app_chooser_widget, TRUE); - gtk_container_add (GTK_CONTAINER (self->inner_box), self->app_chooser_widget); + gtk_box_append (GTK_BOX (self->inner_box), self->app_chooser_widget); g_signal_connect (self->app_chooser_widget, "application-selected", G_CALLBACK (widget_application_selected_cb), self); @@ -327,10 +327,10 @@ construct_appchooser_widget (GtkAppChooserDialog *self) G_CALLBACK (widget_notify_for_button_cb), self); /* Add the custom button to the new appchooser */ - gtk_container_add (GTK_CONTAINER (self->inner_box), + gtk_box_append (GTK_BOX (self->inner_box), self->show_more_button); - gtk_container_add (GTK_CONTAINER (self->inner_box), + gtk_box_append (GTK_BOX (self->inner_box), self->software_button); info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->app_chooser_widget)); diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 55ccdce579..3f890c9552 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -408,21 +408,25 @@ add_to_header_bar (GtkAssistant *assistant, static void add_action_widgets (GtkAssistant *assistant) { - GList *children; - GList *l; + GList *children, *l; + GtkWidget *child; if (assistant->use_header_bar) { - children = gtk_container_get_children (GTK_CONTAINER (assistant->action_area)); + children = NULL; + for (child = gtk_widget_get_last_child (assistant->action_area); + child != NULL; + child = gtk_widget_get_prev_sibling (child)) + children = g_list_prepend (children, child); for (l = children; l != NULL; l = l->next) { - GtkWidget *child = l->data; gboolean has_default; + child = l->data; has_default = gtk_widget_has_default (child); g_object_ref (child); - gtk_container_remove (GTK_CONTAINER (assistant->action_area), child); + gtk_box_remove (GTK_BOX (assistant->action_area), child); add_to_header_bar (assistant, child); g_object_unref (child); @@ -1129,8 +1133,8 @@ assistant_remove_page (GtkAssistant *assistant, gtk_size_group_remove_widget (assistant->title_size_group, page_info->regular_title); gtk_size_group_remove_widget (assistant->title_size_group, page_info->current_title); - gtk_container_remove (GTK_CONTAINER (assistant->sidebar), page_info->regular_title); - gtk_container_remove (GTK_CONTAINER (assistant->sidebar), page_info->current_title); + gtk_box_remove (GTK_BOX (assistant->sidebar), page_info->regular_title); + gtk_box_remove (GTK_BOX (assistant->sidebar), page_info->current_title); assistant->pages = g_list_remove_link (assistant->pages, element); assistant->visited_pages = g_slist_remove_all (assistant->visited_pages, page_info); @@ -1166,9 +1170,13 @@ gtk_assistant_init (GtkAssistant *assistant) if (alternative_button_order (assistant)) { GList *buttons, *l; + GtkWidget *child; - /* Reverse the action area children for the alternative button order setting */ - buttons = gtk_container_get_children (GTK_CONTAINER (assistant->action_area)); + buttons = NULL; + for (child = gtk_widget_get_last_child (assistant->action_area); + child != NULL; + child = gtk_widget_get_prev_sibling (child)) + buttons = g_list_prepend (buttons, child); for (l = buttons; l; l = l->next) gtk_box_reorder_child_after (GTK_BOX (assistant->action_area), GTK_WIDGET (l->data), NULL); @@ -1815,7 +1823,7 @@ add_to_action_area (GtkAssistant *assistant, { gtk_widget_set_valign (child, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (assistant->action_area), child); + gtk_box_append (GTK_BOX (assistant->action_area), child); } /** @@ -1868,7 +1876,7 @@ gtk_assistant_remove_action_widget (GtkAssistant *assistant, update_actions_size (assistant); } - gtk_container_remove (GTK_CONTAINER (assistant->action_area), child); + gtk_box_remove (GTK_BOX (assistant->action_area), child); } /** diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index deadca751f..40f022f991 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -593,12 +593,12 @@ gtk_calendar_init (GtkCalendar *calendar) calendar->arrow_widgets[3] = gtk_button_new_from_icon_name ("pan-end-symbolic"); g_signal_connect_swapped (calendar->arrow_widgets[3], "clicked", G_CALLBACK (calendar_set_year_next), calendar); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->arrow_widgets[0]); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->month_name_stack); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->arrow_widgets[1]); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->arrow_widgets[2]); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->year_label); - gtk_container_add (GTK_CONTAINER (calendar->header_box), calendar->arrow_widgets[3]); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->arrow_widgets[0]); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->month_name_stack); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->arrow_widgets[1]); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->arrow_widgets[2]); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->year_label); + gtk_box_append (GTK_BOX (calendar->header_box), calendar->arrow_widgets[3]); gtk_widget_set_parent (calendar->header_box, GTK_WIDGET (calendar)); diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index ebfe4d8dc9..938af7632e 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -170,15 +170,18 @@ save_custom_colors (GtkColorChooserWidget *cc) GVariantBuilder builder; GVariant *variant; GdkRGBA color; - GList *children, *l; GtkWidget *child; + gboolean first; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(dddd)")); - children = gtk_container_get_children (GTK_CONTAINER (cc->custom)); - for (l = g_list_nth (children, 1); l != NULL; l = l->next) + for (child = gtk_widget_get_first_child (cc->custom), first = TRUE; + child != NULL; + child = gtk_widget_get_next_sibling (child), first = FALSE) { - child = l->data; + if (first) + continue; + if (gtk_color_swatch_get_rgba (GTK_COLOR_SWATCH (child), &color)) { double red, green, blue, alpha; @@ -193,8 +196,6 @@ save_custom_colors (GtkColorChooserWidget *cc) variant = g_variant_builder_end (&builder); g_settings_set_value (cc->settings, "custom-colors", variant); - - g_list_free (children); } static void @@ -210,7 +211,6 @@ static void gtk_color_chooser_widget_set_use_alpha (GtkColorChooserWidget *cc, gboolean use_alpha) { - GList *palettes, *p; GtkWidget *child; GtkWidget *grid; @@ -220,11 +220,10 @@ gtk_color_chooser_widget_set_use_alpha (GtkColorChooserWidget *cc, cc->use_alpha = use_alpha; gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (cc->editor), use_alpha); - palettes = gtk_container_get_children (GTK_CONTAINER (cc->palette)); - for (p = palettes; p; p = p->next) + for (grid = gtk_widget_get_first_child (cc->palette); + grid != NULL; + grid = gtk_widget_get_next_sibling (grid)) { - grid = p->data; - for (child = gtk_widget_get_first_child (grid); child != NULL; child = gtk_widget_get_next_sibling (child)) @@ -233,7 +232,6 @@ gtk_color_chooser_widget_set_use_alpha (GtkColorChooserWidget *cc, gtk_color_swatch_set_use_alpha (GTK_COLOR_SWATCH (child), use_alpha); } } - g_list_free (palettes); gtk_widget_queue_draw (GTK_WIDGET (cc)); g_object_notify (G_OBJECT (cc), "use-alpha"); @@ -313,7 +311,7 @@ remove_palette (GtkColorChooserWidget *cc) widget = l->data; if (widget == cc->custom_label || widget == cc->custom) continue; - gtk_container_remove (GTK_CONTAINER (cc->palette), widget); + gtk_box_remove (GTK_BOX (cc->palette), widget); } g_list_free (children); } @@ -343,7 +341,7 @@ add_palette (GtkColorChooserWidget *cc, gtk_widget_set_margin_bottom (grid, 12); gtk_grid_set_row_spacing (GTK_GRID (grid), 2); gtk_grid_set_column_spacing (GTK_GRID (grid), 4); - gtk_container_add (GTK_CONTAINER (cc->palette), grid); + gtk_box_append (GTK_BOX (cc->palette), grid); left = 0; right = colors_per_line - 1; @@ -558,11 +556,11 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) /* translators: label for the custom section in the color chooser */ cc->custom_label = label = gtk_label_new (_("Custom")); gtk_widget_set_halign (label, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (cc->palette), label); + gtk_box_append (GTK_BOX (cc->palette), label); cc->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); g_object_set (box, "margin-top", 12, NULL); - gtk_container_add (GTK_CONTAINER (cc->palette), box); + gtk_box_append (GTK_BOX (cc->palette), box); cc->button = button = gtk_color_swatch_new (); gtk_widget_set_name (button, "add-color-button"); @@ -572,7 +570,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) connect_button_signals (button, cc); gtk_color_swatch_set_icon (GTK_COLOR_SWATCH (button), "list-add-symbolic"); gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (button), FALSE); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); cc->settings = g_settings_new ("org.gtk.gtk4.Settings.ColorChooser"); variant = g_settings_get_value (cc->settings, I_("custom-colors")); @@ -598,7 +596,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) g_free (text); g_free (name); connect_custom_signals (p, cc); - gtk_container_add (GTK_CONTAINER (box), p); + gtk_box_append (GTK_BOX (box), p); if (i == 8) break; @@ -787,10 +785,16 @@ static void add_custom_color (GtkColorChooserWidget *cc, const GdkRGBA *color) { - GtkWidget *p; + GtkWidget *widget; GList *children; + GtkWidget *p; + + children = NULL; + for (widget = gtk_widget_get_first_child (cc->custom); + widget != NULL; + widget = gtk_widget_get_next_sibling (widget)) + children = g_list_prepend (children, widget); - children = gtk_container_get_children (GTK_CONTAINER (cc->custom)); if (g_list_length (children) >= 9) { GtkWidget *last = gtk_widget_get_last_child (cc->custom); @@ -798,7 +802,7 @@ add_custom_color (GtkColorChooserWidget *cc, if (last == (GtkWidget *)cc->current) cc->current = NULL; - gtk_container_remove (GTK_CONTAINER (cc->custom), last); + gtk_box_remove (GTK_BOX (cc->custom), last); } g_list_free (children); @@ -819,15 +823,15 @@ gtk_color_chooser_widget_set_rgba (GtkColorChooser *chooser, const GdkRGBA *color) { GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (chooser); - GList *palettes, *p; GtkWidget *swatch; GtkWidget *w; + GdkRGBA c; - palettes = gtk_container_get_children (GTK_CONTAINER (cc->palette)); - for (p = palettes; p; p = p->next) + for (w = gtk_widget_get_first_child (cc->palette); + w != NULL; + w = gtk_widget_get_next_sibling (w)) { - w = p->data; if (!GTK_IS_GRID (w) && !GTK_IS_BOX (w)) continue; @@ -841,12 +845,10 @@ gtk_color_chooser_widget_set_rgba (GtkColorChooser *chooser, if (gdk_rgba_equal (color, &c)) { select_swatch (cc, GTK_COLOR_SWATCH (swatch)); - g_list_free (palettes); return; } } } - g_list_free (palettes); add_custom_color (cc, color); } diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 266e1d1afe..5ab02aa0a3 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1138,7 +1138,7 @@ gtk_combo_box_remove (GtkComboBox *combo_box, combo_box); } - gtk_container_remove (GTK_CONTAINER (priv->box), widget); + gtk_box_remove (GTK_BOX (priv->box), widget); priv->child = NULL; diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c index e664c595cd..5948cdeb27 100644 --- a/gtk/gtkcustompaperunixdialog.c +++ b/gtk/gtkcustompaperunixdialog.c @@ -553,7 +553,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog, else gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 1); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); gtk_widget_show (button); data->spin_button = button; @@ -567,7 +567,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog, label = gtk_label_new (_("mm")); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); gtk_widget_show (label); gtk_label_set_mnemonic_widget (GTK_LABEL (mnemonic_label), button); @@ -1012,18 +1012,18 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) gtk_widget_set_margin_end (hbox, 20); gtk_widget_set_margin_top (hbox, 20); gtk_widget_set_margin_bottom (hbox, 20); - gtk_container_add (GTK_CONTAINER (content_area), hbox); + gtk_box_append (GTK_BOX (content_area), hbox); gtk_widget_show (hbox); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); gtk_widget_show (vbox); 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_has_frame (GTK_SCROLLED_WINDOW (scrolled), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), scrolled); + gtk_box_append (GTK_BOX (vbox), scrolled); gtk_widget_show (scrolled); treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->custom_paper_list)); @@ -1052,23 +1052,23 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) gtk_widget_add_css_class (toolbar, "linked"); - gtk_container_add (GTK_CONTAINER (vbox), toolbar); + gtk_box_append (GTK_BOX (vbox), toolbar); button = gtk_button_new_from_icon_name ("list-add-symbolic"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_custom_paper), dialog); - gtk_container_add (GTK_CONTAINER (toolbar), button); + gtk_box_append (GTK_BOX (toolbar), button); button = gtk_button_new_from_icon_name ("list-remove-symbolic"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (remove_custom_paper), dialog); - gtk_container_add (GTK_CONTAINER (toolbar), button); + gtk_box_append (GTK_BOX (toolbar), button); user_units = _gtk_print_get_default_user_units (); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); priv->values_box = vbox; - gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_box_append (GTK_BOX (hbox), vbox); gtk_widget_show (vbox); grid = gtk_grid_new (); @@ -1100,7 +1100,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) frame = wrap_in_frame (_("Paper Size"), grid); gtk_widget_show (grid); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); gtk_widget_show (frame); grid = gtk_grid_new (); @@ -1173,7 +1173,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) NULL, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); - gtk_container_add (GTK_CONTAINER (hbox), combo); + gtk_box_append (GTK_BOX (hbox), combo); gtk_widget_show (combo); g_signal_connect_swapped (combo, "changed", @@ -1181,7 +1181,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) frame = wrap_in_frame (_("Paper Margins"), grid); gtk_widget_show (grid); - gtk_container_add (GTK_CONTAINER (vbox), frame); + gtk_box_append (GTK_BOX (vbox), frame); gtk_widget_show (frame); update_custom_widgets_from_list (dialog); diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 64cd525586..ca0e67ed21 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -123,7 +123,7 @@ * * // Add the label, and show everything we’ve added * - * gtk_container_add (GTK_CONTAINER (content_area), label); + * gtk_box_append (GTK_BOX (content_area), label); * gtk_widget_show (dialog); * } * ]| @@ -379,7 +379,7 @@ add_to_action_area (GtkDialog *dialog, GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog); gtk_widget_set_valign (child, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (priv->action_area), child); + gtk_box_append (GTK_BOX (priv->action_area), child); apply_response_for_action_area (dialog, child, response_id); } @@ -432,21 +432,28 @@ gtk_dialog_constructed (GObject *object) if (priv->use_header_bar) { GList *children, *l; + GtkWidget *child; + + children = NULL; + for (child = gtk_widget_get_first_child (priv->action_area); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + children = g_list_append (children, child); - children = gtk_container_get_children (GTK_CONTAINER (priv->action_area)); for (l = children; l != NULL; l = l->next) { - GtkWidget *child = l->data; gboolean has_default; ResponseData *rd; gint response_id; + child = l->data; + has_default = gtk_widget_has_default (child); rd = get_response_data (child, FALSE); response_id = rd ? rd->response_id : GTK_RESPONSE_NONE; g_object_ref (child); - gtk_container_remove (GTK_CONTAINER (priv->action_area), child); + gtk_box_remove (GTK_BOX (priv->action_area), child); add_to_header_bar (dialog, child, response_id); g_object_unref (child); @@ -610,22 +617,22 @@ static GList * get_action_children (GtkDialog *dialog) { GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog); + GtkWidget *parent; + GtkWidget *child; GList *children; if (priv->constructed && priv->use_header_bar) - { - GtkWidget *child; - - children = NULL; - for (child = gtk_widget_get_first_child (priv->headerbar); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - children = g_list_append (children, child); - } + parent = priv->headerbar; else - children = gtk_container_get_children (GTK_CONTAINER (priv->action_area)); + parent = priv->action_area; - return children; + children = NULL; + for (child = gtk_widget_get_first_child (parent); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + children = g_list_prepend (children, child); + + return g_list_reverse (children); } /* A far too tricky heuristic for getting the right initial diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index 7cd3f2b1cf..6a925ebe63 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -320,13 +320,19 @@ add_recent_item (GtkEmojiChooser *chooser, GList *children, *l; int i; GVariantBuilder builder; + GtkWidget *child; g_variant_ref (item); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a((auss)u)")); g_variant_builder_add (&builder, "(@(auss)u)", item, modifier); - children = gtk_container_get_children (GTK_CONTAINER (chooser->recent.box)); + children = NULL; + for (child = gtk_widget_get_last_child (chooser->recent.box); + child != NULL; + child = gtk_widget_get_prev_sibling (child)) + children = g_list_prepend (children, child); + for (l = children, i = 1; l; l = l->next, i++) { GVariant *item2 = g_object_get_data (G_OBJECT (l->data), "emoji-data"); @@ -334,13 +340,13 @@ add_recent_item (GtkEmojiChooser *chooser, if (modifier == modifier2 && g_variant_equal (item, item2)) { - gtk_container_remove (GTK_CONTAINER (chooser->recent.box), l->data); + gtk_flow_box_remove (GTK_FLOW_BOX (chooser->recent.box), l->data); i--; continue; } if (i >= MAX_RECENT) { - gtk_container_remove (GTK_CONTAINER (chooser->recent.box), l->data); + gtk_flow_box_remove (GTK_FLOW_BOX (chooser->recent.box), l->data); continue; } @@ -443,7 +449,7 @@ show_variations (GtkEmojiChooser *chooser, gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_NONE); g_object_set (box, "accept-unpaired-release", TRUE, NULL); gtk_popover_set_child (GTK_POPOVER (popover), view); - gtk_container_add (GTK_CONTAINER (view), box); + gtk_box_append (GTK_BOX (view), box); g_signal_connect (box, "child-activated", G_CALLBACK (emoji_activated), parent_popover); diff --git a/gtk/gtkemojicompletion.c b/gtk/gtkemojicompletion.c index 9f5fe235c6..2a84ce853e 100644 --- a/gtk/gtkemojicompletion.c +++ b/gtk/gtkemojicompletion.c @@ -474,7 +474,7 @@ add_emoji_variation (GtkWidget *box, if (modifier != 0) g_object_set_data (G_OBJECT (child), "modifier", GUINT_TO_POINTER (modifier)); - gtk_container_add (GTK_CONTAINER (child), label); + gtk_box_append (GTK_BOX (child), label); gtk_flow_box_insert (GTK_FLOW_BOX (box), child, -1); } @@ -504,15 +504,15 @@ add_emoji (GtkWidget *list, child = g_object_new (GTK_TYPE_LIST_BOX_ROW, "css-name", "emoji-completion-row", NULL); gtk_widget_set_focus_on_click (child, FALSE); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (child), box); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (child), box); + gtk_box_append (GTK_BOX (box), label); g_object_set_data (G_OBJECT (child), "base", label); stack = gtk_stack_new (); gtk_stack_set_hhomogeneous (GTK_STACK (stack), TRUE); gtk_stack_set_vhomogeneous (GTK_STACK (stack), TRUE); gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT); - gtk_container_add (GTK_CONTAINER (box), stack); + gtk_box_append (GTK_BOX (box), stack); g_object_set_data (G_OBJECT (child), "stack", stack); g_variant_get_child (emoji_data, 2, "&s", &shortname); @@ -548,11 +548,11 @@ populate_completion (GtkEmojiCompletion *completion, const char *text, guint offset) { - GtkWidget *child; guint n_matches; guint n_added; GVariantIter iter; GVariant *item; + GtkWidget *child; if (completion->text != text) { @@ -563,7 +563,7 @@ populate_completion (GtkEmojiCompletion *completion, completion->offset = offset; while ((child = gtk_widget_get_first_child (completion->list))) - gtk_container_remove (GTK_CONTAINER (completion->list), child); + gtk_list_box_remove (GTK_LIST_BOX (completion->list), child); completion->active = NULL; diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 2aa691fe65..e2128842db 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -609,7 +609,7 @@ gtk_entry_completion_constructed (GObject *object) priv->tree_view); gtk_widget_set_hexpand (priv->scrolled_window, TRUE); gtk_widget_set_vexpand (priv->scrolled_window, TRUE); - gtk_container_add (GTK_CONTAINER (priv->vbox), priv->scrolled_window); + gtk_box_append (GTK_BOX (priv->vbox), priv->scrolled_window); /* we don't want to see the action treeview when no actions have * been inserted, so we pack the action treeview after the first @@ -1197,7 +1197,7 @@ gtk_entry_completion_insert_action (GtkEntryCompletion *completion, path, NULL, FALSE); gtk_tree_path_free (path); - gtk_container_add (GTK_CONTAINER (completion->priv->vbox), + gtk_box_append (GTK_BOX (completion->priv->vbox), completion->priv->action_view); gtk_widget_show (completion->priv->action_view); } diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 25995648ad..819af9d502 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -27,10 +27,10 @@ * A #GtkExpander allows the user to hide or show its child by clicking * on an expander triangle similar to the triangles used in a #GtkTreeView. * - * Normally you use an expander as you would use a descendant - * of #GtkBin; you create the child widget and use gtk_container_add() - * to add it to the expander. When the expander is toggled, it will take - * care of showing and hiding the child automatically. + * Normally you use an expander as you would use a frame; you create + * the child widget and use gtk_expander_set_child() to add it to the + * expander. When the expander is toggled, it will take care of showing + * and hiding the child automatically. * * # Special Usage * @@ -402,13 +402,13 @@ gtk_expander_init (GtkExpander *expander) gtk_widget_set_parent (expander->box, GTK_WIDGET (expander)); expander->title_widget = g_object_new (GTK_TYPE_BOX, - "css-name", "title", - NULL); - gtk_container_add (GTK_CONTAINER (expander->box), expander->title_widget); + "css-name", "title", + NULL); + gtk_box_append (GTK_BOX (expander->box), expander->title_widget); expander->arrow_widget = gtk_builtin_icon_new ("expander"); gtk_widget_add_css_class (expander->arrow_widget, GTK_STYLE_CLASS_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (expander->title_widget), expander->arrow_widget); + gtk_box_append (GTK_BOX (expander->title_widget), expander->arrow_widget); controller = gtk_drop_controller_motion_new (); g_signal_connect (controller, "enter", G_CALLBACK (gtk_expander_drag_enter), expander); @@ -871,13 +871,13 @@ gtk_expander_set_expanded (GtkExpander *expander, { if (expander->expanded) { - gtk_container_add (GTK_CONTAINER (expander->box), child); + gtk_box_append (GTK_BOX (expander->box), child); g_object_unref (expander->child); } else { g_object_ref (expander->child); - gtk_container_remove (GTK_CONTAINER (expander->box), child); + gtk_box_remove (GTK_BOX (expander->box), child); } gtk_expander_resize_toplevel (expander); } @@ -1081,9 +1081,7 @@ gtk_expander_set_label_widget (GtkExpander *expander, return; if (expander->label_widget) - { - gtk_container_remove (GTK_CONTAINER (expander->title_widget), expander->label_widget); - } + gtk_box_remove (GTK_BOX (expander->title_widget), expander->label_widget); expander->label_widget = label_widget; widget = GTK_WIDGET (expander); @@ -1092,7 +1090,7 @@ gtk_expander_set_label_widget (GtkExpander *expander, { expander->label_widget = label_widget; - gtk_container_add (GTK_CONTAINER (expander->title_widget), label_widget); + gtk_box_append (GTK_BOX (expander->title_widget), label_widget); } if (gtk_widget_get_visible (widget)) @@ -1176,7 +1174,7 @@ gtk_expander_set_child (GtkExpander *expander, if (expander->child) { - gtk_container_remove (GTK_CONTAINER (expander->box), expander->child); + gtk_box_remove (GTK_BOX (expander->box), expander->child); if (!expander->expanded) g_object_unref (expander->child); } @@ -1186,7 +1184,7 @@ gtk_expander_set_child (GtkExpander *expander, if (expander->child) { if (expander->expanded) - gtk_container_add (GTK_CONTAINER (expander->box), expander->child); + gtk_box_append (GTK_BOX (expander->box), expander->child); else { if (g_object_is_floating (expander->child)) diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 29cc1e467f..277b3164f9 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -556,11 +556,11 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) icon = gtk_image_new_from_icon_name ("document-open-symbolic"); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_valign (button->image, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (box), button->image); + gtk_box_append (GTK_BOX (box), button->image); gtk_widget_set_valign (button->label, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (box), button->label); + gtk_box_append (GTK_BOX (box), button->label); gtk_widget_set_valign (icon, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (box), icon); + gtk_box_append (GTK_BOX (box), icon); gtk_button_set_child (GTK_BUTTON (button->button), box); gtk_widget_set_parent (button->button, GTK_WIDGET (button)); diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index 6cb112d0ba..8449c321a6 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -565,8 +565,8 @@ setup_save_entry (GtkFileChooserDialog *dialog) g_object_set (label, "margin-start", 6, "margin-end", 6, NULL); g_object_set (entry, "margin-start", 6, "margin-end", 6, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); - gtk_container_add (GTK_CONTAINER (box), label); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), label); + gtk_box_append (GTK_BOX (box), entry); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header), box); gtk_file_chooser_widget_set_save_entry (GTK_FILE_CHOOSER_WIDGET (priv->widget), entry); diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index ca2e03a4f9..ab36bded5a 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -2321,7 +2321,7 @@ save_widgets_create (GtkFileChooserWidget *impl) gtk_widget_add_css_class (vbox, "search-bar"); impl->save_widgets_table = gtk_grid_new (); - gtk_container_add (GTK_CONTAINER (vbox), impl->save_widgets_table); + gtk_box_append (GTK_BOX (vbox), impl->save_widgets_table); gtk_grid_set_row_spacing (GTK_GRID (impl->save_widgets_table), 12); gtk_grid_set_column_spacing (GTK_GRID (impl->save_widgets_table), 12); @@ -2360,7 +2360,7 @@ save_widgets_destroy (GtkFileChooserWidget *impl) if (impl->save_widgets == NULL) return; - gtk_container_remove (GTK_CONTAINER (impl->box), impl->save_widgets); + gtk_box_remove (GTK_BOX (impl->box), impl->save_widgets); impl->save_widgets = NULL; impl->save_widgets_table = NULL; impl->location_entry = NULL; @@ -2372,13 +2372,7 @@ save_widgets_destroy (GtkFileChooserWidget *impl) static void location_switch_to_path_bar (GtkFileChooserWidget *impl) { - if (impl->location_entry) - { - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (impl->location_entry)), - impl->location_entry); - impl->location_entry = NULL; - } - + g_clear_pointer (&impl->location_entry, gtk_widget_unparent); gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "pathbar"); } @@ -2400,7 +2394,7 @@ location_switch_to_filename_entry (GtkFileChooserWidget *impl) if (!impl->location_entry) { location_entry_create (impl); - gtk_container_add (GTK_CONTAINER (impl->location_entry_box), impl->location_entry); + gtk_box_append (GTK_BOX (impl->location_entry_box), impl->location_entry); } _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder); @@ -2541,14 +2535,14 @@ set_extra_widget (GtkFileChooserWidget *impl, if (impl->extra_widget) { - gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget); + gtk_box_remove (GTK_BOX (impl->extra_align), impl->extra_widget); g_object_unref (impl->extra_widget); } impl->extra_widget = extra_widget; if (impl->extra_widget) { - gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget); + gtk_box_append (GTK_BOX (impl->extra_align), impl->extra_widget); gtk_widget_show (impl->extra_align); } else @@ -7947,11 +7941,11 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser, int i; box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new (label)); + gtk_box_append (GTK_BOX (box), gtk_label_new (label)); combo = gtk_combo_box_text_new (); g_hash_table_insert (impl->choices, g_strdup (id), combo); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); for (i = 0; options[i]; i++) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), @@ -7969,7 +7963,7 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser, widget = check; } - gtk_container_add (GTK_CONTAINER (impl->choice_box), widget); + gtk_box_append (GTK_BOX (impl->choice_box), widget); } static void @@ -7984,7 +7978,7 @@ gtk_file_chooser_widget_remove_choice (GtkFileChooser *chooser, widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id); g_hash_table_remove (impl->choices, id); - gtk_container_remove (GTK_CONTAINER (impl->choice_box), widget); + gtk_box_remove (GTK_BOX (impl->choice_box), widget); if (g_hash_table_size (impl->choices) == 0) { diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index a0a9e0162f..86121c2e2a 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -552,11 +552,11 @@ gtk_font_button_init (GtkFontButton *font_button) font_button->font_size_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box), font_button->font_label); + gtk_box_append (GTK_BOX (box), font_button->font_label); - gtk_container_add (GTK_CONTAINER (font_button->font_size_box), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); - gtk_container_add (GTK_CONTAINER (font_button->font_size_box), font_button->size_label); - gtk_container_add (GTK_CONTAINER (box), font_button->font_size_box); + gtk_box_append (GTK_BOX (font_button->font_size_box), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); + gtk_box_append (GTK_BOX (font_button->font_size_box), font_button->size_label); + gtk_box_append (GTK_BOX (box), font_button->font_size_box); gtk_button_set_child (GTK_BUTTON (font_button->button), box); gtk_widget_set_parent (font_button->button, GTK_WIDGET (font_button)); diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 0bd544d4d1..c3aea05c8d 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -1961,7 +1961,7 @@ add_check_group (GtkFontChooserWidget *fontchooser, pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); - gtk_container_add (GTK_CONTAINER (group), label); + gtk_box_append (GTK_BOX (group), label); for (i = 0; tags[i]; i++) { @@ -1991,9 +1991,9 @@ add_check_group (GtkFontChooserWidget *fontchooser, box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); - gtk_container_add (GTK_CONTAINER (box), feat); - gtk_container_add (GTK_CONTAINER (box), example); - gtk_container_add (GTK_CONTAINER (group), box); + gtk_box_append (GTK_BOX (box), feat); + gtk_box_append (GTK_BOX (box), example); + gtk_box_append (GTK_BOX (group), box); item = g_new (FeatureItem, 1); item->name = tags[i]; @@ -2005,7 +2005,7 @@ add_check_group (GtkFontChooserWidget *fontchooser, fontchooser->feature_items = g_list_prepend (fontchooser->feature_items, item); } - gtk_container_add (GTK_CONTAINER (fontchooser->feature_box), group); + gtk_box_append (GTK_BOX (fontchooser->feature_box), group); } static void @@ -2030,7 +2030,7 @@ add_radio_group (GtkFontChooserWidget *fontchooser, pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); - gtk_container_add (GTK_CONTAINER (group), label); + gtk_box_append (GTK_BOX (group), label); for (i = 0; tags[i]; i++) { @@ -2058,9 +2058,9 @@ add_radio_group (GtkFontChooserWidget *fontchooser, box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); - gtk_container_add (GTK_CONTAINER (box), feat); - gtk_container_add (GTK_CONTAINER (box), example); - gtk_container_add (GTK_CONTAINER (group), box); + gtk_box_append (GTK_BOX (box), feat); + gtk_box_append (GTK_BOX (box), example); + gtk_box_append (GTK_BOX (group), box); item = g_new (FeatureItem, 1); item->name = tags[i]; @@ -2072,7 +2072,7 @@ add_radio_group (GtkFontChooserWidget *fontchooser, fontchooser->feature_items = g_list_prepend (fontchooser->feature_items, item); } - gtk_container_add (GTK_CONTAINER (fontchooser->feature_box), group); + gtk_box_append (GTK_BOX (fontchooser->feature_box), group); } static void diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index 089e977cb6..2a1fec3491 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -44,13 +44,9 @@ * * Children are added using gtk_grid_attach(). They can span multiple * rows or columns. It is also possible to add a child next to an - * existing child, using gtk_grid_attach_next_to(). The behaviour of - * GtkGrid when several children occupy the same grid cell is undefined. - * - * GtkGrid can be used like a #GtkBox by just using gtk_container_add(), - * which will place children next to each other in the direction determined - * by the #GtkOrientable:orientation property. However, if all you want is a - * single row or column, then #GtkBox is the preferred widget. + * existing child, using gtk_grid_attach_next_to(). To remove a child + * from the grid, use gtk_grid_remove(). The behaviour of GtkGrid when + * several children occupy the same grid cell is undefined. * * # CSS nodes * @@ -724,7 +720,7 @@ gtk_grid_remove_row (GtkGrid *grid, if (height <= 0) { - gtk_container_remove (GTK_CONTAINER (grid), child); + gtk_grid_remove (grid, child); } else { @@ -814,7 +810,7 @@ gtk_grid_remove_column (GtkGrid *grid, if (width <= 0) { - gtk_container_remove (GTK_CONTAINER (grid), child); + gtk_grid_remove (grid, child); } else { diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 3b27e5ff08..c8579568ab 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -171,7 +171,7 @@ create_window_controls (GtkHeaderBar *bar) g_object_bind_property (controls, "empty", controls, "visible", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); - gtk_container_add (GTK_CONTAINER (priv->start_box), controls); + gtk_box_append (GTK_BOX (priv->start_box), controls); priv->start_window_controls = controls; controls = gtk_window_controls_new (GTK_PACK_END); @@ -181,7 +181,7 @@ create_window_controls (GtkHeaderBar *bar) g_object_bind_property (controls, "empty", controls, "visible", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); - gtk_container_add (GTK_CONTAINER (priv->end_box), controls); + gtk_box_append (GTK_BOX (priv->end_box), controls); priv->end_window_controls = controls; } @@ -474,11 +474,11 @@ gtk_header_bar_pack (GtkHeaderBar *bar, if (pack_type == GTK_PACK_START) { - gtk_container_add (GTK_CONTAINER (priv->start_box), widget); + gtk_box_append (GTK_BOX (priv->start_box), widget); } else if (pack_type == GTK_PACK_END) { - gtk_container_add (GTK_CONTAINER (priv->end_box), widget); + gtk_box_append (GTK_BOX (priv->end_box), widget); gtk_box_reorder_child_after (GTK_BOX (priv->end_box), widget, NULL); } @@ -507,12 +507,12 @@ gtk_header_bar_remove (GtkHeaderBar *bar, if (parent == priv->start_box) { - gtk_container_remove (GTK_CONTAINER (priv->start_box), child); + gtk_box_remove (GTK_BOX (priv->start_box), child); removed = TRUE; } else if (parent == priv->end_box) { - gtk_container_remove (GTK_CONTAINER (priv->end_box), child); + gtk_box_remove (GTK_BOX (priv->end_box), child); removed = TRUE; } else if (parent == priv->center_box) diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c index 584c6fd043..c3657ece49 100644 --- a/gtk/gtkinfobar.c +++ b/gtk/gtkinfobar.c @@ -300,25 +300,19 @@ static GtkWidget * find_button (GtkInfoBar *info_bar, gint response_id) { - GList *children, *list; - GtkWidget *child = NULL; + GtkWidget *child; - children = gtk_container_get_children (GTK_CONTAINER (info_bar->action_area)); - - for (list = children; list; list = list->next) + for (child = gtk_widget_get_first_child (info_bar->action_area); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - ResponseData *rd = get_response_data (list->data, FALSE); + ResponseData *rd = get_response_data (child, FALSE); if (rd && rd->response_id == response_id) - { - child = list->data; - break; - } + return child; } - g_list_free (children); - - return child; + return NULL; } static void @@ -474,18 +468,18 @@ gtk_info_bar_init (GtkInfoBar *info_bar) info_bar->content_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_hexpand (info_bar->content_area, TRUE); - gtk_container_add (GTK_CONTAINER (main_box), info_bar->content_area); + gtk_box_append (GTK_BOX (main_box), info_bar->content_area); info_bar->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign (info_bar->action_area, GTK_ALIGN_END); gtk_widget_set_valign (info_bar->action_area, GTK_ALIGN_CENTER); - gtk_container_add (GTK_CONTAINER (main_box), info_bar->action_area); + gtk_box_append (GTK_BOX (main_box), info_bar->action_area); info_bar->close_button = gtk_button_new_from_icon_name ("window-close-symbolic"); gtk_widget_hide (info_bar->close_button); gtk_widget_set_valign (info_bar->close_button, GTK_ALIGN_CENTER); gtk_widget_add_css_class (info_bar->close_button, "close"); - gtk_container_add (GTK_CONTAINER (main_box), info_bar->close_button); + gtk_box_append (GTK_BOX (main_box), info_bar->close_button); g_signal_connect (info_bar->close_button, "clicked", G_CALLBACK (close_button_clicked_cb), info_bar); @@ -573,7 +567,7 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar, else g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkInfoBar"); - gtk_container_add (GTK_CONTAINER (info_bar->action_area), child); + gtk_box_append (GTK_BOX (info_bar->action_area), child); } /** @@ -595,7 +589,7 @@ gtk_info_bar_remove_action_widget (GtkInfoBar *info_bar, clear_response_data (widget); - gtk_container_remove (GTK_CONTAINER (info_bar->action_area), widget); + gtk_box_remove (GTK_BOX (info_bar->action_area), widget); } /** @@ -758,23 +752,20 @@ gtk_info_bar_set_response_sensitive (GtkInfoBar *info_bar, gint response_id, gboolean setting) { - GList *children, *list; + GtkWidget *child; g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); - children = gtk_container_get_children (GTK_CONTAINER (info_bar->action_area)); - - for (list = children; list; list = list->next) + for (child = gtk_widget_get_first_child (info_bar->action_area); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - GtkWidget *widget = list->data; - ResponseData *rd = get_response_data (widget, FALSE); + ResponseData *rd = get_response_data (child, FALSE); if (rd && rd->response_id == response_id) - gtk_widget_set_sensitive (widget, setting); + gtk_widget_set_sensitive (child, setting); } - g_list_free (children); - if (response_id == info_bar->default_response) update_default_response (info_bar, response_id, setting); } @@ -795,30 +786,28 @@ void gtk_info_bar_set_default_response (GtkInfoBar *info_bar, gint response_id) { - GList *children, *list; + GtkWidget *child; + GtkWidget *window; gboolean sensitive = TRUE; g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); - children = gtk_container_get_children (GTK_CONTAINER (info_bar->action_area)); + window = gtk_widget_get_ancestor (GTK_WIDGET (info_bar), GTK_TYPE_WINDOW); - for (list = children; list; list = list->next) + for (child = gtk_widget_get_first_child (info_bar->action_area); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - GtkWidget *widget = list->data; - ResponseData *rd = get_response_data (widget, FALSE); + ResponseData *rd = get_response_data (child, FALSE); if (rd && rd->response_id == response_id) { - GtkWidget *window; - - window = gtk_widget_get_ancestor (GTK_WIDGET (info_bar), GTK_TYPE_WINDOW); - gtk_window_set_default_widget (GTK_WINDOW (window), widget); - sensitive = gtk_widget_get_sensitive (widget); + gtk_window_set_default_widget (GTK_WINDOW (window), child); + sensitive = gtk_widget_get_sensitive (child); + break; } } - g_list_free (children); - update_default_response (info_bar, response_id, sensitive); } @@ -1061,7 +1050,7 @@ gtk_info_bar_buildable_add_child (GtkBuildable *buildable, if (!type && GTK_IS_WIDGET (child)) gtk_info_bar_add_child (GTK_INFO_BAR (info_bar), GTK_WIDGET (child)); else if (g_strcmp0 (type, "action") == 0) - gtk_container_add (GTK_CONTAINER (info_bar->action_area), GTK_WIDGET (child)); + gtk_box_append (GTK_BOX (info_bar->action_area), GTK_WIDGET (child)); else parent_buildable_iface->add_child (buildable, builder, child, type); } @@ -1251,7 +1240,7 @@ gtk_info_bar_add_child (GtkInfoBar *info_bar, g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); g_return_if_fail (GTK_IS_WIDGET (widget)); - gtk_container_add (GTK_CONTAINER (info_bar->content_area), widget); + gtk_box_append (GTK_BOX (info_bar->content_area), widget); } /** @@ -1269,6 +1258,6 @@ gtk_info_bar_remove_child (GtkInfoBar *info_bar, g_return_if_fail (GTK_IS_INFO_BAR (info_bar)); g_return_if_fail (GTK_IS_WIDGET (widget)); - gtk_container_remove (GTK_CONTAINER (info_bar->content_area), widget); + gtk_box_remove (GTK_BOX (info_bar->content_area), widget); } diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index 464ee6a685..ebb17a01da 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -889,8 +889,8 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button, gtk_button_get_use_underline (GTK_BUTTON (menu_button->button))); gtk_widget_set_hexpand (label_widget, TRUE); image = gtk_image_new_from_icon_name ("pan-down-symbolic"); - gtk_container_add (GTK_CONTAINER (box), label_widget); - gtk_container_add (GTK_CONTAINER (box), image); + gtk_box_append (GTK_BOX (box), label_widget); + gtk_box_append (GTK_BOX (box), image); gtk_button_set_child (GTK_BUTTON (menu_button->button), box); menu_button->label_widget = label_widget; diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c index 072b3287ca..f014502460 100644 --- a/gtk/gtkmenusectionbox.c +++ b/gtk/gtkmenusectionbox.c @@ -70,18 +70,6 @@ static void gtk_menu_section_box_new_submenu (GtkMenuTrackerItem *ite static GtkWidget * gtk_menu_section_box_new_section (GtkMenuTrackerItem *item, GtkMenuSectionBox *parent); -static void -gtk_menu_section_box_sync_item (GtkWidget *widget, - gpointer user_data) -{ - MenuData *data = (MenuData *)user_data; - - if (GTK_IS_MENU_SECTION_BOX (widget)) - gtk_menu_section_box_sync_separators (GTK_MENU_SECTION_BOX (widget), data); - else - data->n_items++; -} - /* We are trying to implement the following rules here: * * rule 1: never ever show separators for empty sections @@ -104,11 +92,20 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box, gboolean has_label; gboolean separator_condition; gint n_items_before; + GtkWidget *child; n_items_before = data->n_items; previous_section_is_iconic = data->previous_is_iconic; - gtk_container_foreach (GTK_CONTAINER (box->item_box), gtk_menu_section_box_sync_item, data); + for (child = gtk_widget_get_first_child (GTK_WIDGET (box->item_box)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + { + if (GTK_IS_MENU_SECTION_BOX (child)) + gtk_menu_section_box_sync_separators (GTK_MENU_SECTION_BOX (child), data); + else + data->n_items++; + } is_not_empty_item = (data->n_items > n_items_before); @@ -148,7 +145,7 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box, if (should_have_separator) gtk_box_insert_child_after (GTK_BOX (box), box->separator, NULL); else - gtk_container_remove (GTK_CONTAINER (box), box->separator); + gtk_box_remove (GTK_BOX (box), box->separator); } static gboolean @@ -212,11 +209,15 @@ gtk_menu_section_box_remove_func (gint position, GtkMenuSectionBox *box = user_data; GtkMenuTrackerItem *item; GtkWidget *widget; - GList *children; + int pos; - children = gtk_container_get_children (GTK_CONTAINER (box->item_box)); - - widget = g_list_nth_data (children, position); + for (widget = gtk_widget_get_first_child (GTK_WIDGET (box->item_box)), pos = 0; + widget != NULL; + widget = gtk_widget_get_next_sibling (widget), pos++) + { + if (pos == position) + break; + } item = g_object_get_data (G_OBJECT (widget), "GtkMenuTrackerItem"); if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU)) @@ -229,9 +230,7 @@ gtk_menu_section_box_remove_func (gint position, gtk_stack_remove (GTK_STACK (stack), subbox); } - gtk_container_remove (GTK_CONTAINER (box->item_box), - g_list_nth_data (children, position)); - g_list_free (children); + gtk_box_remove (GTK_BOX (box->item_box), widget); gtk_menu_section_box_schedule_separator_sync (box); } @@ -387,7 +386,7 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item, { gtk_widget_set_halign (widget, GTK_ALIGN_FILL); } - gtk_container_add (GTK_CONTAINER (box->item_box), widget); + gtk_box_append (GTK_BOX (box->item_box), widget); if (position == 0) gtk_box_reorder_child_after (GTK_BOX (box->item_box), widget, NULL); @@ -434,7 +433,7 @@ gtk_menu_section_box_init (GtkMenuSectionBox *box) item_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box->item_box = GTK_BOX (item_box); - gtk_container_add (GTK_CONTAINER (box), item_box); + gtk_box_append (GTK_BOX (box), item_box); gtk_widget_set_halign (GTK_WIDGET (item_box), GTK_ALIGN_FILL); gtk_widget_set_halign (GTK_WIDGET (box), GTK_ALIGN_FILL); } @@ -602,7 +601,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item, gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons"); spacer = gtk_builtin_icon_new ("none"); - gtk_container_add (GTK_CONTAINER (box->item_box), spacer); + gtk_box_append (GTK_BOX (box->item_box), spacer); gtk_size_group_add_widget (box->indicators, spacer); if (label != NULL) @@ -613,11 +612,11 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item, gtk_widget_set_hexpand (title, TRUE); gtk_widget_set_halign (title, GTK_ALIGN_START); g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (box->item_box), title); + gtk_box_append (GTK_BOX (box->item_box), title); } item_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (box->item_box), item_box); + gtk_box_append (GTK_BOX (box->item_box), item_box); box->item_box = GTK_BOX (item_box); } else if (hint && g_str_equal (hint, "circular-buttons")) @@ -639,7 +638,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item, separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_valign (separator, GTK_ALIGN_CENTER); gtk_widget_set_hexpand (separator, TRUE); - gtk_container_add (GTK_CONTAINER (box->separator), separator); + gtk_box_append (GTK_BOX (box->separator), separator); title = gtk_label_new (label); g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE); @@ -647,7 +646,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item, gtk_widget_set_halign (title, GTK_ALIGN_START); gtk_label_set_xalign (GTK_LABEL (title), 0.0); gtk_widget_add_css_class (title, GTK_STYLE_CLASS_TITLE); - gtk_container_add (GTK_CONTAINER (box->separator), title); + gtk_box_append (GTK_BOX (box->separator), title); } else { diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 1f6abc9e9f..be0b4afe2c 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -367,7 +367,7 @@ gtk_message_dialog_constructed (GObject *object) gtk_widget_set_halign (label, GTK_ALIGN_CENTER); gtk_widget_set_hexpand (label, TRUE); gtk_widget_add_css_class (label, "title"); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); g_signal_connect_object (dialog, "notify::title", G_CALLBACK (update_title), label, 0); gtk_window_set_titlebar (GTK_WINDOW (dialog), box); diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index 1737137878..d6147d6327 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -509,7 +509,7 @@ update_node_name (GtkModelButton *self) gtk_widget_set_valign (self->start_indicator, GTK_ALIGN_CENTER); update_start_indicator (self); - gtk_container_add (GTK_CONTAINER (self->start_box), self->start_indicator); + gtk_box_append (GTK_BOX (self->start_box), self->start_indicator); } else if (start_name) { @@ -517,7 +517,7 @@ update_node_name (GtkModelButton *self) } else if (self->start_indicator) { - gtk_container_remove (GTK_CONTAINER (self->start_box), self->start_indicator); + gtk_box_remove (GTK_BOX (self->start_box), self->start_indicator); self->start_indicator = NULL; } @@ -699,7 +699,7 @@ gtk_model_button_set_iconic (GtkModelButton *self, { if (self->start_indicator) { - gtk_container_remove (GTK_CONTAINER (self->start_box), self->start_indicator); + gtk_box_remove (GTK_BOX (self->start_box), self->start_indicator); self->start_indicator = NULL; } g_clear_pointer (&self->end_indicator, gtk_widget_unparent); diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 4b1c8d6651..1347cd489e 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -612,17 +612,17 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, /* Build contents */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - gtk_container_add (GTK_CONTAINER (content_area), hbox); + gtk_box_append (GTK_BOX (content_area), hbox); icon = gtk_image_new_from_icon_name ("dialog-password"); gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE); gtk_widget_set_halign (icon, GTK_ALIGN_CENTER); gtk_widget_set_valign (icon, GTK_ALIGN_START); - gtk_container_add (GTK_CONTAINER (hbox), icon); + gtk_box_append (GTK_BOX (hbox), icon); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); - gtk_container_add (GTK_CONTAINER (hbox), main_vbox); + gtk_box_append (GTK_BOX (hbox), main_vbox); secondary = strstr (message, "\n"); if (secondary != NULL) @@ -638,7 +638,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_label_set_wrap (GTK_LABEL (label), TRUE); - gtk_container_add (GTK_CONTAINER (main_vbox), GTK_WIDGET (label)); + gtk_box_append (GTK_BOX (main_vbox), GTK_WIDGET (label)); g_free (primary); attrs = pango_attr_list_new (); pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); @@ -651,7 +651,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_label_set_wrap (GTK_LABEL (label), TRUE); - gtk_container_add (GTK_CONTAINER (main_vbox), GTK_WIDGET (label)); + gtk_box_append (GTK_BOX (main_vbox), GTK_WIDGET (label)); } grid = gtk_grid_new (); @@ -659,7 +659,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, gtk_grid_set_row_spacing (GTK_GRID (grid), 12); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_widget_set_margin_bottom (grid, 12); - gtk_container_add (GTK_CONTAINER (main_vbox), grid); + gtk_box_append (GTK_BOX (main_vbox), grid); can_anonymous = priv->ask_flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED; @@ -682,7 +682,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, gtk_grid_attach (GTK_GRID (grid), anon_box, 1, rows++, 1, 1); choice = gtk_radio_button_new_with_mnemonic (NULL, _("_Anonymous")); - gtk_container_add (GTK_CONTAINER (anon_box), + gtk_box_append (GTK_BOX (anon_box), choice); g_signal_connect (choice, "toggled", G_CALLBACK (pw_dialog_anonymous_toggled), operation); @@ -690,7 +690,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Registered U_ser")); - gtk_container_add (GTK_CONTAINER (anon_box), + gtk_box_append (GTK_BOX (anon_box), choice); g_signal_connect (choice, "toggled", G_CALLBACK (pw_dialog_anonymous_toggled), operation); @@ -724,10 +724,10 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, priv->user_widgets = g_list_prepend (priv->user_widgets, volume_type_box); priv->tcrypt_hidden_toggle = gtk_check_button_new_with_mnemonic (_("_Hidden")); - gtk_container_add (GTK_CONTAINER (volume_type_box), priv->tcrypt_hidden_toggle); + gtk_box_append (GTK_BOX (volume_type_box), priv->tcrypt_hidden_toggle); priv->tcrypt_system_toggle = gtk_check_button_new_with_mnemonic (_("_Windows system")); - gtk_container_add (GTK_CONTAINER (volume_type_box), priv->tcrypt_system_toggle); + gtk_box_append (GTK_BOX (volume_type_box), priv->tcrypt_system_toggle); priv->pim_entry = table_add_entry (operation, rows++, _("_PIM"), NULL, operation); } @@ -752,7 +752,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, priv->user_widgets = g_list_prepend (priv->user_widgets, remember_box); label = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (remember_box), label); + gtk_box_append (GTK_BOX (remember_box), label); password_save = g_mount_operation_get_password_save (G_MOUNT_OPERATION (operation)); priv->password_save = password_save; @@ -764,7 +764,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); - gtk_container_add (GTK_CONTAINER (remember_box), choice); + gtk_box_append (GTK_BOX (remember_box), choice); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember password until you _logout")); @@ -774,7 +774,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); - gtk_container_add (GTK_CONTAINER (remember_box), choice); + gtk_box_append (GTK_BOX (remember_box), choice); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember _forever")); @@ -784,7 +784,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); - gtk_container_add (GTK_CONTAINER (remember_box), choice); + gtk_box_append (GTK_BOX (remember_box), choice); } g_signal_connect (G_OBJECT (dialog), "response", @@ -1430,7 +1430,7 @@ do_popup_menu_for_process_tree_view (GtkWidget *widget, g_signal_connect (item, "clicked", G_CALLBACK (on_end_process_activated), op); - gtk_container_add (GTK_CONTAINER (menu), item); + gtk_box_append (GTK_BOX (menu), item); if (event && gdk_event_triggers_context_menu (event)) { @@ -1538,7 +1538,7 @@ create_show_processes_dialog (GtkMountOperation *op, content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - gtk_container_add (GTK_CONTAINER (content_area), vbox); + gtk_box_append (GTK_BOX (content_area), vbox); if (secondary != NULL) s = g_strdup_printf ("%s\n\n%s", primary, secondary); @@ -1549,7 +1549,7 @@ create_show_processes_dialog (GtkMountOperation *op, label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), s); g_free (s); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* First count the items in the list then * add the buttons in reverse order @@ -1599,7 +1599,7 @@ create_show_processes_dialog (GtkMountOperation *op, gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (scrolled_window), TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled_window), tree_view); - gtk_container_add (GTK_CONTAINER (vbox), scrolled_window); + gtk_box_append (GTK_BOX (vbox), scrolled_window); controller = gtk_shortcut_controller_new (); trigger = gtk_alternative_trigger_new (gtk_keyval_trigger_new (GDK_KEY_F10, GDK_SHIFT_MASK), diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 89d3aa43ea..08beb715a8 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -876,8 +876,7 @@ static void gtk_notebook_menu_item_create (GtkNotebook *notebook, GtkNotebookPage *page); static void gtk_notebook_menu_item_recreate (GtkNotebook *notebook, GList *list); -static void gtk_notebook_menu_label_unparent (GtkWidget *widget, - gpointer data); +static void gtk_notebook_menu_label_unparent (GtkWidget *widget); static void gtk_notebook_update_tab_pos (GtkNotebook *notebook); @@ -1418,7 +1417,7 @@ gtk_notebook_init (GtkNotebook *notebook) (GtkGizmoFocusFunc)gtk_widget_focus_self, (GtkGizmoGrabFocusFunc)gtk_widget_grab_focus_self); gtk_widget_set_hexpand (notebook->tabs_widget, TRUE); - gtk_container_add (GTK_CONTAINER (notebook->header_widget), notebook->tabs_widget); + gtk_box_append (GTK_BOX (notebook->header_widget), notebook->tabs_widget); notebook->stack_widget = gtk_stack_new (); gtk_widget_set_hexpand (notebook->stack_widget, TRUE); @@ -2659,7 +2658,7 @@ tab_drag_end (GtkNotebook *notebook, if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page)) { g_object_ref (page->tab_label); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (page->tab_label)), page->tab_label); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (page->tab_label)), page->tab_label); gtk_widget_set_parent (page->tab_label, page->tab_widget); g_object_unref (page->tab_label); } @@ -4109,7 +4108,7 @@ gtk_notebook_remove_tab_label (GtkNotebook *notebook, /* we hit this condition during dnd of a detached tab */ parent = gtk_widget_get_parent (page->tab_label); if (GTK_IS_WINDOW (parent)) - gtk_container_remove (GTK_CONTAINER (parent), page->tab_label); + gtk_box_remove (GTK_BOX (parent), page->tab_label); else gtk_widget_unparent (page->tab_label); } @@ -4188,7 +4187,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook, GtkWidget *parent = gtk_widget_get_parent (page->menu_label); if (parent) - gtk_notebook_menu_label_unparent (parent, NULL); + gtk_notebook_menu_label_unparent (parent); gtk_popover_set_child (GTK_POPOVER (notebook->menu), NULL); gtk_widget_queue_resize (notebook->menu); @@ -5490,7 +5489,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook, menu_item = gtk_button_new (); gtk_button_set_has_frame (GTK_BUTTON (menu_item), FALSE); gtk_button_set_child (GTK_BUTTON (menu_item), page->menu_label); - gtk_container_add (GTK_CONTAINER (notebook->menu_box), menu_item); + gtk_box_append (GTK_BOX (notebook->menu_box), menu_item); g_signal_connect (menu_item, "clicked", G_CALLBACK (gtk_notebook_menu_switch_page), page); if (!gtk_widget_get_visible (page->child)) @@ -5504,14 +5503,13 @@ gtk_notebook_menu_item_recreate (GtkNotebook *notebook, GtkNotebookPage *page = list->data; GtkWidget *menu_item = gtk_widget_get_parent (page->menu_label); - gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label); + gtk_box_remove (GTK_BOX (menu_item), page->menu_label); gtk_widget_unparent (menu_item); gtk_notebook_menu_item_create (notebook, page); } static void -gtk_notebook_menu_label_unparent (GtkWidget *widget, - gpointer data) +gtk_notebook_menu_label_unparent (GtkWidget *widget) { gtk_button_set_child (GTK_BUTTON (widget), NULL); } @@ -6333,14 +6331,17 @@ gtk_notebook_popup_enable (GtkNotebook *notebook) void gtk_notebook_popup_disable (GtkNotebook *notebook) { + GtkWidget *child; + g_return_if_fail (GTK_IS_NOTEBOOK (notebook)); if (!notebook->menu) return; - gtk_container_foreach (GTK_CONTAINER (notebook->menu_box), - (GtkCallback) gtk_notebook_menu_label_unparent, NULL); - + for (child = gtk_widget_get_first_child (notebook->menu_box); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + gtk_notebook_menu_label_unparent (child); notebook->menu = NULL; notebook->menu_box = NULL; @@ -6995,13 +6996,13 @@ gtk_notebook_set_action_widget (GtkNotebook *notebook, g_return_if_fail (!widget || gtk_widget_get_parent (widget) == NULL); if (notebook->action_widget[pack_type]) - gtk_container_remove (GTK_CONTAINER (notebook->header_widget), notebook->action_widget[pack_type]); + gtk_box_remove (GTK_BOX (notebook->header_widget), notebook->action_widget[pack_type]); notebook->action_widget[pack_type] = widget; if (widget) { - gtk_container_add (GTK_CONTAINER (notebook->header_widget), widget); + gtk_box_append (GTK_BOX (notebook->header_widget), widget); if (pack_type == GTK_PACK_START) gtk_box_reorder_child_after (GTK_BOX (notebook->header_widget), widget, NULL); else diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index dd6c16acd7..bb3ad6797f 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -2123,10 +2123,14 @@ get_child_panes (GtkWidget *widget, *panes = g_list_prepend (*panes, widget); get_child_panes (priv->end_child, panes); } - else if (GTK_IS_CONTAINER (widget)) + else { - gtk_container_forall (GTK_CONTAINER (widget), - (GtkCallback)get_child_panes, panes); + GtkWidget *child; + + for (child = gtk_widget_get_first_child (widget); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + get_child_panes (child, panes); } } diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index c794f56dc2..ce7ac14e2d 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1047,8 +1047,8 @@ make_directory_button (GtkPathBar *path_bar, button_data->image = gtk_image_new (); button_data->label = gtk_label_new (NULL); child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_container_add (GTK_CONTAINER (child), button_data->image); - gtk_container_add (GTK_CONTAINER (child), button_data->label); + gtk_box_append (GTK_BOX (child), button_data->image); + gtk_box_append (GTK_BOX (child), button_data->label); break; case NORMAL_BUTTON: default: diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index 94ca0d09e7..0b299bb2c1 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -2041,18 +2041,18 @@ listbox_header_func (GtkListBoxRow *row, "spinning", G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (header_name), label); - gtk_container_add (GTK_CONTAINER (header_name), network_header_spinner); - gtk_container_add (GTK_CONTAINER (header), header_name); + gtk_box_append (GTK_BOX (header_name), label); + gtk_box_append (GTK_BOX (header_name), network_header_spinner); + gtk_box_append (GTK_BOX (header), header_name); } else { gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_margin_end (label, 12); - gtk_container_add (GTK_CONTAINER (header), label); + gtk_box_append (GTK_BOX (header), label); } - gtk_container_add (GTK_CONTAINER (header), separator); + gtk_box_append (GTK_BOX (header), separator); gtk_list_box_row_set_header (row, header); diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index 9ec37814f0..7e54470603 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -687,12 +687,12 @@ request_password (GtkPrintBackend *backend, /* Packing */ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_container_add (GTK_CONTAINER (content_area), main_box); + gtk_box_append (GTK_BOX (content_area), main_box); - gtk_container_add (GTK_CONTAINER (main_box), icon); - gtk_container_add (GTK_CONTAINER (main_box), vbox); + gtk_box_append (GTK_BOX (main_box), icon); + gtk_box_append (GTK_BOX (main_box), vbox); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Right - 2. */ for (i = 0; i < length; i++) @@ -718,10 +718,10 @@ request_password (GtkPrintBackend *backend, gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), box); + gtk_box_append (GTK_BOX (vbox), box); - gtk_container_add (GTK_CONTAINER (box), label); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), label); + gtk_box_append (GTK_BOX (box), entry); g_signal_connect (entry, "changed", G_CALLBACK (store_entry), &(priv->auth_info[i])); @@ -734,7 +734,7 @@ request_password (GtkPrintBackend *backend, gtk_widget_set_margin_top (chkbtn, 6); gtk_widget_set_margin_bottom (chkbtn, 6); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbtn), FALSE); - gtk_container_add (GTK_CONTAINER (vbox), chkbtn); + gtk_box_append (GTK_BOX (vbox), chkbtn); g_signal_connect (chkbtn, "toggled", G_CALLBACK (store_auth_info_toggled), &(priv->store_auth_info)); diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index eff9f7fd9a..a866abe85d 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -701,11 +701,14 @@ select_maybe (GtkWidget *widget, static void alternative_set (GtkWidget *box, - const gchar *value) + const gchar *value) { - gtk_container_foreach (GTK_CONTAINER (box), - (GtkCallback) select_maybe, - (gpointer) value); + GtkWidget *child; + + for (child = gtk_widget_get_first_child (box); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + select_maybe (child, value); } static GSList * @@ -720,7 +723,7 @@ alternative_append (GtkWidget *box, button = gtk_radio_button_new_with_label (group, label); gtk_widget_show (button); gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_object_set_data (G_OBJECT (button), "value", (gpointer)value); g_signal_connect (button, "toggled", @@ -751,7 +754,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), 0); gtk_widget_set_sensitive (GTK_WIDGET (widget), FALSE); gtk_widget_show (priv->combo); - gtk_container_add (GTK_CONTAINER (widget), priv->combo); + gtk_box_append (GTK_BOX (widget), priv->combo); } else switch (source->type) { @@ -759,7 +762,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) priv->check = gtk_check_button_new_with_mnemonic (source->display_text); g_signal_connect (priv->check, "toggled", G_CALLBACK (check_toggled_cb), widget); gtk_widget_show (priv->check); - gtk_container_add (GTK_CONTAINER (widget), priv->check); + gtk_box_append (GTK_BOX (widget), priv->check); break; case GTK_PRINTER_OPTION_TYPE_PICKONE: case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD: @@ -791,7 +794,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) source->choices_display[i], source->choices[i]); gtk_widget_show (priv->combo); - gtk_container_add (GTK_CONTAINER (widget), priv->combo); + gtk_box_append (GTK_BOX (widget), priv->combo); g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget); text = g_strdup_printf ("%s:", source->display_text); @@ -805,7 +808,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_set_valign (priv->box, GTK_ALIGN_BASELINE); gtk_widget_show (priv->box); - gtk_container_add (GTK_CONTAINER (widget), priv->box); + gtk_box_append (GTK_BOX (widget), priv->box); for (i = 0; i < source->num_choices; i++) { group = alternative_append (priv->box, @@ -833,7 +836,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) gtk_entry_set_activates_default (GTK_ENTRY (priv->entry), gtk_printer_option_get_activates_default (source)); gtk_widget_show (priv->entry); - gtk_container_add (GTK_CONTAINER (widget), priv->entry); + gtk_box_append (GTK_BOX (widget), priv->entry); g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget); text = g_strdup_printf ("%s:", source->display_text); @@ -846,7 +849,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) case GTK_PRINTER_OPTION_TYPE_FILESAVE: priv->button = gtk_button_new (); gtk_widget_show (priv->button); - gtk_container_add (GTK_CONTAINER (widget), priv->button); + gtk_box_append (GTK_BOX (widget), priv->button); g_signal_connect (priv->button, "clicked", G_CALLBACK (filesave_choose_cb), widget); text = g_strdup_printf ("%s:", source->display_text); @@ -859,7 +862,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) case GTK_PRINTER_OPTION_TYPE_INFO: priv->info_label = gtk_label_new (NULL); gtk_label_set_selectable (GTK_LABEL (priv->info_label), TRUE); - gtk_container_add (GTK_CONTAINER (widget), priv->info_label); + gtk_box_append (GTK_BOX (widget), priv->info_label); text = g_strdup_printf ("%s:", source->display_text); priv->label = gtk_label_new_with_mnemonic (text); @@ -872,7 +875,7 @@ construct_widgets (GtkPrinterOptionWidget *widget) } priv->image = gtk_image_new_from_icon_name ("dialog-warning"); - gtk_container_add (GTK_CONTAINER (widget), priv->image); + gtk_box_append (GTK_BOX (widget), priv->image); } /* diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index 009dffcde4..2b9ec44b75 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1423,7 +1423,7 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam) gtk_window_set_modal (GTK_WINDOW (plug), TRUE); op_win32->embed_widget = plug; - gtk_container_add (GTK_CONTAINER (plug), op->priv->custom_widget); + gtk_box_append (GTK_BOX (plug), op->priv->custom_widget); gtk_widget_show (op->priv->custom_widget); gtk_widget_show (plug); diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 2dbb63fcef..eb9d008a04 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -830,7 +830,7 @@ gtk_print_unix_dialog_constructed (GObject *object) button = gtk_dialog_get_widget_for_response (GTK_DIALOG (object), GTK_RESPONSE_APPLY); g_object_ref (button); parent = gtk_widget_get_ancestor (button, GTK_TYPE_HEADER_BAR); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button)), button); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (button)), button); gtk_header_bar_pack_end (GTK_HEADER_BAR (parent), button); g_object_unref (button); } @@ -1305,13 +1305,13 @@ wrap_in_frame (const gchar *label, g_free (bold_text); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_container_add (GTK_CONTAINER (box), label_widget); + gtk_box_append (GTK_BOX (box), label_widget); gtk_widget_set_margin_start (child, 12); gtk_widget_set_halign (child, GTK_ALIGN_FILL); gtk_widget_set_valign (child, GTK_ALIGN_FILL); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); return box; } @@ -1353,14 +1353,14 @@ add_option_to_extension_point (GtkPrinterOption *option, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (hbox), label); - gtk_container_add (GTK_CONTAINER (hbox), widget); + gtk_box_append (GTK_BOX (hbox), label); + gtk_box_append (GTK_BOX (hbox), widget); gtk_widget_show (hbox); - gtk_container_add (GTK_CONTAINER (extension_point), hbox); + gtk_box_append (GTK_BOX (extension_point), hbox); } else - gtk_container_add (GTK_CONTAINER (extension_point), widget); + gtk_box_append (GTK_BOX (extension_point), widget); } static gint @@ -1533,7 +1533,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog) GtkWidget *table, *frame; gboolean has_advanced, has_job; guint nrows; - GList *children; + GtkWidget *child; if (dialog->current_printer == NULL) { @@ -1591,11 +1591,9 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog) * This keeps the file format radios from moving as the * filename changes. */ - children = gtk_container_get_children (GTK_CONTAINER (dialog->extension_point)); - l = g_list_last (children); - if (l && l != children) - gtk_widget_set_halign (GTK_WIDGET (l->data), GTK_ALIGN_END); - g_list_free (children); + child = gtk_widget_get_last_child (dialog->extension_point); + if (child && child != gtk_widget_get_first_child (dialog->extension_point)) + gtk_widget_set_halign (child, GTK_ALIGN_END); /* Put the rest of the groups in the advanced page */ groups = gtk_printer_option_set_get_groups (dialog->options); @@ -1632,7 +1630,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog) { has_advanced = TRUE; frame = wrap_in_frame (group, table); - gtk_container_add (GTK_CONTAINER (dialog->advanced_vbox), frame); + gtk_box_append (GTK_BOX (dialog->advanced_vbox), frame); } } @@ -1954,9 +1952,9 @@ clear_per_printer_ui (GtkPrintUnixDialog *dialog) while ((child = gtk_widget_get_first_child (dialog->color_table))) gtk_grid_remove (GTK_GRID (dialog->color_table), child); while ((child = gtk_widget_get_first_child (dialog->advanced_vbox))) - gtk_container_remove (GTK_CONTAINER (dialog->advanced_vbox), child); + gtk_box_remove (GTK_BOX (dialog->advanced_vbox), child); while ((child = gtk_widget_get_first_child (dialog->extension_point))) - gtk_container_remove (GTK_CONTAINER (dialog->extension_point), child); + gtk_box_remove (GTK_BOX (dialog->extension_point), child); } static void diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 618fb712d9..4d67d0ddca 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -104,7 +104,7 @@ * // Create a radio button with a GtkEntry widget * radio1 = gtk_radio_button_new (NULL); * entry = gtk_entry_new (); - * gtk_container_add (GTK_CONTAINER (radio1), entry); + * gtk_box_append (GTK_BOX (radio1), entry); * * * // Create a radio button with a label @@ -112,8 +112,8 @@ * "I’m the second radio button."); * * // Pack them into a box, then show all the widgets - * gtk_container_add (GTK_CONTAINER (box), radio1); - * gtk_container_add (GTK_CONTAINER (box), radio2); + * gtk_box_append (GTK_BOX (box), radio1); + * gtk_box_append (GTK_BOX (box), radio2); gtk_window_set_child (GTK_WINDOW (window),box); * gtk_widget_show (window); * return; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 7eb696465e..f2b8493234 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -85,14 +85,14 @@ * * // GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically * // add a GtkViewport. - * gtk_container_add (GTK_CONTAINER (scrolled_window), + * gtk_box_append (GTK_BOX (scrolled_window), * child_widget); * * // Either of these will result in child_widget being unparented: - * gtk_container_remove (GTK_CONTAINER (scrolled_window), + * gtk_box_remove (GTK_BOX (scrolled_window), * child_widget); * // or - * gtk_container_remove (GTK_CONTAINER (scrolled_window), + * gtk_box_remove (GTK_BOX (scrolled_window), * gtk_bin_get_child (GTK_BIN (scrolled_window))); * ]| * diff --git a/gtk/gtkshortcutsgroup.c b/gtk/gtkshortcutsgroup.c index a44a37d84d..0d1cd76d42 100644 --- a/gtk/gtkshortcutsgroup.c +++ b/gtk/gtkshortcutsgroup.c @@ -92,49 +92,47 @@ static void gtk_shortcuts_group_set_accel_size_group (GtkShortcutsGroup *group, GtkSizeGroup *size_group) { - GList *children, *l; + GtkWidget *child; g_set_object (&group->accel_size_group, size_group); - children = gtk_container_get_children (GTK_CONTAINER (group)); - for (l = children; l; l = l->next) - gtk_shortcuts_group_apply_accel_size_group (group, GTK_WIDGET (l->data)); - g_list_free (children); + for (child = gtk_widget_get_first_child (GTK_WIDGET (group)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + gtk_shortcuts_group_apply_accel_size_group (group, child); } static void gtk_shortcuts_group_set_title_size_group (GtkShortcutsGroup *group, GtkSizeGroup *size_group) { - GList *children, *l; + GtkWidget *child; g_set_object (&group->title_size_group, size_group); - children = gtk_container_get_children (GTK_CONTAINER (group)); - for (l = children; l; l = l->next) - gtk_shortcuts_group_apply_title_size_group (group, GTK_WIDGET (l->data)); - g_list_free (children); + for (child = gtk_widget_get_first_child (GTK_WIDGET (group)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + gtk_shortcuts_group_apply_title_size_group (group, child); } static guint gtk_shortcuts_group_get_height (GtkShortcutsGroup *group) { - GList *children, *l; + GtkWidget *child; guint height; height = 1; - children = gtk_container_get_children (GTK_CONTAINER (group)); - for (l = children; l; l = l->next) + for (child = gtk_widget_get_first_child (GTK_WIDGET (group)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - GtkWidget *child = l->data; - if (!gtk_widget_get_visible (child)) continue; else if (GTK_IS_SHORTCUTS_SHORTCUT (child)) height += 1; } - g_list_free (children); return height; } diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c index 9c2f413023..f6bfbf4d4c 100644 --- a/gtk/gtkshortcutssection.c +++ b/gtk/gtkshortcutssection.c @@ -143,7 +143,7 @@ gtk_shortcuts_section_remove (GtkContainer *container, gtk_widget_is_ancestor (child, GTK_WIDGET (container))) { self->groups = g_list_remove (self->groups, child); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (child)), child); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (child)), child); } else GTK_CONTAINER_CLASS (gtk_shortcuts_section_parent_class)->remove (container, child); @@ -492,10 +492,10 @@ gtk_shortcuts_section_add_group (GtkShortcutsSection *self, if (column == NULL) { column = gtk_box_new (GTK_ORIENTATION_VERTICAL, 22); - gtk_container_add (GTK_CONTAINER (page), column); + gtk_box_append (GTK_BOX (page), column); } - gtk_container_add (GTK_CONTAINER (column), GTK_WIDGET (group)); + gtk_box_append (GTK_BOX (column), GTK_WIDGET (group)); self->groups = g_list_append (self->groups, group); gtk_shortcuts_section_reflow_groups (self); @@ -527,18 +527,26 @@ update_group_visibility (GtkWidget *child, gpointer data) g_free (view); } - else if (GTK_IS_CONTAINER (child)) + else { - gtk_container_foreach (GTK_CONTAINER (child), update_group_visibility, data); + for (child = gtk_widget_get_first_child (GTK_WIDGET (child)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + update_group_visibility (child, self); } } static void gtk_shortcuts_section_filter_groups (GtkShortcutsSection *self) { + GtkWidget *child; + self->has_filtered_group = FALSE; - gtk_container_foreach (GTK_CONTAINER (self), update_group_visibility, self); + for (child = gtk_widget_get_first_child (GTK_WIDGET (self)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + update_group_visibility (child, self); gtk_widget_set_visible (GTK_WIDGET (self->show_all), self->has_filtered_group); gtk_widget_set_visible (gtk_widget_get_parent (GTK_WIDGET (self->show_all)), @@ -549,10 +557,9 @@ gtk_shortcuts_section_filter_groups (GtkShortcutsSection *self) static void gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) { - GtkWidget *page, *column; GList *pages, *p; + GtkWidget *page; GList *groups, *g; - GList *children; guint n_rows; guint n_columns; guint n_pages; @@ -564,14 +571,23 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) page != NULL; page = gtk_widget_get_next_sibling (page)) { + GtkWidget *column; + for (column = gtk_widget_get_first_child (page); column != NULL; column = gtk_widget_get_next_sibling (column)) { - children = gtk_container_get_children (GTK_CONTAINER (column)); - groups = g_list_concat (groups, children); + GtkWidget *group; + + for (group = gtk_widget_get_first_child (column); + group != NULL; + group = gtk_widget_get_next_sibling (group)) + { + groups = g_list_prepend (groups, group); + } } } + groups = g_list_reverse (groups); /* create new pages */ current_page = NULL; @@ -614,7 +630,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) current_page = page; } - gtk_container_add (GTK_CONTAINER (current_page), column_box); + gtk_box_append (GTK_BOX (current_page), column_box); current_column = column_box; n_columns += 1; n_rows = 0; @@ -628,8 +644,8 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) NULL); g_object_ref (group); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (group))), GTK_WIDGET (group)); - gtk_container_add (GTK_CONTAINER (current_column), GTK_WIDGET (group)); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (GTK_WIDGET (group))), GTK_WIDGET (group)); + gtk_box_append (GTK_BOX (current_column), GTK_WIDGET (group)); g_object_unref (group); } @@ -639,6 +655,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) GtkWidget *column_box; GtkSizeGroup *size_group; GList *content; + GtkWidget *child; guint n; column_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 22); @@ -648,9 +665,14 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); g_object_set_data_full (G_OBJECT (column_box), "title-size-group", size_group, g_object_unref); - gtk_container_add (GTK_CONTAINER (current_page), column_box); + gtk_box_append (GTK_BOX (current_page), column_box); - content = gtk_container_get_children (GTK_CONTAINER (current_column)); + content = NULL; + for (child = gtk_widget_get_last_child (current_column); + child != NULL; + child = gtk_widget_get_prev_sibling (child)) + content = g_list_prepend (content, child); + content = g_list_reverse (content); n = 0; for (g = g_list_last (content); g; g = g->prev) @@ -686,8 +708,8 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self) NULL); g_object_ref (group); - gtk_container_remove (GTK_CONTAINER (current_column), GTK_WIDGET (group)); - gtk_container_add (GTK_CONTAINER (column_box), GTK_WIDGET (group)); + gtk_box_remove (GTK_BOX (current_column), GTK_WIDGET (group)); + gtk_box_append (GTK_BOX (column_box), GTK_WIDGET (group)); g_object_unref (group); } @@ -742,26 +764,21 @@ gtk_shortcuts_section_change_current_page (GtkShortcutsSection *self, gint offset) { GtkWidget *child; - GList *children, *l; child = gtk_stack_get_visible_child (self->stack); - children = gtk_container_get_children (GTK_CONTAINER (self->stack)); - l = g_list_find (children, child); if (offset == 1) - l = l->next; + child = gtk_widget_get_next_sibling (child); else if (offset == -1) - l = l->prev; + child = gtk_widget_get_prev_sibling (child); else g_assert_not_reached (); - if (l) - gtk_stack_set_visible_child (self->stack, GTK_WIDGET (l->data)); + if (child) + gtk_stack_set_visible_child (self->stack, child); else gtk_widget_error_bell (GTK_WIDGET (self)); - g_list_free (children); - return TRUE; } diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c index dc9558c9e2..a8baa86fe3 100644 --- a/gtk/gtkshortcutsshortcut.c +++ b/gtk/gtkshortcutsshortcut.c @@ -740,13 +740,13 @@ gtk_shortcuts_shortcut_init (GtkShortcutsShortcut *self) "visible", FALSE, "valign", GTK_ALIGN_CENTER, NULL); - gtk_container_add (GTK_CONTAINER (self->box), GTK_WIDGET (self->image)); + gtk_box_append (GTK_BOX (self->box), GTK_WIDGET (self->image)); self->accelerator = g_object_new (GTK_TYPE_SHORTCUT_LABEL, "visible", TRUE, "valign", GTK_ALIGN_CENTER, NULL); - gtk_container_add (GTK_CONTAINER (self->box), GTK_WIDGET (self->accelerator)); + gtk_box_append (GTK_BOX (self->box), GTK_WIDGET (self->accelerator)); self->title_box = g_object_new (GTK_TYPE_BOX, "visible", TRUE, @@ -754,18 +754,18 @@ gtk_shortcuts_shortcut_init (GtkShortcutsShortcut *self) "hexpand", TRUE, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_container_add (GTK_CONTAINER (self->box), GTK_WIDGET (self->title_box)); + gtk_box_append (GTK_BOX (self->box), GTK_WIDGET (self->title_box)); self->title = g_object_new (GTK_TYPE_LABEL, "visible", TRUE, "xalign", 0.0f, NULL); - gtk_container_add (GTK_CONTAINER (self->title_box), GTK_WIDGET (self->title)); + gtk_box_append (GTK_BOX (self->title_box), GTK_WIDGET (self->title)); self->subtitle = g_object_new (GTK_TYPE_LABEL, "visible", FALSE, "xalign", 0.0f, NULL); gtk_widget_add_css_class (GTK_WIDGET (self->subtitle), GTK_STYLE_CLASS_DIM_LABEL); - gtk_container_add (GTK_CONTAINER (self->title_box), GTK_WIDGET (self->subtitle)); + gtk_box_append (GTK_BOX (self->title_box), GTK_WIDGET (self->subtitle)); } diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c index 2ca5fb26bc..643c1b0e68 100644 --- a/gtk/gtkshortcutswindow.c +++ b/gtk/gtkshortcutswindow.c @@ -284,18 +284,23 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data) g_hash_table_insert (priv->keywords, item, keywords); if (shortcut_type == GTK_SHORTCUT_ACCELERATOR) - gtk_container_add (GTK_CONTAINER (priv->search_shortcuts), item); + gtk_box_append (GTK_BOX (priv->search_shortcuts), item); else - gtk_container_add (GTK_CONTAINER (priv->search_gestures), item); + gtk_box_append (GTK_BOX (priv->search_gestures), item); g_free (title); g_free (accelerator); g_free (str); g_free (action_name); } - else if (GTK_IS_CONTAINER (child)) + else { - gtk_container_foreach (GTK_CONTAINER (child), gtk_shortcuts_window_add_search_item, self); + GtkWidget *widget; + + for (widget = gtk_widget_get_first_child (child); + widget != NULL; + widget = gtk_widget_get_next_sibling (widget)) + gtk_shortcuts_window_add_search_item (widget, self); } } @@ -337,8 +342,12 @@ gtk_shortcuts_window_add_section (GtkShortcutsWindow *self, gchar *name; const gchar *visible_section; GtkWidget *label; + GtkWidget *child; - gtk_container_foreach (GTK_CONTAINER (section), gtk_shortcuts_window_add_search_item, self); + for (child = gtk_widget_get_first_child (GTK_WIDGET (section)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) + gtk_shortcuts_window_add_search_item (child, self); g_object_get (section, "section-name", &name, @@ -445,8 +454,15 @@ update_accels_cb (GtkWidget *widget, if (GTK_IS_SHORTCUTS_SHORTCUT (widget)) gtk_shortcuts_shortcut_update_accel (GTK_SHORTCUTS_SHORTCUT (widget), priv->window); - else if (GTK_IS_CONTAINER (widget)) - gtk_container_foreach (GTK_CONTAINER (widget), update_accels_cb, self); + else + { + GtkWidget *child; + + for (child = gtk_widget_get_first_child (GTK_WIDGET (widget)); + child != NULL; + child = gtk_widget_get_next_sibling (child )) + update_accels_cb (child, self); + } } static void @@ -863,7 +879,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) g_object_bind_property (priv->search_bar, "search-mode-enabled", search_button, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->search_bar)); + gtk_box_append (GTK_BOX (priv->main_box), GTK_WIDGET (priv->search_bar)); gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (priv->search_bar), GTK_WIDGET (self)); @@ -874,7 +890,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) "vhomogeneous", TRUE, "transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE, NULL); - gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->stack)); + gtk_box_append (GTK_BOX (priv->main_box), GTK_WIDGET (priv->stack)); priv->title_stack = g_object_new (GTK_TYPE_STACK, NULL); @@ -944,14 +960,14 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_shortcuts)); + gtk_box_append (GTK_BOX (box), GTK_WIDGET (priv->search_shortcuts)); priv->search_gestures = g_object_new (GTK_TYPE_BOX, "halign", GTK_ALIGN_CENTER, "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (priv->search_gestures)); + gtk_box_append (GTK_BOX (box), GTK_WIDGET (priv->search_gestures)); empty = g_object_new (GTK_TYPE_GRID, "row-spacing", 12, diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 377be4a192..e12878fce9 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -6006,7 +6006,7 @@ append_bubble_item (GtkText *self, gtk_widget_add_css_class (item, "image-button"); gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name); gtk_widget_show (GTK_WIDGET (item)); - gtk_container_add (GTK_CONTAINER (toolbar), item); + gtk_box_append (GTK_BOX (toolbar), item); } static gboolean @@ -6054,7 +6054,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data) toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_add_css_class (toolbar, "linked"); gtk_popover_set_child (GTK_POPOVER (priv->selection_bubble), box); - gtk_container_add (GTK_CONTAINER (box), toolbar); + gtk_box_append (GTK_BOX (box), toolbar); model = gtk_text_get_menu_model (self); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 1dfae54ddc..c6cfcd5996 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -8755,7 +8755,7 @@ append_bubble_item (GtkTextView *text_view, gtk_widget_add_css_class (item, "image-button"); gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name); - gtk_container_add (GTK_CONTAINER (toolbar), item); + gtk_box_append (GTK_BOX (toolbar), item); } static gboolean @@ -8791,7 +8791,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data) toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_add_css_class (toolbar, "linked"); gtk_popover_set_child (GTK_POPOVER (priv->selection_bubble), box); - gtk_container_add (GTK_CONTAINER (box), toolbar); + gtk_box_append (GTK_BOX (box), toolbar); model = gtk_text_view_get_menu_model (text_view); diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index da5de35ae5..34b2879e63 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -84,14 +84,14 @@ * g_signal_connect (toggle1, "toggled", * G_CALLBACK (output_state), * NULL); - * gtk_container_add (GTK_CONTAINER (box), toggle1); + * gtk_box_append (GTK_BOX (box), toggle1); * * text = "Hi, I’m a toggle button."; * toggle2 = gtk_toggle_button_new_with_label (text); * g_signal_connect (toggle2, "toggled", * G_CALLBACK (output_state), * NULL); - * gtk_container_add (GTK_CONTAINER (box), toggle2); + * gtk_box_append (GTK_BOX (box), toggle2); * * gtk_window_set_child (GTK_WINDOW (window), box); * gtk_widget_show (window); diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c index 3c36b82691..5c9c4e5097 100644 --- a/gtk/gtktooltipwindow.c +++ b/gtk/gtktooltipwindow.c @@ -499,7 +499,7 @@ gtk_tooltip_window_set_custom_widget (GtkTooltipWindow *window, * gtk_tooltip_set_custom() */ window->custom_widget = NULL; - gtk_container_remove (GTK_CONTAINER (window->box), custom); + gtk_box_remove (GTK_BOX (window->box), custom); g_object_unref (custom); } @@ -507,7 +507,7 @@ gtk_tooltip_window_set_custom_widget (GtkTooltipWindow *window, { window->custom_widget = g_object_ref (custom_widget); - gtk_container_add (GTK_CONTAINER (window->box), custom_widget); + gtk_box_append (GTK_BOX (window->box), custom_widget); gtk_widget_show (custom_widget); gtk_widget_hide (window->image); gtk_widget_hide (window->label); diff --git a/gtk/gtktreepopover.c b/gtk/gtktreepopover.c index 2c26ea8234..dba7de69e0 100644 --- a/gtk/gtktreepopover.c +++ b/gtk/gtktreepopover.c @@ -318,8 +318,8 @@ ensure_submenu (GtkTreePopover *popover, GtkWidget *item; gtk_tree_model_get_iter (popover->model, &iter, path); item = gtk_tree_popover_create_item (popover, path, &iter, TRUE); - gtk_container_add (GTK_CONTAINER (box), item); - gtk_container_add (GTK_CONTAINER (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); + gtk_box_append (GTK_BOX (box), item); + gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); } } @@ -407,7 +407,7 @@ row_changed_cb (GtkTreeModel *model, { GtkWidget *box = gtk_widget_get_parent (item); - gtk_container_remove (GTK_CONTAINER (box), item); + gtk_box_remove (GTK_BOX (box), item); item = gtk_tree_popover_create_item (popover, path, iter, FALSE); diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index 00f7280027..a206192560 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -887,16 +887,16 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column) if (priv->xalign <= 0.5) { - gtk_container_add (GTK_CONTAINER (hbox), priv->frame); - gtk_container_add (GTK_CONTAINER (hbox), priv->arrow); + gtk_box_append (GTK_BOX (hbox), priv->frame); + gtk_box_append (GTK_BOX (hbox), priv->arrow); } else { - gtk_container_add (GTK_CONTAINER (hbox), priv->arrow); - gtk_container_add (GTK_CONTAINER (hbox), priv->frame); + gtk_box_append (GTK_BOX (hbox), priv->arrow); + gtk_box_append (GTK_BOX (hbox), priv->frame); } - gtk_container_add (GTK_CONTAINER (priv->frame), child); + gtk_box_append (GTK_BOX (priv->frame), child); gtk_button_set_child (GTK_BUTTON (priv->button), hbox); } @@ -927,8 +927,8 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) { if (current_child != priv->child) { - gtk_container_remove (GTK_CONTAINER (frame), current_child); - gtk_container_add (GTK_CONTAINER (frame), priv->child); + gtk_box_remove (GTK_BOX (frame), current_child); + gtk_box_append (GTK_BOX (frame), priv->child); } } else @@ -937,7 +937,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) { current_child = gtk_label_new (NULL); gtk_widget_show (current_child); - gtk_container_add (GTK_CONTAINER (frame), current_child); + gtk_box_append (GTK_BOX (frame), current_child); } g_return_if_fail (GTK_IS_LABEL (current_child)); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index d77ee24f50..08a729abd4 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -7140,9 +7140,7 @@ gtk_widget_dispose (GObject *object) if (priv->controller_observer) gtk_list_list_model_clear (priv->controller_observer); - if (priv->parent && GTK_IS_CONTAINER (priv->parent)) - gtk_container_remove (GTK_CONTAINER (priv->parent), widget); - else if (priv->parent) + if (priv->parent) gtk_widget_unparent (widget); else if (_gtk_widget_get_visible (widget)) gtk_widget_hide (widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 0d57b7598f..8f1e37f727 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -29,6 +29,7 @@ #include "gtkaccelgroupprivate.h" #include "gtkactionable.h" #include "gtkapplicationprivate.h" +#include "gtkbox.h" #include "gtkbuildable.h" #include "gtkbuilderprivate.h" #include "gtkcheckbutton.h" @@ -6958,7 +6959,7 @@ gtk_window_set_debugging (GdkDisplay *display, check = gtk_check_button_new_with_label (_("Don’t show this message again")); gtk_widget_set_margin_start (check, 10); gtk_widget_show (check); - gtk_container_add (GTK_CONTAINER (area), check); + gtk_box_append (GTK_BOX (area), check); g_object_set_data (G_OBJECT (dialog), "check", check); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_NO); gtk_dialog_add_button (GTK_DIALOG (dialog), _("_OK"), GTK_RESPONSE_YES); diff --git a/gtk/gtkwindowhandle.c b/gtk/gtkwindowhandle.c index 99b6b01de8..9f4960c370 100644 --- a/gtk/gtkwindowhandle.c +++ b/gtk/gtkwindowhandle.c @@ -243,44 +243,44 @@ do_popup_fallback (GtkWindowHandle *self, gtk_widget_set_sensitive (menuitem, maximized && resizable); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (restore_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_model_button_new (); g_object_set (menuitem, "text", _("Move"), NULL); gtk_widget_set_sensitive (menuitem, !maximized); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (move_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_model_button_new (); g_object_set (menuitem, "text", _("Resize"), NULL); gtk_widget_set_sensitive (menuitem, resizable && !maximized); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (resize_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_model_button_new (); g_object_set (menuitem, "text", _("Minimize"), NULL); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (minimize_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_model_button_new (); g_object_set (menuitem, "text", _("Maximize"), NULL); gtk_widget_set_sensitive (menuitem, resizable && !maximized); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (maximize_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); menuitem = gtk_model_button_new (); g_object_set (menuitem, "text", _("Close"), NULL); gtk_widget_set_sensitive (menuitem, deletable); g_signal_connect (G_OBJECT (menuitem), "clicked", G_CALLBACK (close_window_clicked), self); - gtk_container_add (GTK_CONTAINER (box), menuitem); + gtk_box_append (GTK_BOX (box), menuitem); g_signal_connect (self->fallback_menu, "closed", G_CALLBACK (popup_menu_closed), self); diff --git a/gtk/inspector/action-editor.c b/gtk/inspector/action-editor.c index fa74f2cfee..1f1606ba19 100644 --- a/gtk/inspector/action-editor.c +++ b/gtk/inspector/action-editor.c @@ -102,9 +102,9 @@ variant_editor_new (const GVariantType *type, { editor = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); entry = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (editor), entry); + gtk_box_append (GTK_BOX (editor), entry); label = gtk_label_new (g_variant_type_peek_string (type)); - gtk_container_add (GTK_CONTAINER (editor), label); + gtk_box_append (GTK_BOX (editor), label); g_signal_connect (entry, "notify::text", G_CALLBACK (variant_editor_changed_cb), d); } @@ -283,24 +283,24 @@ constructed (GObject *object) row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); activate = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (row), activate); + gtk_box_append (GTK_BOX (row), activate); gtk_size_group_add_widget (r->priv->sg, activate); r->priv->activate_button = gtk_button_new_with_label (_("Activate")); g_signal_connect (r->priv->activate_button, "clicked", G_CALLBACK (activate_action), r); gtk_widget_set_sensitive (r->priv->activate_button, r->priv->enabled); - gtk_container_add (GTK_CONTAINER (activate), r->priv->activate_button); + gtk_box_append (GTK_BOX (activate), r->priv->activate_button); r->priv->parameter_type = g_action_group_get_action_parameter_type (r->priv->group, r->priv->name); if (r->priv->parameter_type) { r->priv->parameter_entry = variant_editor_new (r->priv->parameter_type, parameter_changed, r); gtk_widget_set_sensitive (r->priv->parameter_entry, r->priv->enabled); - gtk_container_add (GTK_CONTAINER (activate), r->priv->parameter_entry); + gtk_box_append (GTK_BOX (activate), r->priv->parameter_entry); } - gtk_container_add (GTK_CONTAINER (r), row); + gtk_box_append (GTK_BOX (r), row); if (state) { @@ -308,11 +308,11 @@ constructed (GObject *object) row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); label = gtk_label_new (_("Set State")); gtk_size_group_add_widget (r->priv->sg, label); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); r->priv->state_entry = variant_editor_new (r->priv->state_type, state_changed, r); variant_editor_set_value (r->priv->state_entry, state); - gtk_container_add (GTK_CONTAINER (row), r->priv->state_entry); - gtk_container_add (GTK_CONTAINER (r), row); + gtk_box_append (GTK_BOX (row), r->priv->state_entry); + gtk_box_append (GTK_BOX (r), row); } g_signal_connect (r->priv->group, "action-enabled-changed", diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index 78133cb456..327bcb0476 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -94,14 +94,14 @@ add_action (GtkInspectorActions *sl, gtk_widget_add_css_class (label, "cell"); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_size_group_add_widget (sl->priv->name, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new (enabled ? "+" : "-"); gtk_widget_add_css_class (label, "cell"); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_widget_set_halign (label, GTK_ALIGN_CENTER); gtk_size_group_add_widget (sl->priv->enabled, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); g_object_set_data (G_OBJECT (row), "enabled", label); @@ -109,18 +109,18 @@ add_action (GtkInspectorActions *sl, gtk_widget_add_css_class (label, "cell"); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_size_group_add_widget (sl->priv->parameter, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new (state_string); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_widget_add_css_class (label, "cell"); gtk_size_group_add_widget (sl->priv->state, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); g_object_set_data (G_OBJECT (row), "state", label); editor = gtk_inspector_action_editor_new (group, name, sl->priv->activate); gtk_widget_add_css_class (editor, "cell"); - gtk_container_add (GTK_CONTAINER (box), editor); + gtk_box_append (GTK_BOX (box), editor); g_object_set_data (G_OBJECT (row), "editor", editor); gtk_list_box_insert (GTK_LIST_BOX (sl->priv->list), row, -1); diff --git a/gtk/inspector/controllers.c b/gtk/inspector/controllers.c index a36e1ee304..64063508a6 100644 --- a/gtk/inspector/controllers.c +++ b/gtk/inspector/controllers.c @@ -89,9 +89,9 @@ gtk_inspector_controllers_init (GtkInspectorControllers *sl) gtk_widget_set_halign (sl->priv->listbox, GTK_ALIGN_CENTER); g_signal_connect (sl->priv->listbox, "row-activated", G_CALLBACK (row_activated), sl); gtk_list_box_set_selection_mode (GTK_LIST_BOX (sl->priv->listbox), GTK_SELECTION_NONE); - gtk_container_add (GTK_CONTAINER (box), sl->priv->listbox); + gtk_box_append (GTK_BOX (box), sl->priv->listbox); - gtk_container_add (GTK_CONTAINER (sl), sw); + gtk_box_append (GTK_BOX (sl), sw); } static void @@ -129,7 +129,7 @@ create_controller_widget (gpointer item, gtk_widget_set_margin_bottom (box, 10); label = gtk_label_new (G_OBJECT_TYPE_NAME (controller)); g_object_set (label, "xalign", 0.0, NULL); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); gtk_size_group_add_widget (sl->priv->sizegroup, label); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); @@ -140,7 +140,7 @@ create_controller_widget (gpointer item, gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), GTK_PHASE_BUBBLE, C_("event phase", "Bubble")); gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT (combo), GTK_PHASE_TARGET, C_("event phase", "Target")); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), gtk_event_controller_get_propagation_phase (controller)); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); gtk_widget_set_halign (label, GTK_ALIGN_END); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 36b6ad0b9a..09afdbb271 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -175,13 +175,13 @@ add_check_row (GtkInspectorGeneral *gen, gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_hexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); check = gtk_image_new_from_icon_name ("object-select-symbolic"); gtk_widget_set_halign (check, GTK_ALIGN_END); gtk_widget_set_valign (check, GTK_ALIGN_BASELINE); gtk_widget_set_opacity (check, value ? 1.0 : 0.0); - gtk_container_add (GTK_CONTAINER (box), check); + gtk_box_append (GTK_BOX (box), check); row = gtk_list_box_row_new (); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box); @@ -217,14 +217,14 @@ add_label_row (GtkInspectorGeneral *gen, gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_widget_set_hexpand (label, TRUE); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new (value); gtk_label_set_selectable (GTK_LABEL (label), TRUE); gtk_widget_set_halign (label, GTK_ALIGN_END); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_label_set_xalign (GTK_LABEL (label), 1.0); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); row = gtk_list_box_row_new (); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box); diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 54d7e993bb..efd9e602bf 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -332,7 +332,7 @@ update_info (gpointer data) GList *list, *l; while ((child = gtk_widget_get_first_child (sl->priv->mnemonic_label))) - gtk_widget_unparent (child); + gtk_box_remove (GTK_BOX (sl->priv->mnemonic_label), child); list = gtk_widget_list_mnemonic_labels (GTK_WIDGET (sl->priv->object)); for (l = list; l; l = l->next) @@ -343,7 +343,7 @@ update_info (gpointer data) button = gtk_button_new_with_label (tmp); g_free (tmp); gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (sl->priv->mnemonic_label), button); + gtk_box_append (GTK_BOX (sl->priv->mnemonic_label), button); g_object_set_data (G_OBJECT (button), "mnemonic-label", l->data); g_signal_connect (button, "clicked", G_CALLBACK (show_mnemonic_label), sl); } diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c index 239f70358a..0de34cf583 100644 --- a/gtk/inspector/object-tree.c +++ b/gtk/inspector/object-tree.c @@ -1003,7 +1003,7 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item, column = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_size_group_add_widget (wt->priv->type_size_group, column); - gtk_container_add (GTK_CONTAINER (box), column); + gtk_box_append (GTK_BOX (box), column); /* expander */ depth = gtk_tree_list_row_get_depth (row_item); @@ -1011,7 +1011,7 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item, { child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_size_request (child, 16 * depth, 0); - gtk_container_add (GTK_CONTAINER (column), child); + gtk_box_append (GTK_BOX (column), child); } if (gtk_tree_list_row_is_expandable (row_item)) { @@ -1022,7 +1022,7 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item, title = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "css-name", "title", NULL); gtk_button_set_has_frame (GTK_BUTTON (title), FALSE); g_object_bind_property (row_item, "expanded", title, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (child), title); + gtk_box_append (GTK_BOX (child), title); arrow = gtk_builtin_icon_new ("expander"); gtk_button_set_child (GTK_BUTTON (title), arrow); @@ -1031,20 +1031,20 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item, { child = gtk_image_new (); /* empty whatever */ } - gtk_container_add (GTK_CONTAINER (column), child); + gtk_box_append (GTK_BOX (column), child); /* 1st column: type name */ child = gtk_label_new (G_OBJECT_TYPE_NAME (item)); gtk_label_set_width_chars (GTK_LABEL (child), 30); gtk_label_set_xalign (GTK_LABEL (child), 0.0); - gtk_container_add (GTK_CONTAINER (column), child); + gtk_box_append (GTK_BOX (column), child); /* 2nd column: name */ child = gtk_label_new (gtk_inspector_get_object_name (item)); gtk_label_set_width_chars (GTK_LABEL (child), 15); gtk_label_set_xalign (GTK_LABEL (child), 0.0); gtk_size_group_add_widget (wt->priv->name_size_group, child); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); /* 3rd column: label */ child = gtk_label_new (NULL); @@ -1059,7 +1059,7 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item, gtk_label_set_width_chars (GTK_LABEL (child), 15); gtk_label_set_xalign (GTK_LABEL (child), 0.0); gtk_size_group_add_widget (wt->priv->label_size_group, child); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); g_object_unref (item); diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index ff8f18cc81..3504ec2383 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -794,8 +794,8 @@ create_row (gpointer item, g_signal_connect (button, "clicked", G_CALLBACK (item_properties), user_data); row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); - gtk_container_add (GTK_CONTAINER (row), label); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), label); + gtk_box_append (GTK_BOX (row), button); return row; } @@ -969,7 +969,7 @@ property_editor (GObject *object, b = gtk_check_button_new_with_label (fclass->values[j].value_nick); g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j)); gtk_widget_show (b); - gtk_container_add (GTK_CONTAINER (box), b); + gtk_box_append (GTK_BOX (box), b); connect_controller (G_OBJECT (b), "toggled", object, spec, G_CALLBACK (flags_modified)); } @@ -1048,8 +1048,8 @@ property_editor (GObject *object, g_signal_connect_swapped (button, "clicked", G_CALLBACK (object_properties), editor); - gtk_container_add (GTK_CONTAINER (prop_edit), label); - gtk_container_add (GTK_CONTAINER (prop_edit), button); + gtk_box_append (GTK_BOX (prop_edit), label); + gtk_box_append (GTK_BOX (prop_edit), button); gtk_widget_show (label); gtk_widget_show (button); @@ -1218,14 +1218,14 @@ attribute_editor (GObject *object, box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); label = gtk_label_new (_("Attribute:")); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); button = gtk_button_new_with_label (_("Model")); g_object_set_data (G_OBJECT (button), "model", model); g_signal_connect (button, "clicked", G_CALLBACK (model_properties), editor); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new (_("Column:"))); + gtk_box_append (GTK_BOX (box), gtk_label_new (_("Column:"))); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); renderer = gtk_cell_renderer_text_new (); @@ -1249,7 +1249,7 @@ attribute_editor (GObject *object, attribute_mapping_changed (GTK_COMBO_BOX (combo), editor); g_signal_connect (combo, "changed", G_CALLBACK (attribute_mapping_changed), editor); - gtk_container_add (GTK_CONTAINER (box), combo); + gtk_box_append (GTK_BOX (box), combo); return box; } @@ -1317,13 +1317,13 @@ action_editor (GObject *object, { text = g_strdup_printf (_("Action from: %p (%s)"), owner, g_type_name_from_instance ((GTypeInstance *)owner)); - gtk_container_add (GTK_CONTAINER (box), gtk_label_new (text)); + gtk_box_append (GTK_BOX (box), gtk_label_new (text)); g_free (text); button = gtk_button_new_with_label (_("Properties")); g_object_set_data (G_OBJECT (button), "owner", owner); g_signal_connect (button, "clicked", G_CALLBACK (show_action_owner), editor); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); } return box; @@ -1379,7 +1379,7 @@ add_attribute_info (GtkInspectorPropEditor *editor, GParamSpec *spec) { if (GTK_IS_CELL_RENDERER (editor->priv->object)) - gtk_container_add (GTK_CONTAINER (editor), + gtk_box_append (GTK_BOX (editor), attribute_editor (editor->priv->object, spec, editor)); } @@ -1388,7 +1388,7 @@ add_actionable_info (GtkInspectorPropEditor *editor) { if (GTK_IS_ACTIONABLE (editor->priv->object) && g_strcmp0 (editor->priv->name, "action-name") == 0) - gtk_container_add (GTK_CONTAINER (editor), + gtk_box_append (GTK_BOX (editor), action_editor (editor->priv->object, editor)); } @@ -1437,20 +1437,20 @@ add_settings_info (GtkInspectorPropEditor *editor) } row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (row), gtk_label_new (_("Setting:"))); + gtk_box_append (GTK_BOX (row), gtk_label_new (_("Setting:"))); label = gtk_label_new (direction); if (tip) gtk_widget_set_tooltip_text (label, tip); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); str = g_strdup_printf ("%s %s", g_settings_schema_get_id (binding->key.schema), binding->key.name); label = gtk_label_new (str); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); g_free (str); - gtk_container_add (GTK_CONTAINER (editor), row); + gtk_box_append (GTK_BOX (editor), row); } static void @@ -1478,7 +1478,7 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor) row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); button = gtk_button_new_with_label (_("Reset")); - gtk_container_add (GTK_CONTAINER (row), button); + gtk_box_append (GTK_BOX (row), button); gtk_widget_set_sensitive (button, FALSE); g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_setting), editor); @@ -1501,10 +1501,10 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor) source = _("Unknown"); break; } - gtk_container_add (GTK_CONTAINER (row), gtk_label_new (_("Source:"))); - gtk_container_add (GTK_CONTAINER (row), gtk_label_new (source)); + gtk_box_append (GTK_BOX (row), gtk_label_new (_("Source:"))); + gtk_box_append (GTK_BOX (row), gtk_label_new (source)); - gtk_container_add (GTK_CONTAINER (editor), row); + gtk_box_append (GTK_BOX (editor), row); } static void @@ -1553,7 +1553,7 @@ constructed (GObject *object) if (label) { gtk_widget_add_css_class (label, GTK_STYLE_CLASS_DIM_LABEL); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); } /* By reaching this, we already know the property is readable. @@ -1567,7 +1567,7 @@ constructed (GObject *object) { label = gtk_label_new (""); gtk_widget_add_css_class (label, GTK_STYLE_CLASS_DIM_LABEL); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); readonly_changed (editor->priv->object, spec, label); g_object_connect_property (editor->priv->object, spec, @@ -1576,15 +1576,15 @@ constructed (GObject *object) if (editor->priv->size_group) gtk_size_group_add_widget (editor->priv->size_group, box); - gtk_container_add (GTK_CONTAINER (editor), box); + gtk_box_append (GTK_BOX (editor), box); return; } editor->priv->editor = property_editor (editor->priv->object, spec, editor); - gtk_container_add (GTK_CONTAINER (box), editor->priv->editor); + gtk_box_append (GTK_BOX (box), editor->priv->editor); if (editor->priv->size_group) gtk_size_group_add_widget (editor->priv->size_group, box); - gtk_container_add (GTK_CONTAINER (editor), box); + gtk_box_append (GTK_BOX (editor), box); add_attribute_info (editor, spec); add_actionable_info (editor); diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c index a0d1d76435..d143da83df 100644 --- a/gtk/inspector/prop-list.c +++ b/gtk/inspector/prop-list.c @@ -536,25 +536,25 @@ gtk_inspector_prop_list_create_row (GtkInspectorPropList *pl, gtk_widget_set_sensitive (label, writable); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_size_group_add_widget (pl->priv->names, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new (type ? type : ""); gtk_widget_add_css_class (label, "cell"); gtk_widget_set_sensitive (label, writable); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_size_group_add_widget (pl->priv->types, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); label = gtk_label_new (g_type_name (prop->owner_type)); gtk_widget_add_css_class (label, "cell"); gtk_widget_set_sensitive (label, writable); gtk_label_set_xalign (GTK_LABEL (label), 0); gtk_size_group_add_widget (pl->priv->origins, label); - gtk_container_add (GTK_CONTAINER (box), label); + gtk_box_append (GTK_BOX (box), label); widget = gtk_inspector_prop_editor_new (pl->priv->object, prop->name, pl->priv->values); gtk_widget_add_css_class (widget, "cell"); - gtk_container_add (GTK_CONTAINER (box), widget); + gtk_box_append (GTK_BOX (box), widget); g_signal_connect (widget, "show-object", G_CALLBACK (show_object), pl); g_free (value); @@ -601,7 +601,7 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl, pl->priv->object = object; while ((w = gtk_widget_get_first_child (pl->priv->list2))) - gtk_container_remove (GTK_CONTAINER (pl->priv->list2), w); + gtk_list_box_remove (GTK_LIST_BOX (pl->priv->list2), w); for (i = 0; i < num_properties; i++) { diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index 784e66b269..1717ddc587 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -316,7 +316,7 @@ create_widget_for_render_node (gpointer row_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 (row_item)) { @@ -327,7 +327,7 @@ create_widget_for_render_node (gpointer row_item, title = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "css-name", "title", NULL); gtk_button_set_has_frame (GTK_BUTTON (title), FALSE); g_object_bind_property (row_item, "expanded", title, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (child), title); + gtk_box_append (GTK_BOX (child), title); g_object_set_data_full (G_OBJECT (row), "make-sure-its-not-unreffed", g_object_ref (row_item), g_object_unref); arrow = gtk_builtin_icon_new ("expander"); @@ -337,17 +337,17 @@ create_widget_for_render_node (gpointer row_item, { child = gtk_image_new (); /* empty whatever */ } - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); /* icon */ child = gtk_image_new_from_paintable (paintable); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); /* name */ name = node_name (node); child = gtk_label_new (name); g_free (name); - gtk_container_add (GTK_CONTAINER (box), child); + gtk_box_append (GTK_BOX (box), child); g_object_unref (paintable); @@ -1074,7 +1074,7 @@ gtk_inspector_recorder_recordings_list_create_widget (gpointer item, widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); - gtk_container_add (GTK_CONTAINER (widget), hbox); + gtk_box_append (GTK_BOX (widget), hbox); for (i = 0; i < g_list_model_get_n_items (priv->recordings); i++) { @@ -1115,17 +1115,17 @@ gtk_inspector_recorder_recordings_list_create_widget (gpointer item, label = gtk_label_new (str); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); g_free (str); - gtk_container_add (GTK_CONTAINER (hbox), label); + gtk_box_append (GTK_BOX (hbox), label); button = gtk_toggle_button_new (); gtk_button_set_has_frame (GTK_BUTTON (button), FALSE); gtk_button_set_icon_name (GTK_BUTTON (button), "view-more-symbolic"); - gtk_container_add (GTK_CONTAINER (hbox), button); + gtk_box_append (GTK_BOX (hbox), button); label = gtk_label_new (gtk_inspector_render_recording_get_profiler_info (GTK_INSPECTOR_RENDER_RECORDING (recording))); gtk_widget_hide (label); - gtk_container_add (GTK_CONTAINER (widget), label); + gtk_box_append (GTK_BOX (widget), label); g_object_bind_property (button, "active", label, "visible", 0); } else diff --git a/gtk/inspector/shortcuts.c b/gtk/inspector/shortcuts.c index 3f708371cd..4e4fa67855 100644 --- a/gtk/inspector/shortcuts.c +++ b/gtk/inspector/shortcuts.c @@ -67,14 +67,14 @@ create_row (gpointer item, label = gtk_label_new (s); gtk_label_set_xalign (GTK_LABEL (label), 0.0); g_free (s); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); gtk_size_group_add_widget (sl->trigger, label); s = gtk_shortcut_action_to_string (action); label = gtk_label_new (s); gtk_label_set_xalign (GTK_LABEL (label), 0.0); g_free (s); - gtk_container_add (GTK_CONTAINER (row), label); + gtk_box_append (GTK_BOX (row), label); gtk_size_group_add_widget (sl->action, label); return row; diff --git a/gtk/inspector/size-groups.c b/gtk/inspector/size-groups.c index 19946541ca..0e552fe063 100644 --- a/gtk/inspector/size-groups.c +++ b/gtk/inspector/size-groups.c @@ -86,7 +86,7 @@ size_group_row_widget_destroyed (GtkWidget *widget, SizeGroupRow *row) parent = gtk_widget_get_parent (GTK_WIDGET (row)); if (parent) - gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (row)); + gtk_box_remove (GTK_BOX (parent), GTK_WIDGET (row)); } static void @@ -186,7 +186,7 @@ clear_view (GtkInspectorSizeGroups *sl) GtkWidget *child; while ((child = gtk_widget_get_first_child (GTK_WIDGET (sl)))) - gtk_container_remove (GTK_CONTAINER (sl), child); + gtk_box_remove (GTK_BOX (sl), child); } static void @@ -222,13 +222,13 @@ add_size_group (GtkInspectorSizeGroups *sl, GtkWidget *listbox; frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (sl), frame); + gtk_box_append (GTK_BOX (sl), frame); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_add_css_class (box, GTK_STYLE_CLASS_VIEW); gtk_frame_set_child (GTK_FRAME (frame), box); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_container_add (GTK_CONTAINER (box), box2); + gtk_box_append (GTK_BOX (box), box2); label = gtk_label_new (_("Mode")); gtk_widget_set_margin_start (label, 10); @@ -237,7 +237,7 @@ add_size_group (GtkInspectorSizeGroups *sl, gtk_widget_set_margin_bottom (label, 10); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); - gtk_container_add (GTK_CONTAINER (box2), label); + gtk_box_append (GTK_BOX (box2), label); combo = gtk_combo_box_text_new (); gtk_widget_set_margin_start (combo, 10); @@ -253,10 +253,10 @@ add_size_group (GtkInspectorSizeGroups *sl, g_object_bind_property (group, "mode", combo, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - gtk_container_add (GTK_CONTAINER (box2), combo); + gtk_box_append (GTK_BOX (box2), combo); listbox = gtk_list_box_new (); - gtk_container_add (GTK_CONTAINER (box), listbox); + gtk_box_append (GTK_BOX (box), listbox); gtk_list_box_set_selection_mode (GTK_LIST_BOX (listbox), GTK_SELECTION_NONE); widgets = gtk_size_group_get_widgets (group); diff --git a/gtk/inspector/strv-editor.c b/gtk/inspector/strv-editor.c index 77cb5551e8..c8b19d6dda 100644 --- a/gtk/inspector/strv-editor.c +++ b/gtk/inspector/strv-editor.c @@ -52,7 +52,7 @@ remove_string (GtkButton *button, GtkWidget *row; row = gtk_widget_get_parent (GTK_WIDGET (button)); - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (row)), row); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (row)), row); emit_changed (editor); } @@ -71,17 +71,17 @@ add_string (GtkInspectorStrvEditor *editor, entry = gtk_entry_new (); gtk_editable_set_text (GTK_EDITABLE (entry), str); gtk_widget_show (entry); - gtk_container_add (GTK_CONTAINER (box), entry); + gtk_box_append (GTK_BOX (box), entry); g_object_set_data (G_OBJECT (box), "entry", entry); g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor); button = gtk_button_new_from_icon_name ("user-trash-symbolic"); gtk_widget_add_css_class (button, "image-button"); gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor); - gtk_container_add (GTK_CONTAINER (editor->box), box); + gtk_box_append (GTK_BOX (editor->box), box); gtk_widget_grab_focus (entry); @@ -110,8 +110,8 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor) gtk_widget_show (editor->button); g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor); - gtk_container_add (GTK_CONTAINER (editor), editor->box); - gtk_container_add (GTK_CONTAINER (editor), editor->button); + gtk_box_append (GTK_BOX (editor), editor->box); + gtk_box_append (GTK_BOX (editor), editor->button); } static void @@ -137,7 +137,7 @@ gtk_inspector_strv_editor_set_strv (GtkInspectorStrvEditor *editor, editor->blocked = TRUE; while ((child = gtk_widget_get_first_child (GTK_WIDGET (editor->box)))) - gtk_container_remove (GTK_CONTAINER (editor->box), child); + gtk_box_remove (GTK_BOX (editor->box), child); if (strv) { diff --git a/gtk/tools/gtk-builder-tool-preview.c b/gtk/tools/gtk-builder-tool-preview.c index 70ca1fac28..bac6c0b871 100644 --- a/gtk/tools/gtk-builder-tool-preview.c +++ b/gtk/tools/gtk-builder-tool-preview.c @@ -136,7 +136,7 @@ preview_file (const char *filename, g_object_ref (widget); if (gtk_widget_get_parent (widget) != NULL) - gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget); + gtk_box_remove (GTK_BOX (gtk_widget_get_parent (widget)), widget); gtk_window_set_child (GTK_WINDOW (window), widget); g_object_unref (widget); } 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), "Selected app info"); 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, not 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 ("Options", 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 ("Signal Events", 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 total or gnome 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 @@ -6,11 +6,6 @@ expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog) gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander)); } -static void -do_not_expand (GtkWidget *child, gpointer data) -{ -} - static void response_cb (GtkDialog *dialog, gint response_id, gpointer 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 ("GtkFileChooserButton"); 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), "Entry: "); - 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 \345\205\203\346\260\227 \351\226\213\347\231\272"); 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 text may be marked up\n" @@ -1001,11 +992,11 @@ static void create_labels (GtkWidget *widget) "or activated via keynav"); 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", "b"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 8", "d"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 9", "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", "a"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 13", "a"); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); button = accel_button_new ("Button 14", "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)); + entry = gtk_widget_get_next_sibling (gtk_widget_get_first_child (GTK_WIDGET (data))); + spin = gtk_widget_get_next_sibling (entry); - theme = gtk_editable_get_text (GTK_EDITABLE (children->next->data)); - size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data)); - - 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)) + + for (child = gtk_widget_get_first_child (GTK_WIDGET (orientable)); + child != NULL; + child = gtk_widget_get_next_sibling (child)) { - 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); + 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 (""); 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 (""); - 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 +#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, "Another 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 ("_Futz!!"); - 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); diff --git a/testsuite/a11y/children.c b/testsuite/a11y/children.c index f5c7d588a2..f024e8f5fa 100644 --- a/testsuite/a11y/children.c +++ b/testsuite/a11y/children.c @@ -98,7 +98,7 @@ remove_child (STATE *state, child = gtk_widget_get_parent (child); } - gtk_container_remove (GTK_CONTAINER (state->widget), child); + gtk_box_remove (GTK_BOX (state->widget), child); } static void @@ -170,7 +170,7 @@ test_add_remove (GtkWidget *widget) child_accessible = gtk_widget_get_accessible (state.child[i]); g_signal_connect (child_accessible, "notify::accessible-parent", G_CALLBACK (parent_notify), &(parent_data[i])); - gtk_container_add (GTK_CONTAINER (widget), state.child[i]); + gtk_box_append (GTK_BOX (widget), state.child[i]); } else child_accessible = atk_object_ref_accessible_child (accessible, i); diff --git a/testsuite/gtk/action.c b/testsuite/gtk/action.c index 768de600d3..8f348a3f39 100644 --- a/testsuite/gtk/action.c +++ b/testsuite/gtk/action.c @@ -59,7 +59,7 @@ test_action (void) button = gtk_button_new (); gtk_window_set_child (GTK_WINDOW (window), box); - gtk_container_add (GTK_CONTAINER (box), button); + gtk_box_append (GTK_BOX (box), button); win_actions = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (win_actions), @@ -160,7 +160,7 @@ test_text (void) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); text = gtk_text_new (); - gtk_container_add (GTK_CONTAINER (box), text); + gtk_box_append (GTK_BOX (box), text); clipboard_actions = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (clipboard_actions), diff --git a/testsuite/gtk/gestures.c b/testsuite/gtk/gestures.c index 1a98400309..b9ab90b3e8 100644 --- a/testsuite/gtk/gestures.c +++ b/testsuite/gtk/gestures.c @@ -424,8 +424,8 @@ test_phases (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -476,8 +476,8 @@ test_mixed (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -535,8 +535,8 @@ test_early_exit (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -590,8 +590,8 @@ test_claim_capture (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -637,8 +637,8 @@ test_claim_target (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -684,8 +684,8 @@ test_claim_bubble (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -738,8 +738,8 @@ test_early_claim_capture (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -795,8 +795,8 @@ test_late_claim_capture (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -854,8 +854,8 @@ test_group (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -905,8 +905,8 @@ test_gestures_outside_grab (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -965,8 +965,8 @@ test_gestures_inside_grab (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -1025,8 +1025,8 @@ test_multitouch_on_single (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -1076,8 +1076,8 @@ test_multitouch_activation (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); @@ -1152,8 +1152,8 @@ test_multitouch_interaction (void) gtk_widget_set_vexpand (C, TRUE); gtk_widget_set_name (C, "C"); - gtk_container_add (GTK_CONTAINER (A), B); - gtk_container_add (GTK_CONTAINER (B), C); + gtk_box_append (GTK_BOX (A), B); + gtk_box_append (GTK_BOX (B), C); gtk_widget_show (A); diff --git a/testsuite/gtk/propertylookuplistmodel.c b/testsuite/gtk/propertylookuplistmodel.c index a79d07cfe2..b151e15a62 100644 --- a/testsuite/gtk/propertylookuplistmodel.c +++ b/testsuite/gtk/propertylookuplistmodel.c @@ -115,7 +115,7 @@ create_widget_tree (void) gtk_window_set_child (GTK_WINDOW (window), box); grid = gtk_grid_new (); - gtk_container_add (GTK_CONTAINER (box), grid); + gtk_box_append (GTK_BOX (box), grid); label = gtk_label_new ("Hello World"); gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); @@ -218,7 +218,7 @@ test_change_property (void) assert_model (model, "GtkLabel"); assert_changes (model, "1-3"); - gtk_container_add (GTK_CONTAINER (grandparent), widget); + gtk_box_append (GTK_BOX (grandparent), widget); assert_model (model, "GtkLabel GtkBox GtkWindow"); assert_changes (model, "1+2"); diff --git a/testsuite/gtk/widgetorder.c b/testsuite/gtk/widgetorder.c index c0ffafaeac..0603f2ad98 100644 --- a/testsuite/gtk/widgetorder.c +++ b/testsuite/gtk/widgetorder.c @@ -6,7 +6,7 @@ simple (void) GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); GtkWidget *l = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (box), l); + gtk_box_append (GTK_BOX (box), l); g_assert (gtk_widget_get_parent (l) == box); g_assert (gtk_widget_get_prev_sibling (l) == NULL); @@ -25,8 +25,8 @@ two (void) GtkWidget *l1 = gtk_label_new (""); GtkWidget *l2 = gtk_label_new (""); - gtk_container_add (GTK_CONTAINER (box), l1); - gtk_container_add (GTK_CONTAINER (box), l2); + gtk_box_append (GTK_BOX (box), l1); + gtk_box_append (GTK_BOX (box), l2); g_assert (gtk_widget_get_parent (l1) == box); g_assert (gtk_widget_get_prev_sibling (l1) == NULL);