summaryrefslogtreecommitdiff
path: root/tests/testgtk.c
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 /tests/testgtk.c
parent665edcba53bf2f2e854a95cdcc52a72c16a1a427 (diff)
downloadgtk+-2a24b8c6534b58051135570399cba8a6b04d34ea.tar.gz
Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
Diffstat (limited to 'tests/testgtk.c')
-rw-r--r--tests/testgtk.c693
1 files changed, 340 insertions, 353 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index d1463810f0..a296f5167f 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -155,10 +155,10 @@ build_alpha_widgets (void)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<i>Entry: </i>");
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
entry = gtk_entry_new ();
gtk_widget_set_hexpand (entry, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), entry);
+ gtk_box_append (GTK_BOX (hbox), entry);
gtk_widget_set_hexpand (hbox, TRUE);
gtk_grid_attach (GTK_GRID (grid), hbox, 0, 3, 2, 1);
@@ -217,16 +217,14 @@ create_alpha_window (GtkWidget *widget)
gtk_widget_set_margin_start (vbox, 12);
gtk_widget_set_margin_end (vbox, 12);
gtk_widget_set_vexpand (vbox, TRUE);
- gtk_container_add (GTK_CONTAINER (content_area), vbox);
-
label = gtk_label_new (NULL);
- gtk_widget_set_vexpand (label, TRUE);
- gtk_container_add (GTK_CONTAINER (vbox), label);
+ gtk_box_append (GTK_BOX (content_area), vbox);
+ gtk_box_append (GTK_BOX (vbox), label);
display = gtk_widget_get_display (window);
on_composited_changed (display, NULL, GTK_LABEL (label));
g_signal_connect (display, "notify::composited", G_CALLBACK (on_composited_changed), label);
- gtk_container_add (GTK_CONTAINER (vbox), build_alpha_widgets ());
+ gtk_box_append (GTK_BOX (vbox), build_alpha_widgets ());
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_signal_connect (window, "response",
@@ -246,7 +244,7 @@ create_alpha_window (GtkWidget *widget)
static void
button_window (GtkWidget *widget,
- GtkWidget *button)
+ GtkWidget *button)
{
if (!gtk_widget_get_visible (button))
gtk_widget_show (button);
@@ -282,11 +280,12 @@ create_buttons (GtkWidget *widget)
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
+
gtk_widget_set_margin_top (grid, 10);
gtk_widget_set_margin_bottom (grid, 10);
gtk_widget_set_margin_start (grid, 10);
gtk_widget_set_margin_end (grid, 10);
- gtk_container_add (GTK_CONTAINER (box1), grid);
+ gtk_box_append (GTK_BOX (box1), grid);
button[0] = gtk_button_new_with_label ("button1");
button[1] = gtk_button_new_with_mnemonic ("_button2");
@@ -311,10 +310,10 @@ create_buttons (GtkWidget *widget)
}
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button[9] = gtk_button_new_with_label ("close");
gtk_widget_set_margin_top (button[9], 10);
@@ -324,7 +323,7 @@ create_buttons (GtkWidget *widget)
g_signal_connect_swapped (button[9], "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button[9]);
+ gtk_box_append (GTK_BOX (box2), button[9]);
gtk_window_set_default_widget (GTK_WINDOW (window), button[9]);
}
@@ -360,28 +359,28 @@ create_toggle_buttons (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), box1);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_toggle_button_new_with_label ("button1");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_toggle_button_new_with_label ("button2");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_toggle_button_new_with_label ("button3");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -481,27 +480,27 @@ create_check_buttons (GtkWidget *widget)
gtk_widget_set_margin_end (box2, 10);
gtk_widget_set_margin_top (box2, 10);
gtk_widget_set_margin_bottom (box2, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_check_button_new_with_mnemonic ("_button1");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_check_button_new_with_label ("button2");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_check_button_new_with_label ("button3");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_check_button_new_with_label ("inconsistent");
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box2), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
table = create_widget_grid (GTK_TYPE_CHECK_BUTTON);
gtk_widget_set_vexpand (table, TRUE);
- gtk_container_add (GTK_CONTAINER (box2), table);
+ gtk_box_append (GTK_BOX (box2), table);
}
if (!gtk_widget_get_visible (window))
@@ -542,53 +541,53 @@ create_radio_buttons (GtkWidget *widget)
box1 = gtk_dialog_get_content_area (GTK_DIALOG (window));
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_radio_button_new_with_label (NULL, "button1");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"button2");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"button3");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"inconsistent");
gtk_check_button_set_inconsistent (GTK_CHECK_BUTTON (button), TRUE);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_radio_button_new_with_label (NULL, "button4");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"button5");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"button6");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
table = create_widget_grid (GTK_TYPE_RADIO_BUTTON);
- gtk_container_add (GTK_CONTAINER (box1), table);
+ gtk_box_append (GTK_BOX (box1), table);
}
if (!gtk_widget_get_visible (window))
@@ -728,7 +727,7 @@ create_statusbar (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), box1);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
statusbar = gtk_statusbar_new ();
g_signal_connect (statusbar,
@@ -739,7 +738,7 @@ create_statusbar (GtkWidget *widget)
button = g_object_new (gtk_button_get_type (),
"label", "push something",
NULL);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
g_object_connect (button,
"signal::clicked", statusbar_push, statusbar,
NULL);
@@ -749,41 +748,41 @@ create_statusbar (GtkWidget *widget)
NULL),
"signal_after::clicked", statusbar_pop, statusbar,
NULL);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "steal #4",
NULL),
"signal_after::clicked", statusbar_steal, statusbar,
NULL);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "test contexts",
NULL),
"swapped_signal_after::clicked", statusbar_contexts, statusbar,
NULL);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = g_object_connect (g_object_new (gtk_button_get_type (),
"label", "push something long",
NULL),
"signal_after::clicked", statusbar_push_long, statusbar,
NULL);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
- gtk_container_add (GTK_CONTAINER (box1), statusbar);
+ gtk_box_append (GTK_BOX (box1), box2);
+ gtk_box_append (GTK_BOX (box1), statusbar);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -826,24 +825,16 @@ static void
set_selectable_recursive (GtkWidget *widget,
gboolean setting)
{
- if (GTK_IS_CONTAINER (widget))
+ if (GTK_IS_LABEL (widget))
+ gtk_label_set_selectable (GTK_LABEL (widget), setting);
+ else
{
- GList *children;
- GList *tmp;
-
- children = gtk_container_get_children (GTK_CONTAINER (widget));
- tmp = children;
- while (tmp)
- {
- set_selectable_recursive (tmp->data, setting);
+ GtkWidget *child;
- tmp = tmp->next;
- }
- g_list_free (children);
- }
- else if (GTK_IS_LABEL (widget))
- {
- gtk_label_set_selectable (GTK_LABEL (widget), setting);
+ for (child = gtk_widget_get_first_child (widget);
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ set_selectable_recursive (child, setting);
}
}
@@ -939,42 +930,42 @@ static void create_labels (GtkWidget *widget)
button = create_sensitivity_control (hbox);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = create_selectable_control (hbox);
- gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add (GTK_CONTAINER (hbox), vbox);
+ gtk_box_append (GTK_BOX (hbox), vbox);
frame = gtk_frame_new ("Normal Label");
label = gtk_label_new ("This is a Normal label");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Multi-line Label");
label = gtk_label_new ("This is a Multi-line label.\nSecond line\nThird line");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Left Justified Label");
label = gtk_label_new ("This is a Left-Justified\nMulti-line label.\nThird line");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Right Justified Label");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
label = gtk_label_new ("This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Internationalized Label");
label = gtk_label_new (NULL);
@@ -987,13 +978,13 @@ static void create_labels (GtkWidget *widget)
"Japanese <span lang=\"ja\">\345\205\203\346\260\227 \351\226\213\347\231\272</span>");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Bidirection Label");
label = gtk_label_new ("\342\200\217Arabic \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205\n"
"\342\200\217Hebrew \327\251\327\234\327\225\327\235");
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Links in a label");
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\" title=\"plain text\">text</a> may be marked up\n"
@@ -1001,11 +992,11 @@ static void create_labels (GtkWidget *widget)
"or activated via <a href=\"keynav\">keynav</a>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add (GTK_CONTAINER (hbox), vbox);
+ gtk_box_append (GTK_BOX (hbox), vbox);
frame = gtk_frame_new ("Line wrapped label");
label = gtk_label_new ("This is an example of a line-wrapped label. It should not be taking "\
"up the entire "/* big space to test spacing */\
@@ -1017,7 +1008,7 @@ static void create_labels (GtkWidget *widget)
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Filled, wrapped label");
label = gtk_label_new ("This is an example of a line-wrapped, filled label. It should be taking "\
@@ -1030,14 +1021,14 @@ static void create_labels (GtkWidget *widget)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Underlined label");
label = gtk_label_new ("This label is underlined!\n"
"This one is underlined (\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257) in quite a funky fashion");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
frame = gtk_frame_new ("Markup label");
label = gtk_label_new (NULL);
@@ -1064,7 +1055,7 @@ static void create_labels (GtkWidget *widget)
g_assert (gtk_label_get_mnemonic_keyval (GTK_LABEL (label)) == GDK_KEY_s);
gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
}
if (!gtk_widget_get_visible (window))
@@ -1173,7 +1164,7 @@ create_rotated_text (GtkWidget *widget)
drawing_area = gtk_drawing_area_new ();
gtk_widget_set_hexpand (drawing_area, TRUE);
gtk_widget_set_vexpand (drawing_area, TRUE);
- gtk_container_add (GTK_CONTAINER (content_area), drawing_area);
+ gtk_box_append (GTK_BOX (content_area), drawing_area);
tile_pixbuf = gdk_pixbuf_new_from_file ("marble.xpm", NULL);
@@ -1227,10 +1218,10 @@ create_pixbuf (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), box1);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gdk_surface = gtk_native_get_surface (GTK_NATIVE (window));
@@ -1238,34 +1229,34 @@ create_pixbuf (GtkWidget *widget)
label = gtk_label_new ("Pixbuf\ntest");
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (box3), pixbufwid);
- gtk_container_add (GTK_CONTAINER (box3), label);
+ gtk_box_append (GTK_BOX (box3), pixbufwid);
+ gtk_box_append (GTK_BOX (box3), label);
gtk_button_set_child (GTK_BUTTON (button), box3);
button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
pixbufwid = new_pixbuf ("test.xpm", gdk_surface);
label = gtk_label_new ("Pixbuf\ntest");
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (box3), pixbufwid);
- gtk_container_add (GTK_CONTAINER (box3), label);
+ gtk_box_append (GTK_BOX (box3), pixbufwid);
+ gtk_box_append (GTK_BOX (box3), label);
gtk_button_set_child (GTK_BUTTON (button), box3);
gtk_widget_set_sensitive (button, FALSE);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -1302,15 +1293,15 @@ create_tooltips (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), box1);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_toggle_button_new_with_label ("button1");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_widget_set_tooltip_text (button, "This is button 1");
button = gtk_toggle_button_new_with_label ("button2");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_widget_set_tooltip_text (button,
"This is button 2. This is also a really long tooltip which probably "
@@ -1318,7 +1309,7 @@ create_tooltips (GtkWidget *widget)
"Hopefully the wrapping will work correctly.");
toggle = gtk_toggle_button_new_with_label ("Override TipsQuery Label");
- gtk_container_add (GTK_CONTAINER (box2), toggle);
+ gtk_box_append (GTK_BOX (box2), toggle);
gtk_widget_set_tooltip_text (toggle, "Toggle TipsQuery view.");
@@ -1333,27 +1324,27 @@ create_tooltips (GtkWidget *widget)
g_object_new (gtk_button_get_type (),
"label", "[?]",
NULL);
- gtk_container_add (GTK_CONTAINER (box3), button);
+ gtk_box_append (GTK_BOX (box3), button);
gtk_widget_set_tooltip_text (button, "Start the Tooltips Inspector");
frame = g_object_new (gtk_frame_get_type (),
"label", "ToolTips Inspector",
"label_xalign", (double) 0.5,
NULL);
- gtk_container_add (GTK_CONTAINER (box2), frame);
+ gtk_box_append (GTK_BOX (box2), frame);
gtk_frame_set_child (GTK_FRAME (frame), box3);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
gtk_widget_set_tooltip_text (button, "Push this button to close window");
@@ -1374,10 +1365,10 @@ pack_image (GtkWidget *box,
const gchar *text,
GtkWidget *image)
{
- gtk_container_add (GTK_CONTAINER (box),
+ gtk_box_append (GTK_BOX (box),
gtk_label_new (text));
- gtk_container_add (GTK_CONTAINER (box),
+ gtk_box_append (GTK_BOX (box),
image);
}
@@ -1531,17 +1522,17 @@ create_listbox (GtkWidget *widget)
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (hbox), scrolled);
+ gtk_box_append (GTK_BOX (hbox), scrolled);
scrolled_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), scrolled_box);
label = gtk_label_new ("This is \na LABEL\nwith rows");
- gtk_container_add (GTK_CONTAINER (scrolled_box), label);
+ gtk_box_append (GTK_BOX (scrolled_box), label);
list = gtk_list_box_new();
gtk_list_box_set_adjustment (GTK_LIST_BOX (list), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled)));
- gtk_container_add (GTK_CONTAINER (scrolled_box), list);
+ gtk_box_append (GTK_BOX (scrolled_box), list);
for (i = 0; i < 1000; i++)
{
@@ -1552,30 +1543,30 @@ create_listbox (GtkWidget *widget)
}
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (hbox), vbox);
+ gtk_box_append (GTK_BOX (hbox), vbox);
button = gtk_button_new_with_label ("sort");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (list_sort_clicked_cb), list);
button = gtk_button_new_with_label ("filter odd");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (list_filter_odd_clicked_cb), list);
button = gtk_button_new_with_label ("filter all");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (list_filter_all_clicked_cb), list);
button = gtk_button_new_with_label ("unfilter");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (list_unfilter_clicked_cb), list);
button = gtk_button_new_with_label ("add placeholder");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (add_placeholder_clicked_cb), list);
button = gtk_button_new_with_label ("remove placeholder");
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (remove_placeholder_clicked_cb), list);
}
@@ -1645,34 +1636,34 @@ create_key_lookup (GtkWidget *widget)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_hexpand (box, TRUE);
gtk_widget_set_vexpand (box, TRUE);
- gtk_container_add (GTK_CONTAINER (content_area), box);
+ gtk_box_append (GTK_BOX (content_area), box);
button = gtk_button_new_with_mnemonic ("Button 1 (_a)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 2 (_A)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 3 (_\321\204)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 4 (_\320\244)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 6 (_b)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 7", "<Alt><Shift>b");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 8", "<Alt>d");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 9", "<Alt>Cyrillic_ve");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 10 (_1)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_mnemonic ("Button 11 (_!)");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 12", "<Super>a");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 13", "<Hyper>a");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
button = accel_button_new ("Button 14", "<Meta>a");
- gtk_container_add (GTK_CONTAINER (box), button);
+ gtk_box_append (GTK_BOX (box), button);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
g_signal_connect (window, "response", G_CALLBACK (gtk_window_destroy), NULL);
@@ -1773,12 +1764,12 @@ create_modal_window (GtkWidget *widget)
/* Pack widgets */
gtk_window_set_child (GTK_WINDOW (window), box1);
- gtk_container_add (GTK_CONTAINER (box1), frame1);
+ gtk_box_append (GTK_BOX (box1), frame1);
gtk_frame_set_child (GTK_FRAME (frame1), box2);
- gtk_container_add (GTK_CONTAINER (box2), btnColor);
- gtk_container_add (GTK_CONTAINER (box2), btnFile);
- gtk_container_add (GTK_CONTAINER (box1), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
- gtk_container_add (GTK_CONTAINER (box1), btnClose);
+ gtk_box_append (GTK_BOX (box2), btnColor);
+ gtk_box_append (GTK_BOX (box2), btnFile);
+ gtk_box_append (GTK_BOX (box1), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
+ gtk_box_append (GTK_BOX (box1), btnClose);
/* connect signals */
g_signal_connect_swapped (btnClose, "clicked",
@@ -1863,7 +1854,7 @@ scrolled_windows_delete_cb (GtkWidget *widget,
GtkWidget *scrollwin)
{
g_object_ref (scrollwin);
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
+ gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw_parent), scrollwin);
g_object_unref (scrollwin);
@@ -1897,8 +1888,8 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
if (sw_parent)
{
g_object_ref (scrollwin);
- gtk_window_set_child (GTK_WINDOW (gtk_widget_get_parent (scrollwin)), NULL);
- gtk_container_add (GTK_CONTAINER (sw_parent), scrollwin);
+ gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin);
+ gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin);
g_object_unref (scrollwin);
@@ -1919,7 +1910,7 @@ scrolled_windows_remove (GtkWidget *dialog, gint response, GtkWidget *scrollwin)
gtk_window_set_default_size (GTK_WINDOW (sw_float_parent), 200, 200);
g_object_ref (scrollwin);
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (scrollwin)), scrollwin);
+ gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin);
gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin);
g_object_unref (scrollwin);
@@ -1963,7 +1954,7 @@ create_scrolled_windows (GtkWidget *widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (content_area), scrolled_window);
+ gtk_box_append (GTK_BOX (content_area), scrolled_window);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
@@ -2112,16 +2103,16 @@ create_entry (GtkWidget *widget)
gtk_widget_set_margin_bottom (box2, 10);
gtk_widget_set_margin_start (box2, 10);
gtk_widget_set_margin_end (box2, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_container_add (GTK_CONTAINER (box2), hbox);
+ gtk_box_append (GTK_BOX (box2), hbox);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "hello world \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5);
gtk_widget_set_hexpand (entry, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), entry);
+ gtk_box_append (GTK_BOX (hbox), entry);
cb = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
@@ -2140,45 +2131,45 @@ create_entry (GtkWidget *widget)
cb_entry = gtk_combo_box_get_child (GTK_COMBO_BOX (cb));
gtk_editable_set_text (GTK_EDITABLE (cb_entry), "hello world \n\n\n foo");
gtk_editable_select_region (GTK_EDITABLE (cb_entry), 0, -1);
- gtk_container_add (GTK_CONTAINER (box2), GTK_WIDGET (cb));
+ gtk_box_append (GTK_BOX (box2), GTK_WIDGET (cb));
sensitive_check = gtk_check_button_new_with_label ("Sensitive");
- gtk_container_add (GTK_CONTAINER (box2), sensitive_check);
+ gtk_box_append (GTK_BOX (box2), sensitive_check);
g_signal_connect (sensitive_check, "toggled",
G_CALLBACK (entry_toggle_sensitive), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sensitive_check), TRUE);
has_frame_check = gtk_check_button_new_with_label("Has Frame");
- gtk_container_add (GTK_CONTAINER (box2), has_frame_check);
+ gtk_box_append (GTK_BOX (box2), has_frame_check);
g_signal_connect (has_frame_check, "toggled",
G_CALLBACK (entry_toggle_frame), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (has_frame_check), TRUE);
progress_check = gtk_check_button_new_with_label("Show Progress");
- gtk_container_add (GTK_CONTAINER (box2), progress_check);
+ gtk_box_append (GTK_BOX (box2), progress_check);
g_signal_connect (progress_check, "toggled",
G_CALLBACK (entry_toggle_progress), entry);
progress_check = gtk_check_button_new_with_label("Pulse Progress");
- gtk_container_add (GTK_CONTAINER (box2), progress_check);
+ gtk_box_append (GTK_BOX (box2), progress_check);
g_signal_connect (progress_check, "toggled",
G_CALLBACK (entry_toggle_pulse), entry);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_widget_set_margin_top (box2, 10);
gtk_widget_set_margin_bottom (box2, 10);
gtk_widget_set_margin_start (box2, 10);
gtk_widget_set_margin_end (box2, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -2210,7 +2201,7 @@ create_expander (GtkWidget *widget)
expander = gtk_expander_new ("The Hidden");
- gtk_container_add (GTK_CONTAINER (box1), expander);
+ gtk_box_append (GTK_BOX (box1), expander);
hidden = gtk_label_new ("Revealed!");
@@ -2282,10 +2273,10 @@ create_size_group_window (GdkDisplay *display,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (content_area), vbox);
+ gtk_box_append (GTK_BOX (content_area), vbox);
grid = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (vbox), grid);
+ gtk_box_append (GTK_BOX (content_area), grid);
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
@@ -2346,19 +2337,19 @@ create_size_group_window (GdkDisplay *display,
g_object_unref (vgroup2);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (content_area), hbox);
spin_button = gtk_spin_button_new_with_range (1, 100, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
gtk_widget_set_hexpand (spin_button, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), spin_button);
+ gtk_box_append (GTK_BOX (hbox), spin_button);
g_signal_connect (spin_button, "value_changed",
G_CALLBACK (size_group_hsize_changed), main_button);
spin_button = gtk_spin_button_new_with_range (1, 100, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
gtk_widget_set_hexpand (spin_button, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), spin_button);
+ gtk_box_append (GTK_BOX (hbox), spin_button);
g_signal_connect (spin_button, "value_changed",
G_CALLBACK (size_group_vsize_changed), main_button);
@@ -2601,7 +2592,7 @@ create_spins (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), main_vbox);
frame = gtk_frame_new ("Not accelerated");
- gtk_container_add (GTK_CONTAINER (main_vbox), frame);
+ gtk_box_append (GTK_BOX (main_vbox), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
@@ -2609,16 +2600,16 @@ create_spins (GtkWidget *widget)
/* Time, month, hex spinners */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_hexpand (vbox2, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), vbox2);
+ gtk_box_append (GTK_BOX (hbox), vbox2);
label = gtk_label_new ("Time :");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), label);
+ gtk_box_append (GTK_BOX (vbox2), label);
adjustment = gtk_adjustment_new (0, 0, 1410, 30, 60, 0);
spinner = gtk_spin_button_new (adjustment, 0, 0);
@@ -2629,16 +2620,16 @@ create_spins (GtkWidget *widget)
NULL);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 5);
- gtk_container_add (GTK_CONTAINER (vbox2), spinner);
+ gtk_box_append (GTK_BOX (vbox2), spinner);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_hexpand (vbox2, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), vbox2);
+ gtk_box_append (GTK_BOX (hbox), vbox2);
label = gtk_label_new ("Month :");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), label);
+ gtk_box_append (GTK_BOX (vbox2), label);
adjustment = gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
5.0, 0.0);
@@ -2655,16 +2646,16 @@ create_spins (GtkWidget *widget)
NULL);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 9);
- gtk_container_add (GTK_CONTAINER (vbox2), spinner);
+ gtk_box_append (GTK_BOX (vbox2), spinner);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_hexpand (vbox2, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), vbox2);
+ gtk_box_append (GTK_BOX (hbox), vbox2);
label = gtk_label_new ("Hex :");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), label);
+ gtk_box_append (GTK_BOX (vbox2), label);
adjustment = gtk_adjustment_new (0, 0, 255, 1, 16, 0);
spinner = gtk_spin_button_new (adjustment, 0, 0);
@@ -2679,67 +2670,67 @@ create_spins (GtkWidget *widget)
NULL);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
gtk_editable_set_width_chars (GTK_EDITABLE (spinner), 4);
- gtk_container_add (GTK_CONTAINER (vbox2), spinner);
+ gtk_box_append (GTK_BOX (vbox2), spinner);
frame = gtk_frame_new ("Accelerated");
- gtk_container_add (GTK_CONTAINER (main_vbox), frame);
+ gtk_box_append (GTK_BOX (main_vbox), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (hbox), vbox2);
+ gtk_box_append (GTK_BOX (hbox), vbox2);
label = gtk_label_new ("Value :");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), label);
+ gtk_box_append (GTK_BOX (vbox2), label);
adjustment = gtk_adjustment_new (0.0, -10000.0, 10000.0,
0.5, 100.0, 0.0);
spinner1 = gtk_spin_button_new (adjustment, 1.0, 2);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE);
- gtk_container_add (GTK_CONTAINER (vbox2), spinner1);
+ gtk_box_append (GTK_BOX (vbox2), spinner1);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (hbox), vbox2);
+ gtk_box_append (GTK_BOX (hbox), vbox2);
label = gtk_label_new ("Digits :");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), label);
+ gtk_box_append (GTK_BOX (vbox2), label);
adjustment = gtk_adjustment_new (2, 1, 15, 1, 1, 0);
spinner2 = gtk_spin_button_new (adjustment, 0.0, 0);
g_signal_connect (adjustment, "value_changed",
G_CALLBACK (change_digits),
spinner2);
- gtk_container_add (GTK_CONTAINER (vbox2), spinner2);
+ gtk_box_append (GTK_BOX (vbox2), spinner2);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_check_button_new_with_label ("Snap to 0.5-ticks");
g_signal_connect (button, "clicked",
G_CALLBACK (toggle_snap),
spinner1);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
button = gtk_check_button_new_with_label ("Numeric only input mode");
g_signal_connect (button, "clicked",
G_CALLBACK (toggle_numeric),
spinner1);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
val_label = gtk_label_new ("");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_button_new_with_label ("Value as Int");
gtk_widget_set_hexpand (button, TRUE);
@@ -2747,7 +2738,7 @@ create_spins (GtkWidget *widget)
g_signal_connect (button, "clicked",
G_CALLBACK (get_value),
GINT_TO_POINTER (1));
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Value as Float");
gtk_widget_set_hexpand (button, TRUE);
@@ -2755,13 +2746,13 @@ create_spins (GtkWidget *widget)
g_signal_connect (button, "clicked",
G_CALLBACK (get_value),
GINT_TO_POINTER (2));
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
- gtk_container_add (GTK_CONTAINER (vbox), val_label);
+ gtk_box_append (GTK_BOX (vbox), val_label);
gtk_label_set_text (GTK_LABEL (val_label), "0");
frame = gtk_frame_new ("Using Convenience Constructor");
- gtk_container_add (GTK_CONTAINER (main_vbox), frame);
+ gtk_box_append (GTK_BOX (main_vbox), frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
@@ -2774,18 +2765,18 @@ create_spins (GtkWidget *widget)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), 0.0);
g_signal_connect (spinner, "value_changed",
G_CALLBACK (get_spin_value), val_label);
- gtk_container_add (GTK_CONTAINER (hbox), spinner);
- gtk_container_add (GTK_CONTAINER (hbox), val_label);
+ gtk_box_append (GTK_BOX (hbox), spinner);
+ gtk_box_append (GTK_BOX (hbox), val_label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (main_vbox), hbox);
+ gtk_box_append (GTK_BOX (main_vbox), hbox);
button = gtk_button_new_with_label ("Close");
gtk_widget_set_hexpand (button, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
}
if (!gtk_widget_get_visible (window))
@@ -2988,20 +2979,20 @@ set_cursor_from_name (GtkWidget *entry,
static void
change_cursor_theme (GtkWidget *widget,
- gpointer data)
+ gpointer data)
{
#if defined(GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WAYLAND)
const gchar *theme;
gint size;
- GList *children;
GdkDisplay *display;
+ GtkWidget *entry;
+ GtkWidget *spin;
- children = gtk_container_get_children (GTK_CONTAINER (data));
-
- theme = gtk_editable_get_text (GTK_EDITABLE (children->next->data));
- size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data));
+ entry = gtk_widget_get_next_sibling (gtk_widget_get_first_child (GTK_WIDGET (data)));
+ spin = gtk_widget_get_next_sibling (entry);
- g_list_free (children);
+ theme = gtk_editable_get_text (GTK_EDITABLE (entry));
+ size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin));
display = gtk_widget_get_display (widget);
#ifdef GDK_WINDOWING_X11
@@ -3052,7 +3043,7 @@ create_cursors (GtkWidget *widget)
"homogeneous", FALSE,
"spacing", 5,
NULL);
- gtk_container_add (GTK_CONTAINER (main_vbox), vbox);
+ gtk_box_append (GTK_BOX (main_vbox), vbox);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (vbox)))
@@ -3070,21 +3061,21 @@ create_cursors (GtkWidget *widget)
gtk_widget_set_margin_bottom (hbox, 5);
gtk_widget_set_margin_start (hbox, 5);
gtk_widget_set_margin_end (hbox, 5);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Cursor Theme:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
entry = gtk_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "default");
- gtk_container_add (GTK_CONTAINER (hbox), entry);
+ gtk_box_append (GTK_BOX (hbox), entry);
size = gtk_spin_button_new_with_range (1.0, 128.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
gtk_widget_set_hexpand (size, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), size);
+ gtk_box_append (GTK_BOX (hbox), size);
g_signal_connect (entry, "changed",
G_CALLBACK (change_cursor_theme), hbox);
@@ -3097,12 +3088,12 @@ create_cursors (GtkWidget *widget)
gtk_widget_set_margin_bottom (hbox, 5);
gtk_widget_set_margin_start (hbox, 5);
gtk_widget_set_margin_end (hbox, 5);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Cursor Name:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
entry = gtk_entry_new ();
completion = gtk_entry_completion_new ();
@@ -3112,14 +3103,14 @@ create_cursors (GtkWidget *widget)
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (model);
gtk_widget_set_hexpand (entry, TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), entry);
+ gtk_box_append (GTK_BOX (hbox), entry);
frame =
g_object_new (gtk_frame_get_type (),
"label_xalign", 0.5,
"label", "Cursor Area",
NULL);
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
darea = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (darea), 80);
@@ -3136,21 +3127,21 @@ create_cursors (GtkWidget *widget)
any = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (main_vbox), any);
+ gtk_box_append (GTK_BOX (main_vbox), any);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_margin_top (hbox, 10);
gtk_widget_set_margin_bottom (hbox, 10);
gtk_widget_set_margin_start (hbox, 10);
gtk_widget_set_margin_end (hbox, 10);
- gtk_container_add (GTK_CONTAINER (main_vbox), hbox);
+ gtk_box_append (GTK_BOX (main_vbox), hbox);
button = gtk_button_new_with_label ("Close");
gtk_widget_set_hexpand (button, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
gtk_widget_show (window);
@@ -3190,11 +3181,11 @@ create_color_selection (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), hbox);
label = gtk_label_new ("Pick a color");
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
picker = gtk_color_button_new ();
gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (picker), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), picker);
+ gtk_box_append (GTK_BOX (hbox), picker);
}
if (!gtk_widget_get_visible (window))
@@ -3216,6 +3207,7 @@ static void
orientable_toggle_orientation (GtkOrientable *orientable)
{
GtkOrientation orientation;
+ GtkWidget *child;
orientation = gtk_orientable_get_orientation (orientable);
gtk_orientable_set_orientation (orientable,
@@ -3223,20 +3215,13 @@ orientable_toggle_orientation (GtkOrientable *orientable)
GTK_ORIENTATION_VERTICAL :
GTK_ORIENTATION_HORIZONTAL);
- if (GTK_IS_CONTAINER (orientable))
- {
- GList *children;
- GList *child;
-
- children = gtk_container_get_children (GTK_CONTAINER (orientable));
-
- for (child = children; child; child = child->next)
- {
- if (GTK_IS_ORIENTABLE (child->data))
- orientable_toggle_orientation (child->data);
- }
- g_list_free (children);
+ for (child = gtk_widget_get_first_child (GTK_WIDGET (orientable));
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ {
+ if (GTK_IS_ORIENTABLE (child))
+ orientable_toggle_orientation (GTK_ORIENTABLE (child));
}
}
@@ -3253,15 +3238,16 @@ flipping_orientation_toggled_cb (GtkWidget *widget, gpointer data)
static void
set_direction_recurse (GtkWidget *widget,
- gpointer data)
+ gpointer data)
{
GtkTextDirection *dir = data;
-
+ GtkWidget *child;
+
gtk_widget_set_direction (widget, *dir);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- set_direction_recurse,
- data);
+ for (child = gtk_widget_get_first_child (widget);
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
+ set_direction_recurse (child, data);
}
static GtkWidget *
@@ -3274,8 +3260,8 @@ create_forward_back (const char *title,
GtkWidget *forward_button = gtk_button_new_with_label ("Forward");
gtk_frame_set_child (GTK_FRAME (frame), bbox);
- gtk_container_add (GTK_CONTAINER (bbox), back_button);
- gtk_container_add (GTK_CONTAINER (bbox), forward_button);
+ gtk_box_append (GTK_BOX (bbox), back_button);
+ gtk_box_append (GTK_BOX (bbox), forward_button);
set_direction_recurse (frame, &text_dir);
@@ -3302,7 +3288,7 @@ create_flipping (GtkWidget *widget)
gtk_window_set_title (GTK_WINDOW (window), "Bidirectional Flipping");
check_button = gtk_check_button_new_with_label ("Right-to-left global direction");
- gtk_container_add (GTK_CONTAINER (content_area), check_button);
+ gtk_box_append (GTK_BOX (content_area), check_button);
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
@@ -3311,18 +3297,18 @@ create_flipping (GtkWidget *widget)
G_CALLBACK (flipping_toggled_cb), NULL);
check_button = gtk_check_button_new_with_label ("Toggle orientation of all boxes");
- gtk_container_add (GTK_CONTAINER (content_area), check_button);
+ gtk_box_append (GTK_BOX (content_area), check_button);
g_signal_connect (check_button, "toggled",
G_CALLBACK (flipping_orientation_toggled_cb), NULL);
- gtk_container_add (GTK_CONTAINER (content_area),
+ gtk_box_append (GTK_BOX (content_area),
create_forward_back ("Default", GTK_TEXT_DIR_NONE));
- gtk_container_add (GTK_CONTAINER (content_area),
+ gtk_box_append (GTK_BOX (content_area),
create_forward_back ("Left-to-Right", GTK_TEXT_DIR_LTR));
- gtk_container_add (GTK_CONTAINER (content_area),
+ gtk_box_append (GTK_BOX (content_area),
create_forward_back ("Right-to-Left", GTK_TEXT_DIR_RTL));
gtk_dialog_add_button (GTK_DIALOG (window), "Close", GTK_RESPONSE_CLOSE);
@@ -3365,11 +3351,11 @@ create_font_selection (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), hbox);
label = gtk_label_new ("Pick a font");
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
picker = gtk_font_button_new ();
gtk_font_button_set_use_font (GTK_FONT_BUTTON (picker), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), picker);
+ gtk_box_append (GTK_BOX (hbox), picker);
}
if (!gtk_widget_get_visible (window))
@@ -3388,24 +3374,25 @@ static void
dialog_response_cb (GtkWidget *widget, gint response, gpointer unused)
{
GtkWidget *content_area;
- GList *l, *children;
+ GtkWidget *child;
if (response == GTK_RESPONSE_APPLY)
{
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog_window));
- children = gtk_container_get_children (GTK_CONTAINER (content_area));
- for (l = children; l; l = l->next)
+ for (child = gtk_widget_get_first_child (content_area);
+ child != NULL;
+ child = gtk_widget_get_next_sibling (child))
{
- if (GTK_IS_LABEL (l->data))
+ if (GTK_IS_LABEL (child))
{
- gtk_container_remove (GTK_CONTAINER (content_area), l->data);
+ gtk_box_remove (GTK_BOX (content_area), child);
break;
}
}
/* no label removed, so add one */
- if (l == NULL)
+ if (child == NULL)
{
GtkWidget *label;
@@ -3414,11 +3401,8 @@ dialog_response_cb (GtkWidget *widget, gint response, gpointer unused)
gtk_widget_set_margin_end (label, 10);
gtk_widget_set_margin_top (label, 10);
gtk_widget_set_margin_bottom (label, 10);
- gtk_container_add (GTK_CONTAINER (content_area),
- label);
+ gtk_box_append (GTK_BOX (content_area), label);
}
-
- g_list_free (children);
}
}
@@ -3546,7 +3530,7 @@ create_display_screen (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), vbox);
frame = gtk_frame_new ("Select display");
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
@@ -3569,10 +3553,10 @@ create_display_screen (GtkWidget *widget)
applyb = gtk_button_new_with_mnemonic ("_Apply");
cancelb = gtk_button_new_with_mnemonic ("_Cancel");
- gtk_container_add (GTK_CONTAINER (vbox), bbox);
+ gtk_box_append (GTK_BOX (vbox), bbox);
- gtk_container_add (GTK_CONTAINER (bbox), applyb);
- gtk_container_add (GTK_CONTAINER (bbox), cancelb);
+ gtk_box_append (GTK_BOX (bbox), applyb);
+ gtk_box_append (GTK_BOX (bbox), cancelb);
scr_dpy_data = g_new0 (ScreenDisplaySelection, 1);
@@ -3628,7 +3612,7 @@ create_range_controls (GtkWidget *widget)
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
adjustment = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
@@ -3637,17 +3621,17 @@ create_range_controls (GtkWidget *widget)
gtk_widget_set_size_request (GTK_WIDGET (scale), 150, -1);
gtk_scale_set_digits (GTK_SCALE (scale), 1);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- gtk_container_add (GTK_CONTAINER (box2), scale);
+ gtk_box_append (GTK_BOX (box2), scale);
scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment));
- gtk_container_add (GTK_CONTAINER (box2), scrollbar);
+ gtk_box_append (GTK_BOX (box2), scrollbar);
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adjustment));
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_scale_set_format_value_func (GTK_SCALE (scale),
(GtkScaleFormatValueFunc) reformat_value,
NULL, NULL);
- gtk_container_add (GTK_CONTAINER (box2), scale);
+ gtk_box_append (GTK_BOX (box2), scale);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -3655,38 +3639,38 @@ create_range_controls (GtkWidget *widget)
gtk_widget_set_size_request (scale, -1, 200);
gtk_scale_set_digits (GTK_SCALE (scale), 2);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), scale);
+ gtk_box_append (GTK_BOX (hbox), scale);
scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment));
gtk_widget_set_size_request (scale, -1, 200);
gtk_scale_set_digits (GTK_SCALE (scale), 2);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), scale);
+ gtk_box_append (GTK_BOX (hbox), scale);
scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adjustment));
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_scale_set_format_value_func (GTK_SCALE (scale),
(GtkScaleFormatValueFunc) reformat_value,
NULL, NULL);
- gtk_container_add (GTK_CONTAINER (hbox), scale);
+ gtk_box_append (GTK_BOX (hbox), scale);
- gtk_container_add (GTK_CONTAINER (box2), hbox);
+ gtk_box_append (GTK_BOX (box2), hbox);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -3824,16 +3808,16 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
+ gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_check_button_new_with_label ("Fill Tab");
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (button, "toggled",
G_CALLBACK (tab_fill), child);
button = gtk_check_button_new_with_label ("Expand Tab");
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "toggled",
G_CALLBACK (tab_expand), child);
@@ -3846,26 +3830,26 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
pixwid = gtk_image_new_from_pixbuf (book_closed);
g_object_set_data (G_OBJECT (child), "tab_pixmap", pixwid);
- gtk_container_add (GTK_CONTAINER (label_box), pixwid);
+ gtk_box_append (GTK_BOX (label_box), pixwid);
gtk_widget_set_margin_start (pixwid, 3);
gtk_widget_set_margin_end (pixwid, 3);
gtk_widget_set_margin_bottom (pixwid, 1);
gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new_with_mnemonic (accel_buffer);
- gtk_container_add (GTK_CONTAINER (label_box), label);
+ gtk_box_append (GTK_BOX (label_box), label);
menu_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
pixwid = gtk_image_new_from_pixbuf (book_closed);
g_object_set_data (G_OBJECT (child), "menu_pixmap", pixwid);
- gtk_container_add (GTK_CONTAINER (menu_box), pixwid);
+ gtk_box_append (GTK_BOX (menu_box), pixwid);
gtk_widget_set_margin_start (pixwid, 3);
gtk_widget_set_margin_end (pixwid, 3);
gtk_widget_set_margin_bottom (pixwid, 1);
gtk_widget_set_margin_top (pixwid, 1);
label = gtk_label_new (buffer);
- gtk_container_add (GTK_CONTAINER (menu_box), label);
+ gtk_box_append (GTK_BOX (menu_box), label);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
}
@@ -3992,7 +3976,7 @@ create_notebook (GtkWidget *widget)
G_CALLBACK (page_switch), NULL);
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (sample_notebook), GTK_POS_TOP);
gtk_widget_set_vexpand (sample_notebook, TRUE);
- gtk_container_add (GTK_CONTAINER (box1), sample_notebook);
+ gtk_box_append (GTK_BOX (box1), sample_notebook);
gtk_widget_realize (sample_notebook);
@@ -4005,62 +3989,62 @@ create_notebook (GtkWidget *widget)
create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_check_button_new_with_label ("popup menu");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
g_signal_connect (button, "clicked",
G_CALLBACK (notebook_popup),
sample_notebook);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
label = gtk_label_new ("Notebook Style :");
- gtk_container_add (GTK_CONTAINER (box2), label);
+ gtk_box_append (GTK_BOX (box2), label);
omenu = build_option_menu (items, G_N_ELEMENTS (items), 0,
notebook_type_changed,
sample_notebook);
- gtk_container_add (GTK_CONTAINER (box2), omenu);
+ gtk_box_append (GTK_BOX (box2), omenu);
button = gtk_button_new_with_label ("Show all Pages");
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
g_signal_connect (button, "clicked",
G_CALLBACK (show_all_pages), sample_notebook);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_set_homogeneous (GTK_BOX (box2), TRUE);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("prev");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_notebook_prev_page),
sample_notebook);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_with_label ("next");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_notebook_next_page),
sample_notebook);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_with_label ("rotate");
g_signal_connect (button, "clicked",
G_CALLBACK (rotate_notebook), sample_notebook);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box1), button);
+ gtk_box_append (GTK_BOX (box1), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -4179,7 +4163,7 @@ create_panes (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), vbox);
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_add (GTK_CONTAINER (vbox), vpaned);
+ gtk_box_append (GTK_BOX (vbox), vpaned);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
@@ -4201,13 +4185,13 @@ create_panes (GtkWidget *widget)
/* Now create toggle buttons to control sizing */
- gtk_container_add (GTK_CONTAINER (vbox),
+ gtk_box_append (GTK_BOX (vbox),
create_pane_options (GTK_PANED (hpaned),
"Horizontal",
"Left",
"Right"));
- gtk_container_add (GTK_CONTAINER (vbox),
+ gtk_box_append (GTK_BOX (vbox),
create_pane_options (GTK_PANED (vpaned),
"Vertical",
"Top",
@@ -4265,13 +4249,13 @@ paned_keyboard_window1 (GtkWidget *widget)
gtk_frame_set_child (GTK_FRAME (frame1), vbox1);
button7 = gtk_button_new_with_label ("button7");
- gtk_container_add (GTK_CONTAINER (vbox1), button7);
+ gtk_box_append (GTK_BOX (vbox1), button7);
button8 = gtk_button_new_with_label ("button8");
- gtk_container_add (GTK_CONTAINER (vbox1), button8);
+ gtk_box_append (GTK_BOX (vbox1), button8);
button9 = gtk_button_new_with_label ("button9");
- gtk_container_add (GTK_CONTAINER (vbox1), button9);
+ gtk_box_append (GTK_BOX (vbox1), button9);
vpaned1 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_set_end_child (GTK_PANED (hpaned1), vpaned1);
@@ -4290,10 +4274,10 @@ paned_keyboard_window1 (GtkWidget *widget)
gtk_frame_set_child (GTK_FRAME (frame5), hbox1);
button5 = gtk_button_new_with_label ("button5");
- gtk_container_add (GTK_CONTAINER (hbox1), button5);
+ gtk_box_append (GTK_BOX (hbox1), button5);
button6 = gtk_button_new_with_label ("button6");
- gtk_container_add (GTK_CONTAINER (hbox1), button6);
+ gtk_box_append (GTK_BOX (hbox1), button6);
frame3 = gtk_frame_new (NULL);
gtk_paned_set_end_child (GTK_PANED (vpaned1), frame3);
@@ -4359,7 +4343,7 @@ paned_keyboard_window2 (GtkWidget *widget)
gtk_paned_set_shrink_end_child (GTK_PANED (hpaned2), TRUE);
vpaned2 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_add (GTK_CONTAINER (hbox2), vpaned2);
+ gtk_box_append (GTK_BOX (hbox2), vpaned2);
frame7 = gtk_frame_new (NULL);
gtk_paned_set_start_child (GTK_PANED (vpaned2), frame7);
@@ -4378,7 +4362,7 @@ paned_keyboard_window2 (GtkWidget *widget)
gtk_frame_set_child (GTK_FRAME (frame8), button11);
button10 = gtk_button_new_with_label ("button10");
- gtk_container_add (GTK_CONTAINER (hbox2), button10);
+ gtk_box_append (GTK_BOX (hbox2), button10);
return window2;
}
@@ -4413,10 +4397,10 @@ paned_keyboard_window3 (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window3), vbox2);
label1 = gtk_label_new ("Three panes nested inside each other");
- gtk_container_add (GTK_CONTAINER (vbox2), label1);
+ gtk_box_append (GTK_BOX (vbox2), label1);
hpaned3 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (vbox2), hpaned3);
+ gtk_box_append (GTK_BOX (vbox2), hpaned3);
frame9 = gtk_frame_new (NULL);
gtk_paned_set_start_child (GTK_PANED (hpaned3), frame9);
@@ -4495,11 +4479,11 @@ paned_keyboard_window4 (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window4), vbox3);
label2 = gtk_label_new ("Widget tree:\n\nhpaned \n - vpaned\n - hbox\n - vpaned\n - vpaned\n - vpaned\n");
- gtk_container_add (GTK_CONTAINER (vbox3), label2);
+ gtk_box_append (GTK_BOX (vbox3), label2);
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
hpaned6 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (vbox3), hpaned6);
+ gtk_box_append (GTK_BOX (vbox3), hpaned6);
vpaned3 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_set_start_child (GTK_PANED (hpaned6), vpaned3);
@@ -4522,7 +4506,7 @@ paned_keyboard_window4 (GtkWidget *widget)
gtk_paned_set_shrink_end_child (GTK_PANED (hpaned6), TRUE);
vpaned4 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_add (GTK_CONTAINER (hbox3), vpaned4);
+ gtk_box_append (GTK_BOX (hbox3), vpaned4);
button21 = gtk_button_new_with_label ("button21");
gtk_paned_set_start_child (GTK_PANED (vpaned4), button21);
@@ -4535,7 +4519,7 @@ paned_keyboard_window4 (GtkWidget *widget)
gtk_paned_set_shrink_end_child (GTK_PANED (vpaned4), TRUE);
vpaned5 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_add (GTK_CONTAINER (hbox3), vpaned5);
+ gtk_box_append (GTK_BOX (hbox3), vpaned5);
button23 = gtk_button_new_with_label ("button23");
gtk_paned_set_start_child (GTK_PANED (vpaned5), button23);
@@ -4548,7 +4532,7 @@ paned_keyboard_window4 (GtkWidget *widget)
gtk_paned_set_shrink_end_child (GTK_PANED (vpaned5), TRUE);
vpaned6 = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_add (GTK_CONTAINER (hbox3), vpaned6);
+ gtk_box_append (GTK_BOX (hbox3), vpaned6);
button25 = gtk_button_new_with_label ("button25");
gtk_paned_set_start_child (GTK_PANED (vpaned6), button25);
@@ -4668,15 +4652,15 @@ create_wmhints (GtkWidget *widget)
label = gtk_label_new ("Try iconizing me!");
gtk_widget_set_size_request (label, 150, 50);
- gtk_container_add (GTK_CONTAINER (box1), label);
+ gtk_box_append (GTK_BOX (box1), label);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_add (GTK_CONTAINER (box1), box2);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_label ("close");
@@ -4685,7 +4669,7 @@ create_wmhints (GtkWidget *widget)
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
@@ -4747,7 +4731,7 @@ tracking_label (GtkWidget *window)
label = gtk_label_new ("<no window state events received>");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
g_object_set_data (G_OBJECT (label), "title", (gpointer)gtk_window_get_title (GTK_WINDOW (window)));
g_signal_connect_object (gtk_native_get_surface (GTK_NATIVE (window)), "notify::state",
@@ -4761,7 +4745,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_window_unminimize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Minimize");
g_signal_connect_object (button,
@@ -4769,7 +4753,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_window_minimize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Fullscreen");
g_signal_connect_object (button,
@@ -4777,7 +4761,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_window_fullscreen),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Unfullscreen");
g_signal_connect_object (button,
@@ -4785,7 +4769,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_window_unfullscreen),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Present");
g_signal_connect_object (button,
@@ -4793,7 +4777,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_window_present),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Show");
g_signal_connect_object (button,
@@ -4801,7 +4785,7 @@ tracking_label (GtkWidget *window)
G_CALLBACK (gtk_widget_show),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_append (GTK_BOX (hbox), button);
return hbox;
}
@@ -4820,7 +4804,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_window_maximize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Unmaximize");
g_signal_connect_object (button,
@@ -4828,7 +4812,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_window_unmaximize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Minimize");
g_signal_connect_object (button,
@@ -4836,7 +4820,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_window_minimize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Fullscreen");
g_signal_connect_object (button,
@@ -4844,7 +4828,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_window_fullscreen),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Unfullscreen");
g_signal_connect_object (button,
@@ -4852,7 +4836,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_window_unfullscreen),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Hide (withdraw)");
g_signal_connect_object (button,
@@ -4860,7 +4844,7 @@ get_state_controls (GtkWidget *window)
G_CALLBACK (gtk_widget_hide),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
return vbox;
}
@@ -4919,10 +4903,10 @@ create_surface_states (GtkWidget *widget)
gtk_widget_realize (normal);
label = tracking_label (iconified);
- gtk_container_add (GTK_CONTAINER (box1), label);
+ gtk_box_append (GTK_BOX (box1), label);
label = tracking_label (normal);
- gtk_container_add (GTK_CONTAINER (box1), label);
+ gtk_box_append (GTK_BOX (box1), label);
gtk_widget_show (iconified);
gtk_widget_show (normal);
@@ -5045,19 +5029,19 @@ window_controls (GtkWidget *window)
gtk_window_set_child (GTK_WINDOW (control_window), vbox);
label = gtk_label_new ("<no size>");
- gtk_container_add (GTK_CONTAINER (vbox), label);
+ gtk_box_append (GTK_BOX (vbox), label);
adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0);
spin = gtk_spin_button_new (adjustment, 0, 0);
- gtk_container_add (GTK_CONTAINER (vbox), spin);
+ gtk_box_append (GTK_BOX (vbox), spin);
g_object_set_data (G_OBJECT (control_window), "spin1", spin);
adjustment = gtk_adjustment_new (10.0, -2000.0, 2000.0, 1.0, 5.0, 0.0);
spin = gtk_spin_button_new (adjustment, 0, 0);
- gtk_container_add (GTK_CONTAINER (vbox), spin);
+ gtk_box_append (GTK_BOX (vbox), spin);
g_object_set_data (G_OBJECT (control_window), "spin2", spin);
@@ -5067,42 +5051,42 @@ window_controls (GtkWidget *window)
G_CALLBACK (gtk_widget_queue_resize),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Resize");
g_signal_connect (button,
"clicked",
G_CALLBACK (set_size_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Set default size");
g_signal_connect (button,
"clicked",
G_CALLBACK (set_default_size_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Unset default size");
g_signal_connect (button,
"clicked",
G_CALLBACK (unset_default_size_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Set size request");
g_signal_connect (button,
"clicked",
G_CALLBACK (set_size_request_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label ("Unset size request");
g_signal_connect (button,
"clicked",
G_CALLBACK (unset_size_request_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_check_button_new_with_label ("Allow resize");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -5110,7 +5094,7 @@ window_controls (GtkWidget *window)
"toggled",
G_CALLBACK (resizable_callback),
control_window);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_mnemonic ("_Show");
g_signal_connect_object (button,
@@ -5118,7 +5102,7 @@ window_controls (GtkWidget *window)
G_CALLBACK (gtk_widget_show),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_mnemonic ("_Hide");
g_signal_connect_object (button,
@@ -5126,7 +5110,7 @@ window_controls (GtkWidget *window)
G_CALLBACK (gtk_widget_hide),
window,
G_CONNECT_SWAPPED);
- gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_box_append (GTK_BOX (vbox), button);
return control_window;
}
@@ -5357,10 +5341,10 @@ create_progress_bar (GtkWidget *widget)
gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add (GTK_CONTAINER (content_area), vbox);
+ gtk_box_append (GTK_BOX (content_area), vbox);
frame = gtk_frame_new ("Progress");
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_frame_set_child (GTK_FRAME (frame), vbox2);
@@ -5370,19 +5354,19 @@ create_progress_bar (GtkWidget *widget)
PANGO_ELLIPSIZE_MIDDLE);
gtk_widget_set_halign (pdata->pbar, GTK_ALIGN_CENTER);
gtk_widget_set_valign (pdata->pbar, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), pdata->pbar);
+ gtk_box_append (GTK_BOX (vbox2), pdata->pbar);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (vbox2), hbox);
+ gtk_box_append (GTK_BOX (vbox2), hbox);
label = gtk_label_new ("Label updated by user :");
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
pdata->label = gtk_label_new ("");
- gtk_container_add (GTK_CONTAINER (hbox), pdata->label);
+ gtk_box_append (GTK_BOX (hbox), pdata->label);
frame = gtk_frame_new ("Options");
- gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_box_append (GTK_BOX (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_frame_set_child (GTK_FRAME (frame), vbox2);
@@ -5390,7 +5374,7 @@ create_progress_bar (GtkWidget *widget)
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
- gtk_container_add (GTK_CONTAINER (vbox2), grid);
+ gtk_box_append (GTK_BOX (vbox2), grid);
label = gtk_label_new ("Orientation :");
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
@@ -5419,14 +5403,14 @@ create_progress_bar (GtkWidget *widget)
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 2, 1, 1);
label = gtk_label_new ("Text: ");
- gtk_container_add (GTK_CONTAINER (hbox), label);
+ gtk_box_append (GTK_BOX (hbox), label);
pdata->entry = gtk_entry_new ();
gtk_widget_set_hexpand (pdata->entry, TRUE);
g_signal_connect (pdata->entry, "changed",
G_CALLBACK (entry_changed),
pdata);
- gtk_container_add (GTK_CONTAINER (hbox), pdata->entry);
+ gtk_box_append (GTK_BOX (hbox), pdata->entry);
gtk_widget_set_size_request (pdata->entry, 100, -1);
label = gtk_label_new ("Ellipsize text :");
@@ -5535,26 +5519,26 @@ create_timeout_test (GtkWidget *widget)
gtk_widget_set_margin_end (label, 10);
gtk_widget_set_margin_top (label, 10);
gtk_widget_set_margin_bottom (label, 10);
- gtk_container_add (GTK_CONTAINER (content_area), label);
+ gtk_box_append (GTK_BOX (content_area), label);
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy),
window);
- gtk_container_add (GTK_CONTAINER (action_area), button);
+ gtk_box_append (GTK_BOX (action_area), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
button = gtk_button_new_with_label ("start");
g_signal_connect (button, "clicked",
G_CALLBACK(start_timeout_test),
label);
- gtk_container_add (GTK_CONTAINER (action_area), button);
+ gtk_box_append (GTK_BOX (action_area), button);
button = gtk_button_new_with_label ("stop");
g_signal_connect (button, "clicked",
G_CALLBACK (stop_timeout_test),
NULL);
- gtk_container_add (GTK_CONTAINER (action_area), button);
+ gtk_box_append (GTK_BOX (action_area), button);
}
if (!gtk_widget_get_visible (window))
@@ -5841,7 +5825,7 @@ create_native_dialogs (GtkWidget *widget)
gtk_window_set_child (GTK_WINDOW (window), box);
label = gtk_label_new ("");
- gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_box_append (GTK_BOX (box), label);
combo = gtk_combo_box_text_new ();
@@ -5854,7 +5838,7 @@ create_native_dialogs (GtkWidget *widget)
g_signal_connect (combo, "changed",
G_CALLBACK (native_action_changed), native);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GTK_FILE_CHOOSER_ACTION_OPEN);
- gtk_container_add (GTK_CONTAINER (box), combo);
+ gtk_box_append (GTK_BOX (box), combo);
combo = gtk_combo_box_text_new ();
@@ -5865,24 +5849,24 @@ create_native_dialogs (GtkWidget *widget)
g_signal_connect (combo, "changed",
G_CALLBACK (native_filter_changed), native);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
- gtk_container_add (GTK_CONTAINER (box), combo);
+ gtk_box_append (GTK_BOX (box), combo);
check_button = gtk_check_button_new_with_label ("Modal");
g_signal_connect (check_button, "toggled",
G_CALLBACK (native_modal_toggle), native);
- gtk_container_add (GTK_CONTAINER (box), check_button);
+ gtk_box_append (GTK_BOX (box), check_button);
check_button = gtk_check_button_new_with_label ("Multiple select");
g_signal_connect (check_button, "toggled",
G_CALLBACK (native_multi_select_toggle), native);
- gtk_container_add (GTK_CONTAINER (box), check_button);
+ gtk_box_append (GTK_BOX (box), check_button);
show_button = gtk_button_new_with_label ("Show");
hide_button = gtk_button_new_with_label ("Hide");
gtk_widget_set_sensitive (hide_button, FALSE);
- gtk_container_add (GTK_CONTAINER (box), show_button);
- gtk_container_add (GTK_CONTAINER (box), hide_button);
+ gtk_box_append (GTK_BOX (box), show_button);
+ gtk_box_append (GTK_BOX (box), hide_button);
/* connect signals */
g_signal_connect (native, "response",
@@ -6009,7 +5993,7 @@ create_main_window (void)
gtk_get_minor_version ());
label = gtk_label_new (buffer);
- gtk_container_add (GTK_CONTAINER (box1), label);
+ gtk_box_append (GTK_BOX (box1), label);
gtk_widget_set_name (label, "testgtk-version-label");
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -6021,7 +6005,7 @@ create_main_window (void)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (box1), scrolled_window);
+ gtk_box_append (GTK_BOX (box1), scrolled_window);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_top (box2, 10);
@@ -6041,11 +6025,14 @@ create_main_window (void)
NULL);
else
gtk_widget_set_sensitive (button, FALSE);
- gtk_container_add (GTK_CONTAINER (box2), button);
+ gtk_box_append (GTK_BOX (box2), button);
}
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box1), separator);
+ gtk_box_append (GTK_BOX (box1), separator);
+
+ box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+ gtk_box_append (GTK_BOX (box1), box2);
button = gtk_button_new_with_mnemonic ("_Close");
gtk_widget_set_margin_top (button, 10);
@@ -6055,7 +6042,7 @@ create_main_window (void)
g_signal_connect (button, "clicked",
G_CALLBACK (do_exit),
window);
- gtk_container_add (GTK_CONTAINER (box1), button);
+ gtk_box_append (GTK_BOX (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
gtk_widget_show (window);