diff options
Diffstat (limited to 'demos')
44 files changed, 243 insertions, 234 deletions
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), "<u>Checkerboard pattern</u>"); - 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), "<u>Scribble area</u>"); - 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 <b>total</b> or <b>gnome</b> for example."); - gtk_container_add (GTK_CONTAINER (vbox), label); + gtk_box_append (GTK_BOX (vbox), label); /* Create our 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), "<u>Image loaded from a file</u>"); - 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), "<u>Animation loaded from a file</u>"); - 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), "<u>Symbolic themed icon</u>"); - 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), "<u>Progressive image loading</u>"); - 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), "<u>Displaying video</u>"); - 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), "<u>GtkWidgetPaintable</u>"); - 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)); |