summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-09 08:26:52 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-11 22:38:21 -0400
commit2a24b8c6534b58051135570399cba8a6b04d34ea (patch)
treec3b4690ed396ab2b2ca162641bd2008d0bd7630e /gtk
parent665edcba53bf2f2e854a95cdcc52a72c16a1a427 (diff)
downloadgtk+-2a24b8c6534b58051135570399cba8a6b04d34ea.tar.gz
Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/a11y/gtklabelaccessible.c23
-rw-r--r--gtk/a11y/gtknotebookpageaccessible.c33
-rw-r--r--gtk/a11y/gtkscrolledwindowaccessible.c49
-rw-r--r--gtk/a11y/gtkwidgetaccessible.c23
-rw-r--r--gtk/gtkactionbar.c6
-rw-r--r--gtk/gtkappchooserdialog.c6
-rw-r--r--gtk/gtkassistant.c30
-rw-r--r--gtk/gtkcalendar.c12
-rw-r--r--gtk/gtkcolorchooserwidget.c56
-rw-r--r--gtk/gtkcombobox.c2
-rw-r--r--gtk/gtkcustompaperunixdialog.c24
-rw-r--r--gtk/gtkdialog.c39
-rw-r--r--gtk/gtkemojichooser.c14
-rw-r--r--gtk/gtkemojicompletion.c12
-rw-r--r--gtk/gtkentrycompletion.c4
-rw-r--r--gtk/gtkexpander.c30
-rw-r--r--gtk/gtkfilechooserbutton.c6
-rw-r--r--gtk/gtkfilechooserdialog.c4
-rw-r--r--gtk/gtkfilechooserwidget.c26
-rw-r--r--gtk/gtkfontbutton.c8
-rw-r--r--gtk/gtkfontchooserwidget.c20
-rw-r--r--gtk/gtkgrid.c14
-rw-r--r--gtk/gtkheaderbar.c12
-rw-r--r--gtk/gtkinfobar.c73
-rw-r--r--gtk/gtkmenubutton.c4
-rw-r--r--gtk/gtkmenusectionbox.c55
-rw-r--r--gtk/gtkmessagedialog.c2
-rw-r--r--gtk/gtkmodelbutton.c6
-rw-r--r--gtk/gtkmountoperation.c36
-rw-r--r--gtk/gtknotebook.c31
-rw-r--r--gtk/gtkpaned.c10
-rw-r--r--gtk/gtkpathbar.c4
-rw-r--r--gtk/gtkplacesview.c10
-rw-r--r--gtk/gtkprintbackend.c16
-rw-r--r--gtk/gtkprinteroptionwidget.c29
-rw-r--r--gtk/gtkprintoperation-win32.c2
-rw-r--r--gtk/gtkprintunixdialog.c30
-rw-r--r--gtk/gtkradiobutton.c6
-rw-r--r--gtk/gtkscrolledwindow.c6
-rw-r--r--gtk/gtkshortcutsgroup.c30
-rw-r--r--gtk/gtkshortcutssection.c69
-rw-r--r--gtk/gtkshortcutsshortcut.c10
-rw-r--r--gtk/gtkshortcutswindow.c38
-rw-r--r--gtk/gtktext.c4
-rw-r--r--gtk/gtktextview.c4
-rw-r--r--gtk/gtktogglebutton.c4
-rw-r--r--gtk/gtktooltipwindow.c4
-rw-r--r--gtk/gtktreepopover.c6
-rw-r--r--gtk/gtktreeviewcolumn.c16
-rw-r--r--gtk/gtkwidget.c4
-rw-r--r--gtk/gtkwindow.c3
-rw-r--r--gtk/gtkwindowhandle.c14
-rw-r--r--gtk/inspector/action-editor.c18
-rw-r--r--gtk/inspector/actions.c10
-rw-r--r--gtk/inspector/controllers.c8
-rw-r--r--gtk/inspector/general.c8
-rw-r--r--gtk/inspector/misc-info.c4
-rw-r--r--gtk/inspector/object-tree.c14
-rw-r--r--gtk/inspector/prop-editor.c52
-rw-r--r--gtk/inspector/prop-list.c10
-rw-r--r--gtk/inspector/recorder.c18
-rw-r--r--gtk/inspector/shortcuts.c4
-rw-r--r--gtk/inspector/size-groups.c14
-rw-r--r--gtk/inspector/strv-editor.c14
-rw-r--r--gtk/tools/gtk-builder-tool-preview.c2
65 files changed, 565 insertions, 590 deletions
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))
- {
- child = GTK_WIDGET (tmp_list->data);
- break;
- }
- else if (GTK_IS_CONTAINER (tmp_list->data))
+ if (GTK_IS_LABEL (child))
+ return child;
+ else
{
- 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 == 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 (child == 2)
+ chosen = vscrollbar;
+ else if (child == 1)
+ chosen = c ? hscrollbar : vscrollbar;
+ else if (child == 0)
+ chosen = c ? c : (hscrollbar ? hscrollbar : vscrollbar);
- g_list_free (children);
- if (accessible)
- g_object_ref (accessible);
+ if (chosen)
+ return g_object_ref (gtk_widget_get_accessible (chosen));
- 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;
+
+ 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 children;
+ 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;
-
- children = gtk_container_get_children (GTK_CONTAINER (box->item_box));
+ int pos;
- 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 ("<big><b>%s</b></big>\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);
}