Replace most remaining uses of container api

These are all on GtkBox or enumerating children.
This commit is contained in:
Matthias Clasen 2020-05-09 08:26:52 -04:00
parent 665edcba53
commit 2a24b8c653
211 changed files with 2388 additions and 2041 deletions

View File

@ -608,7 +608,7 @@ create_widget_func (gpointer item,
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_hexpand (label, TRUE);
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item))
{
@ -616,18 +616,18 @@ create_widget_func (gpointer item,
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win);
g_object_set_data (G_OBJECT (row), "edit", button);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
}
else if (GTK_IS_WIDGET (item))
{
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
}
g_free (freeme);

View File

@ -95,12 +95,12 @@ create_page1 (GtkWidget *assistant)
gtk_widget_set_margin_bottom (box, 12);
label = gtk_label_new ("You must fill out this entry to continue:");
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_box_append (GTK_BOX (box), entry);
g_signal_connect (G_OBJECT (entry), "changed",
G_CALLBACK (on_entry_changed), assistant);
@ -123,7 +123,7 @@ create_page2 (GtkWidget *assistant)
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
"even if you do not check this");
gtk_widget_set_valign (checkbutton, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), checkbutton);
gtk_box_append (GTK_BOX (box), checkbutton);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);

View File

@ -120,66 +120,66 @@ do_clipboard (GtkWidget *do_widget)
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the first entry */
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (hbox), entry);
gtk_box_append (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Copy"));
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (copy_button_clicked), entry);
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the second entry */
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (hbox), entry);
gtk_box_append (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Paste"));
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (paste_button_clicked), entry);
label = gtk_label_new ("Images can be transferred via the clipboard, too");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the first image */
image = demo_image_new ("dialog-warning");
gtk_container_add (GTK_CONTAINER (hbox), image);
gtk_box_append (GTK_BOX (hbox), image);
/* Create the second image */
image = demo_image_new ("process-stop");
gtk_container_add (GTK_CONTAINER (hbox), image);
gtk_box_append (GTK_BOX (hbox), image);
/* Create the third image */
image = demo_image_new ("weather-clear");
gtk_container_add (GTK_CONTAINER (hbox), image);
gtk_box_append (GTK_BOX (hbox), image);
}
if (!gtk_widget_get_visible (window))

View File

@ -328,7 +328,7 @@ do_combobox (GtkWidget *do_widget)
* insensitive rows
*/
frame = gtk_frame_new ("Items with icons");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (box, 5);
@ -340,7 +340,7 @@ do_combobox (GtkWidget *do_widget)
model = create_icon_store ();
combo = gtk_combo_box_new_with_model (model);
g_object_unref (model);
gtk_container_add (GTK_CONTAINER (box), combo);
gtk_box_append (GTK_BOX (box), combo);
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
@ -372,7 +372,7 @@ do_combobox (GtkWidget *do_widget)
/* A combobox demonstrating trees.
*/
frame = gtk_frame_new ("Where are we ?");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (box, 5);
@ -384,7 +384,7 @@ do_combobox (GtkWidget *do_widget)
model = create_capital_store ();
combo = gtk_combo_box_new_with_model (model);
g_object_unref (model);
gtk_container_add (GTK_CONTAINER (box), combo);
gtk_box_append (GTK_BOX (box), combo);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
@ -403,7 +403,7 @@ do_combobox (GtkWidget *do_widget)
/* A GtkComboBoxEntry with validation */
frame = gtk_frame_new ("Editable");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (box, 5);
@ -414,7 +414,7 @@ do_combobox (GtkWidget *do_widget)
combo = gtk_combo_box_text_new_with_entry ();
fill_combo_entry (combo);
gtk_container_add (GTK_CONTAINER (box), combo);
gtk_box_append (GTK_BOX (box), combo);
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
@ -423,7 +423,7 @@ do_combobox (GtkWidget *do_widget)
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (box, 5);
@ -436,13 +436,13 @@ do_combobox (GtkWidget *do_widget)
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible");
gtk_container_add (GTK_CONTAINER (box), combo);
gtk_box_append (GTK_BOX (box), combo);
entry = gtk_entry_new ();
g_object_bind_property (combo, "active-id",
entry, "text",
G_BINDING_BIDIRECTIONAL);
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_box_append (GTK_BOX (box), entry);
}
if (!gtk_widget_get_visible (window))

View File

@ -271,10 +271,10 @@ do_constraints (GtkWidget *do_widget)
grid = g_object_new (simple_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_container_add (GTK_CONTAINER (box), grid);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);

View File

@ -227,10 +227,10 @@ do_constraints2 (GtkWidget *do_widget)
grid = g_object_new (interactive_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_container_add (GTK_CONTAINER (box), grid);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);

View File

@ -147,10 +147,10 @@ do_constraints3 (GtkWidget *do_widget)
grid = g_object_new (vfl_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);
gtk_widget_set_vexpand (grid, TRUE);
gtk_container_add (GTK_CONTAINER (box), grid);
gtk_box_append (GTK_BOX (box), grid);
button = gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_set_hexpand (grid, TRUE);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_destroy), window);

View File

@ -9,9 +9,13 @@
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
GtkWidget *
@ -36,22 +40,22 @@ do_css_accordion (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_button_new_with_label ("This");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new_with_label ("Is");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new_with_label ("A");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new_with_label ("CSS");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new_with_label ("Accordion");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new_with_label (":-)");
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");

View File

@ -55,9 +55,13 @@ css_text_changed (GtkTextBuffer *buffer,
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
GtkWidget *
@ -93,7 +97,7 @@ do_css_basics (GtkWidget *do_widget)
container = gtk_scrolled_window_new (NULL, NULL);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
g_signal_connect (text, "changed",
G_CALLBACK (css_text_changed), provider);

View File

@ -69,9 +69,13 @@ drawing_area_draw (GtkDrawingArea *da,
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
GtkWidget *
@ -100,7 +104,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (child),
drawing_area_draw,
NULL, NULL);
gtk_container_add (GTK_CONTAINER (container), child);
gtk_box_append (GTK_BOX (container), child);
child = gtk_button_new ();
gtk_overlay_add_overlay (GTK_OVERLAY (container), child);

View File

@ -55,9 +55,13 @@ css_text_changed (GtkTextBuffer *buffer,
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
GtkWidget *

View File

@ -53,9 +53,13 @@ css_text_changed (GtkTextBuffer *buffer,
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
static GtkWidget *
@ -68,13 +72,13 @@ create_toolbar (void)
gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER);
item = gtk_button_new_from_icon_name ("go-next");
gtk_container_add (GTK_CONTAINER (toolbar), item);
gtk_box_append (GTK_BOX (toolbar), item);
item = gtk_button_new_from_icon_name ("go-previous");
gtk_container_add (GTK_CONTAINER (toolbar), item);
gtk_box_append (GTK_BOX (toolbar), item);
item = gtk_button_new_with_label ("Hello World");
gtk_container_add (GTK_CONTAINER (toolbar), item);
gtk_box_append (GTK_BOX (toolbar), item);
return toolbar;
}

View File

@ -49,7 +49,7 @@ demo_tagged_entry_init (DemoTaggedEntry *entry)
gtk_widget_set_vexpand (priv->entry, TRUE);
gtk_widget_set_hexpand (priv->box, FALSE);
gtk_widget_set_vexpand (priv->box, FALSE);
gtk_container_add (GTK_CONTAINER (priv->box), priv->entry);
gtk_box_append (GTK_BOX (priv->box), priv->entry);
gtk_editable_init_delegate (GTK_EDITABLE (entry));
}
@ -188,7 +188,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_container_add (GTK_CONTAINER (priv->box), tag);
gtk_box_append (GTK_BOX (priv->box), tag);
}
void
@ -201,7 +201,7 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
if (sibling == NULL)
gtk_container_add (GTK_CONTAINER (priv->box), tag);
gtk_box_append (GTK_BOX (priv->box), tag);
else
gtk_box_insert_child_after (GTK_BOX (priv->box), tag, sibling);
}
@ -214,7 +214,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_container_remove (GTK_CONTAINER (priv->box), tag);
gtk_box_remove (GTK_BOX (priv->box), tag);
}
struct _DemoTaggedEntryTag
@ -268,7 +268,7 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
tag->label = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (tag->box), tag->label);
gtk_box_append (GTK_BOX (tag->box), tag->label);
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
@ -460,7 +460,7 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
if (!has_close_button && tag->button)
{
gtk_container_remove (GTK_CONTAINER (tag->box), tag->button);
gtk_box_remove (GTK_BOX (tag->box), tag->button);
tag->button = NULL;
}
else if (has_close_button && tag->button == NULL)
@ -469,11 +469,11 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
image = gtk_image_new_from_icon_name ("window-close-symbolic");
tag->button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (tag->button), image);
gtk_box_append (GTK_BOX (tag->button), image);
gtk_widget_set_halign (tag->button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (tag->button, GTK_ALIGN_CENTER);
gtk_button_set_has_frame (GTK_BUTTON (tag->button), FALSE);
gtk_container_add (GTK_CONTAINER (tag->box), tag->button);
gtk_box_append (GTK_BOX (tag->box), tag->button);
g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag);
}

View File

@ -56,16 +56,16 @@ interactive_dialog_clicked (GtkButton *button,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_container_add (GTK_CONTAINER (content_area), hbox);
gtk_box_append (GTK_BOX (content_area), hbox);
image = gtk_image_new_from_icon_name ("dialog-question");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (hbox), image);
gtk_box_append (GTK_BOX (hbox), image);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_grid_set_column_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (hbox), table);
gtk_box_append (GTK_BOX (hbox), table);
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
local_entry1 = gtk_entry_new ();
@ -127,29 +127,29 @@ do_dialog (GtkWidget *do_widget)
/* Standard message dialog */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_button_new_with_mnemonic ("_Message Dialog");
g_signal_connect (button, "clicked",
G_CALLBACK (message_dialog_clicked), NULL);
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_append (GTK_BOX (hbox), button);
gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
gtk_box_append (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
/* Interactive dialog*/
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
button = gtk_button_new_with_mnemonic ("_Interactive Dialog");
g_signal_connect (button, "clicked",
G_CALLBACK (interactive_dialog_clicked), NULL);
gtk_container_add (GTK_CONTAINER (hbox), vbox2);
gtk_container_add (GTK_CONTAINER (vbox2), button);
gtk_box_append (GTK_BOX (hbox), vbox2);
gtk_box_append (GTK_BOX (vbox2), button);
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 4);
gtk_grid_set_column_spacing (GTK_GRID (table), 4);
gtk_container_add (GTK_CONTAINER (hbox), table);
gtk_box_append (GTK_BOX (hbox), table);
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);

View File

@ -204,30 +204,30 @@ pressed_cb (GtkGesture *gesture,
gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE);
gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1});
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (menu), box);
gtk_box_append (GTK_BOX (menu), box);
item = gtk_button_new_with_label ("New");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
g_signal_connect (item, "clicked", G_CALLBACK (new_item_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
gtk_box_append (GTK_BOX (box), item);
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
gtk_box_append (GTK_BOX (box), item);
item = gtk_button_new_with_label ("Edit");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
gtk_box_append (GTK_BOX (box), item);
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
gtk_box_append (GTK_BOX (box), item);
item = gtk_button_new_with_label ("Delete");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
gtk_box_append (GTK_BOX (box), item);
gtk_popover_popup (GTK_POPOVER (menu));
}
@ -444,10 +444,10 @@ do_dnd (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), box);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), box2);
gtk_box_append (GTK_BOX (box), box2);
canvas = canvas_new ();
gtk_container_add (GTK_CONTAINER (box2), canvas);
gtk_box_append (GTK_BOX (box2), canvas);
n_items = 0;
@ -468,7 +468,7 @@ do_dnd (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER);
gtk_container_add (GTK_CONTAINER (box), sw);
gtk_box_append (GTK_BOX (box), sw);
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box3, "linked");
@ -485,7 +485,7 @@ do_dnd (GtkWidget *do_widget)
"rgba", &rgba,
"selectable", FALSE,
NULL);
gtk_container_add (GTK_CONTAINER (box3), swatch);
gtk_box_append (GTK_BOX (box3), swatch);
}
}

View File

@ -213,11 +213,11 @@ do_drawingarea (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Checkerboard pattern</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_vexpand (frame, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
@ -232,11 +232,11 @@ do_drawingarea (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Scribble area</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_vexpand (frame, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);

View File

@ -361,7 +361,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (vbox, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Shopping list (you can edit the cells!)"));
sw = gtk_scrolled_window_new (NULL, NULL);
@ -369,7 +369,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (vbox), sw);
gtk_box_append (GTK_BOX (vbox), sw);
/* create models */
items_model = create_items_model ();
@ -391,17 +391,17 @@ do_editable_cells (GtkWidget *do_widget)
/* some buttons */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
button = gtk_button_new_with_label ("Add item");
g_signal_connect (button, "clicked",
G_CALLBACK (add_item), treeview);
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_append (GTK_BOX (hbox), button);
button = gtk_button_new_with_label ("Remove item");
g_signal_connect (button, "clicked",
G_CALLBACK (remove_item), treeview);
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_append (GTK_BOX (hbox), button);
gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
}

View File

@ -61,11 +61,11 @@ do_entry_completion (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
/* Create our entry */
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_box_append (GTK_BOX (vbox), entry);
/* Create the completion object */
completion = gtk_entry_completion_new ();

View File

@ -37,12 +37,12 @@ do_entry_undo (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"Use Primary+z or Primary+Shift+z to undo or redo changes");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
/* Create our entry */
entry = gtk_entry_new ();
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_box_append (GTK_BOX (vbox), entry);
}
if (!gtk_widget_get_visible (window))

View File

@ -79,8 +79,8 @@ do_expander (GtkWidget *do_widget)
"innuendo, just to make you scroll down or "
"resize the window. Do it already !", -1);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_container_add (GTK_CONTAINER (area), expander);
gtk_box_append (GTK_BOX (expander), sw);
gtk_box_append (GTK_BOX (area), expander);
g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), window);

View File

@ -194,7 +194,7 @@ add_check_group (GtkWidget *box,
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
gtk_container_add (GTK_CONTAINER (group), label);
gtk_box_append (GTK_BOX (group), label);
for (i = 0; tags[i]; i++)
{
@ -211,7 +211,7 @@ add_check_group (GtkWidget *box,
g_signal_connect (feat, "notify::inconsistent", G_CALLBACK (update_display), NULL);
g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL);
gtk_container_add (GTK_CONTAINER (group), feat);
gtk_box_append (GTK_BOX (group), feat);
item = g_new (FeatureItem, 1);
item->name = tags[i];
@ -223,7 +223,7 @@ add_check_group (GtkWidget *box,
feature_items = g_list_prepend (feature_items, item);
}
gtk_container_add (GTK_CONTAINER (box), group);
gtk_box_append (GTK_BOX (box), group);
}
static void
@ -248,7 +248,7 @@ add_radio_group (GtkWidget *box,
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
gtk_container_add (GTK_CONTAINER (group), label);
gtk_box_append (GTK_BOX (group), label);
for (i = 0; tags[i]; i++)
{
@ -268,7 +268,7 @@ add_radio_group (GtkWidget *box,
g_signal_connect (feat, "notify::active", G_CALLBACK (update_display), NULL);
g_object_set_data (G_OBJECT (feat), "default", group_button);
gtk_container_add (GTK_CONTAINER (group), feat);
gtk_box_append (GTK_BOX (group), feat);
item = g_new (FeatureItem, 1);
item->name = tags[i];
@ -280,7 +280,7 @@ add_radio_group (GtkWidget *box,
feature_items = g_list_prepend (feature_items, item);
}
gtk_container_add (GTK_CONTAINER (box), group);
gtk_box_append (GTK_BOX (box), group);
}
static void

View File

@ -53,7 +53,7 @@ create_axis_slider (GtkGears *gears,
}
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
@ -63,7 +63,7 @@ create_axis_slider (GtkGears *gears,
gears);
slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
@ -111,19 +111,19 @@ do_gears (GtkWidget *do_widget)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gtk_box_append (GTK_BOX (box), hbox);
gears = gtk_gears_new ();
gtk_widget_set_hexpand (gears, TRUE);
gtk_widget_set_vexpand (gears, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), gears);
gtk_box_append (GTK_BOX (hbox), gears);
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
gtk_box_append (GTK_BOX (hbox), create_axis_slider (GTK_GEARS (gears), i));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gtk_box_append (GTK_BOX (box), hbox);
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
}

View File

@ -354,7 +354,7 @@ create_axis_slider (int axis)
}
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
@ -362,7 +362,7 @@ create_axis_slider (int axis)
G_CALLBACK (on_axis_value_change),
GINT_TO_POINTER (axis));
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_hexpand (slider, TRUE);
gtk_widget_show (slider);
@ -406,7 +406,7 @@ create_glarea_window (GtkWidget *do_widget)
gl_area = gtk_gl_area_new ();
gtk_widget_set_hexpand (gl_area, TRUE);
gtk_widget_set_vexpand (gl_area, TRUE);
gtk_container_add (GTK_CONTAINER (box), gl_area);
gtk_box_append (GTK_BOX (box), gl_area);
/* We need to initialize and free GL resources, so we use
* the realize and unrealize signals on the widget
@ -418,15 +418,15 @@ create_glarea_window (GtkWidget *do_widget)
g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
controls = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_container_add (GTK_CONTAINER (box), controls);
gtk_box_append (GTK_BOX (box), controls);
gtk_widget_set_hexpand (controls, TRUE);
for (i = 0; i < N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (controls), create_axis_slider (i));
gtk_box_append (GTK_BOX (controls), create_axis_slider (i));
button = gtk_button_new_with_label ("Quit");
gtk_widget_set_hexpand (button, TRUE);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
return window;

View File

@ -43,10 +43,10 @@ do_headerbar (GtkWidget *do_widget)
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new ();
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);

View File

@ -266,14 +266,14 @@ do_iconview (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), vbox);
tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
gtk_box_append (GTK_BOX (vbox), tool_bar);
up_button = gtk_button_new_with_mnemonic ("_Up");
gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
gtk_container_add (GTK_CONTAINER (tool_bar), up_button);
gtk_box_append (GTK_BOX (tool_bar), up_button);
home_button = gtk_button_new_with_mnemonic ("_Home");
gtk_container_add (GTK_CONTAINER (tool_bar), home_button);
gtk_box_append (GTK_BOX (tool_bar), home_button);
sw = gtk_scrolled_window_new (NULL, NULL);
@ -283,7 +283,7 @@ do_iconview (GtkWidget *do_widget)
GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (sw, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), sw);
gtk_box_append (GTK_BOX (vbox), sw);
/* Create the store and fill it with the contents of '/' */
parent = g_strdup ("/");

View File

@ -293,24 +293,16 @@ static void
toggle_sensitivity_callback (GtkWidget *togglebutton,
gpointer user_data)
{
GtkContainer *container = user_data;
GList *list;
GList *tmp;
GtkWidget *child;
list = gtk_container_get_children (container);
tmp = list;
while (tmp != NULL)
for (child = gtk_widget_get_first_child (GTK_WIDGET (user_data));
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
/* don't disable our toggle */
if (GTK_WIDGET (tmp->data) != togglebutton)
gtk_widget_set_sensitive (GTK_WIDGET (tmp->data),
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)));
tmp = tmp->next;
if (child != togglebutton)
gtk_widget_set_sensitive (child, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)));
}
g_list_free (list);
}
@ -348,20 +340,20 @@ do_images (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), base_vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
gtk_container_add (GTK_CONTAINER (base_vbox), hbox);
gtk_box_append (GTK_BOX (base_vbox), hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_append (GTK_BOX (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Image loaded from a file</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
image = gtk_image_new_from_icon_name ("gtk3-demo");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
@ -374,12 +366,12 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Animation loaded from a file</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
@ -390,12 +382,12 @@ do_images (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Symbolic themed icon</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon);
@ -406,17 +398,17 @@ do_images (GtkWidget *do_widget)
/* Progressive */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_append (GTK_BOX (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Progressive image loading</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
/* Create an empty image for now; the progressive loader
* will create the pixbuf and fill it in.
@ -428,17 +420,17 @@ do_images (GtkWidget *do_widget)
/* Video */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_append (GTK_BOX (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Displaying video</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
video = gtk_video_new_for_resource ("/images/gtk-logo.webm");
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
@ -446,22 +438,22 @@ do_images (GtkWidget *do_widget)
/* Widget paintables */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_append (GTK_BOX (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>GtkWidgetPaintable</u>");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
paintable = gtk_widget_paintable_new (do_widget);
picture = gtk_picture_new_for_paintable (paintable);
gtk_widget_set_size_request (picture, 100, 100);
gtk_widget_set_valign (picture, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (vbox), picture);
gtk_box_append (GTK_BOX (vbox), picture);
/* Sensitivity control */
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
gtk_container_add (GTK_CONTAINER (base_vbox), button);
gtk_box_append (GTK_BOX (base_vbox), button);
g_signal_connect (button, "toggled",
G_CALLBACK (toggle_sensitivity_callback),

View File

@ -66,73 +66,73 @@ do_infobar (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), vbox);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_box_append (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (bar), label);
gtk_box_append (GTK_BOX (bar), label);
button = gtk_toggle_button_new_with_label ("Message");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
gtk_box_append (GTK_BOX (actions), button);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_box_append (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (bar), label);
gtk_box_append (GTK_BOX (bar), label);
button = gtk_toggle_button_new_with_label ("Warning");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
gtk_box_append (GTK_BOX (actions), button);
bar = gtk_info_bar_new_with_buttons (_("_OK"), GTK_RESPONSE_OK, NULL);
gtk_info_bar_set_show_close_button (GTK_INFO_BAR (bar), TRUE);
g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window);
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_box_append (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (bar), label);
gtk_box_append (GTK_BOX (bar), label);
gtk_info_bar_set_default_response (GTK_INFO_BAR (bar), GTK_RESPONSE_OK);
button = gtk_toggle_button_new_with_label ("Question");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
gtk_box_append (GTK_BOX (actions), button);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_box_append (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (bar), label);
gtk_box_append (GTK_BOX (bar), label);
button = gtk_toggle_button_new_with_label ("Error");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
gtk_box_append (GTK_BOX (actions), button);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_box_append (GTK_BOX (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (bar), label);
gtk_box_append (GTK_BOX (bar), label);
button = gtk_toggle_button_new_with_label ("Other");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
gtk_box_append (GTK_BOX (actions), button);
frame = gtk_frame_new ("An example of different info bars");
gtk_widget_set_margin_top (frame, 8);
gtk_widget_set_margin_bottom (frame, 8);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
gtk_widget_set_halign (actions, GTK_ALIGN_CENTER);

View File

@ -267,14 +267,14 @@ do_list_store (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (vbox), sw);
gtk_box_append (GTK_BOX (vbox), sw);
/* create tree model */
model = create_model ();

View File

@ -357,11 +357,11 @@ do_listbox (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("Messages from GTK and friends");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), scrolled);
gtk_box_append (GTK_BOX (vbox), scrolled);
listbox = gtk_list_box_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox);

View File

@ -66,7 +66,7 @@ do_overlay (GtkWidget *do_widget)
gtk_widget_set_can_target (label, FALSE);
gtk_widget_set_margin_top (label, 8);
gtk_widget_set_margin_bottom (label, 8);
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
@ -76,7 +76,7 @@ do_overlay (GtkWidget *do_widget)
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
gtk_widget_set_margin_top (entry, 8);
gtk_widget_set_margin_bottom (entry, 8);
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_box_append (GTK_BOX (vbox), entry);
gtk_window_set_child (GTK_WINDOW (window), overlay);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

View File

@ -128,7 +128,7 @@ do_panes (GtkWidget *do_widget)
gtk_widget_set_margin_end (vpaned, 5);
gtk_widget_set_margin_top (vpaned, 5);
gtk_widget_set_margin_bottom (vpaned, 5);
gtk_container_add (GTK_CONTAINER (vbox), vpaned);
gtk_box_append (GTK_BOX (vbox), vpaned);
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
@ -150,13 +150,13 @@ do_panes (GtkWidget *do_widget)
/* Now create toggle buttons to control sizing */
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
create_pane_options (GTK_PANED (hpaned),
"Horizontal",
"Left",
"Right"));
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
create_pane_options (GTK_PANED (vpaned),
"Vertical",
"Top",

View File

@ -61,7 +61,7 @@ do_password_entry (GtkWidget *do_widget)
"activates-default", TRUE,
NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_box_append (GTK_BOX (box), entry);
entry2 = gtk_password_entry_new ();
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry2), TRUE);
@ -70,7 +70,7 @@ do_password_entry (GtkWidget *do_widget)
"activates-default", TRUE,
NULL);
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
gtk_container_add (GTK_CONTAINER (box), entry2);
gtk_box_append (GTK_BOX (box), entry2);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");

View File

@ -188,7 +188,7 @@ do_rotated_text (GtkWidget *do_widget)
/* Add a drawing area */
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (box), drawing_area);
gtk_box_append (GTK_BOX (box), drawing_area);
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
@ -197,7 +197,7 @@ do_rotated_text (GtkWidget *do_widget)
/* And a label */
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
/* Set up fancy stuff on the label */
layout = gtk_label_get_layout (GTK_LABEL (label));

View File

@ -273,23 +273,23 @@ do_search_entry (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create our entry */
entry = gtk_entry_new ();
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"edit-find-symbolic");
gtk_container_add (GTK_CONTAINER (hbox), entry);
gtk_box_append (GTK_BOX (hbox), entry);
/* Create the find and cancel buttons */
notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_container_add (GTK_CONTAINER (hbox), notebook);
gtk_box_append (GTK_BOX (hbox), notebook);
find_button = gtk_button_new_with_label ("Find");
g_signal_connect (find_button, "clicked",

View File

@ -81,38 +81,38 @@ do_search_entry2 (GtkWidget *do_widget)
entry = gtk_search_entry_new ();
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (container), entry);
gtk_box_append (GTK_BOX (container), entry);
searchbar = gtk_search_bar_new ();
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_EDITABLE (entry));
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE);
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container);
gtk_container_add (GTK_CONTAINER (vbox), searchbar);
gtk_box_append (GTK_BOX (vbox), searchbar);
/* Hook the search bar to key presses */
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), window);
/* Help */
label = gtk_label_new ("Start Typing to search");
gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_box_append (GTK_BOX (vbox), label);
/* Toggle button */
button = gtk_toggle_button_new_with_label ("Search");
g_object_bind_property (button, "active",
searchbar, "search-mode-enabled",
G_BINDING_BIDIRECTIONAL);
gtk_container_add (GTK_CONTAINER (vbox), button);
gtk_box_append (GTK_BOX (vbox), button);
/* Result */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Result:");
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_start (label, 6);
gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_append (GTK_BOX (hbox), label);
label = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_append (GTK_BOX (hbox), label);
g_signal_connect (entry, "search-changed",
G_CALLBACK (search_changed_cb), label);
@ -120,15 +120,15 @@ do_search_entry2 (GtkWidget *do_widget)
G_CALLBACK (changed_cb), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (vbox), hbox);
label = gtk_label_new ("Signal:");
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_start (label, 6);
gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_append (GTK_BOX (hbox), label);
label = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_append (GTK_BOX (hbox), label);
g_signal_connect (entry, "search-changed",
G_CALLBACK (search_changed), label);

View File

@ -47,14 +47,14 @@ do_sidebar (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
sidebar = gtk_stack_sidebar_new ();
gtk_container_add (GTK_CONTAINER (box), sidebar);
gtk_box_append (GTK_BOX (box), sidebar);
stack = gtk_stack_new ();
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
gtk_widget_set_hexpand (stack, TRUE);
gtk_container_add (GTK_CONTAINER (box), stack);
gtk_box_append (GTK_BOX (box), stack);
for (i=0; (c = *(pages+i)) != NULL; i++ )
{

View File

@ -118,7 +118,7 @@ do_sizegroup (GtkWidget *do_widget)
/* Create one frame holding color options */
frame = gtk_frame_new ("Color Options");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
table = gtk_grid_new ();
gtk_widget_set_margin_start (table, 5);
@ -134,7 +134,7 @@ do_sizegroup (GtkWidget *do_widget)
/* And another frame holding line style options */
frame = gtk_frame_new ("Line Options");
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_append (GTK_BOX (vbox), frame);
table = gtk_grid_new ();
gtk_widget_set_margin_start (table, 5);
@ -150,7 +150,7 @@ do_sizegroup (GtkWidget *do_widget)
/* And a check button to turn grouping on and off */
check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping");
gtk_container_add (GTK_CONTAINER (vbox), check_button);
gtk_box_append (GTK_BOX (vbox), check_button);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled",

View File

@ -387,7 +387,7 @@ add_choice (GtkWidget *container,
icon = gtk_image_new_from_paintable (paintable);
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (container), icon);
gtk_box_append (GTK_BOX (container), icon);
}
GtkWidget *

View File

@ -55,34 +55,34 @@ do_spinner (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 5);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_container_add (GTK_CONTAINER (content_area), vbox);
gtk_box_append (GTK_BOX (content_area), vbox);
/* Sensitive */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
spinner = gtk_spinner_new ();
gtk_container_add (GTK_CONTAINER (hbox), spinner);
gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (hbox), spinner);
gtk_box_append (GTK_BOX (hbox), gtk_entry_new ());
gtk_box_append (GTK_BOX (vbox), hbox);
spinner_sensitive = spinner;
/* Disabled */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
spinner = gtk_spinner_new ();
gtk_container_add (GTK_CONTAINER (hbox), spinner);
gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_append (GTK_BOX (hbox), spinner);
gtk_box_append (GTK_BOX (hbox), gtk_entry_new ());
gtk_box_append (GTK_BOX (vbox), hbox);
spinner_unsensitive = spinner;
gtk_widget_set_sensitive (hbox, FALSE);
button = gtk_button_new_with_label (_("Play"));
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (on_play_clicked), spinner);
gtk_container_add (GTK_CONTAINER (vbox), button);
gtk_box_append (GTK_BOX (vbox), button);
button = gtk_button_new_with_label (_("Stop"));
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (on_stop_clicked), spinner);
gtk_container_add (GTK_CONTAINER (vbox), button);
gtk_box_append (GTK_BOX (vbox), button);
/* Start by default to test for:
* https://bugzilla.gnome.org/show_bug.cgi?id=598496 */

View File

@ -82,19 +82,19 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), box);
entry = demo_tagged_entry_new ();
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_box_append (GTK_BOX (box), entry);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign (box2, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (box), box2);
gtk_box_append (GTK_BOX (box), box2);
button = gtk_button_new_with_mnemonic ("Add _Tag");
g_signal_connect (button, "clicked", G_CALLBACK (add_tag), entry);
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_check_button_new_with_mnemonic ("_Spinner");
g_signal_connect (button, "toggled", G_CALLBACK (toggle_spinner), entry);
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");

View File

@ -157,7 +157,7 @@ create_text_view (GtkWidget *hbox,
guint timeout;
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (hbox), swindow);
gtk_box_append (GTK_BOX (hbox), swindow);
textview = gtk_text_view_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);

View File

@ -403,7 +403,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (vbox, 8);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
sw = gtk_scrolled_window_new (NULL, NULL);
@ -411,7 +411,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (vbox), sw);
gtk_box_append (GTK_BOX (vbox), sw);
/* create model */
model = create_model ();

View File

@ -787,13 +787,13 @@ node_editor_window_create_renderer_widget (gpointer item,
gtk_widget_set_size_request (box, 120, 90);
label = gtk_label_new (g_object_get_data (G_OBJECT (paintable), "description"));
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
picture = gtk_picture_new_for_paintable (paintable);
/* don't ever scale up, we want to be as accurate as possible */
gtk_widget_set_halign (picture, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picture, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), picture);
gtk_box_append (GTK_BOX (box), picture);
row = gtk_list_box_row_new ();
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);

View File

@ -891,12 +891,12 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
{
if (silver)
{
gtk_container_remove (GTK_CONTAINER (widget), silver);
gtk_list_box_remove (GTK_LIST_BOX (widget), silver);
g_object_set_data (G_OBJECT (widget), "Silver", NULL);
}
if (gold)
{
gtk_container_remove (GTK_CONTAINER (widget), gold);
gtk_list_box_remove (GTK_LIST_BOX (widget), gold);
g_object_set_data (G_OBJECT (widget), "Gold", NULL);
}
@ -926,7 +926,7 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
"margin-bottom", 6,
"xalign", 0.0,
NULL);
gtk_container_add (GTK_CONTAINER (row), label);
gtk_box_append (GTK_BOX (row), label);
gdk_rgba_parse (&rgba, color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
@ -941,8 +941,8 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
"height-request", 24,
NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), swatch);
gtk_container_add (GTK_CONTAINER (row), box);
gtk_box_append (GTK_BOX (box), swatch);
gtk_box_append (GTK_BOX (row), box);
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
@ -1044,7 +1044,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
"hexpand", TRUE,
"xalign", 0.0,
NULL);
gtk_container_add (GTK_CONTAINER (row), label);
gtk_box_append (GTK_BOX (row), label);
gdk_rgba_parse (&rgba, colors[i].color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
@ -1059,8 +1059,8 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
"height-request", 24,
NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), swatch);
gtk_container_add (GTK_CONTAINER (row), box);
gtk_box_append (GTK_BOX (box), swatch);
gtk_box_append (GTK_BOX (row), box);
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
@ -1288,10 +1288,7 @@ close_selection_dialog (GtkWidget *dialog, gint response, GtkWidget *tv)
if (response == GTK_RESPONSE_CANCEL)
return;
box = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
children = gtk_container_get_children (GTK_CONTAINER (box));
box = children->data;
g_list_free (children);
box = gtk_widget_get_first_child (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
g_assert (GTK_IS_FLOW_BOX (box));
children = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (box));

View File

@ -44,7 +44,7 @@ new_widget_info (const char *name,
info->window = gtk_window_new ();
info->include_decorations = FALSE;
gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (info->window), widget);
gtk_box_append (GTK_BOX (info->window), widget);
}
info->no_focus = TRUE;
@ -92,9 +92,9 @@ create_switch (void)
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
gtk_container_add (GTK_CONTAINER (widget), sw);
gtk_box_append (GTK_BOX (widget), sw);
sw = gtk_switch_new ();
gtk_container_add (GTK_CONTAINER (widget), sw);
gtk_box_append (GTK_BOX (widget), sw);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@ -151,16 +151,16 @@ create_menu_button (void)
widget = gtk_menu_button_new ();
image = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic");
gtk_container_add (GTK_CONTAINER (widget), image);
gtk_box_append (GTK_BOX (widget), image);
menu = gtk_popover_new ();
gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), menu);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_box_append (GTK_BOX (vbox), widget);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Menu Button"));
gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Menu Button"));
return new_widget_info ("menu-button", vbox, SMALL);
}
@ -209,8 +209,8 @@ create_lockbutton (void)
widget = gtk_lock_button_new (g_object_new (G_TYPE_TEST_PERMISSION, NULL));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Lock Button"));
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
@ -253,11 +253,11 @@ create_radio (void)
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
radio = gtk_radio_button_new_with_mnemonic (NULL, "Radio Button _One");
gtk_container_add (GTK_CONTAINER (widget), radio);
gtk_box_append (GTK_BOX (widget), radio);
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button _Two");
gtk_container_add (GTK_CONTAINER (widget), radio);
gtk_box_append (GTK_BOX (widget), radio);
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button T_hree");
gtk_container_add (GTK_CONTAINER (widget), radio);
gtk_box_append (GTK_BOX (widget), radio);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@ -288,8 +288,8 @@ create_accel_label (void)
gtk_widget_hide (button);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (box), widget);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), widget);
gtk_box_append (GTK_BOX (box), button);
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (widget), GDK_KEY_Q, GDK_CONTROL_MASK);
@ -369,7 +369,7 @@ create_info_bar (void)
widget = gtk_info_bar_new ();
gtk_info_bar_set_show_close_button (GTK_INFO_BAR (widget), TRUE);
gtk_info_bar_set_message_type (GTK_INFO_BAR (widget), GTK_MESSAGE_INFO);
gtk_container_add (GTK_CONTAINER (widget),
gtk_box_append (GTK_BOX (widget),
gtk_label_new ("Info Bar"));
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
@ -394,16 +394,16 @@ create_search_bar (void)
entry = gtk_search_entry_new ();
gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar");
gtk_container_add (GTK_CONTAINER (widget), entry);
gtk_box_append (GTK_BOX (widget), entry);
gtk_widget_show (entry);
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (widget), TRUE);
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (widget), TRUE);
gtk_container_add (GTK_CONTAINER (box), widget);
gtk_box_append (GTK_BOX (box), widget);
view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (box), view);
gtk_box_append (GTK_BOX (box), view);
info = new_widget_info ("search-bar", box, SMALL);
@ -421,16 +421,16 @@ create_action_bar (void)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (box), view);
gtk_box_append (GTK_BOX (box), view);
widget = gtk_action_bar_new ();
button = gtk_button_new_from_icon_name ("object-select-symbolic");
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (widget), button);
gtk_box_append (GTK_BOX (widget), button);
button = gtk_button_new_from_icon_name ("call-start-symbolic");
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (widget), button);
gtk_box_append (GTK_BOX (widget), button);
g_object_set (gtk_widget_get_parent (button),
"margin-start", 6,
"margin-end", 6,
@ -441,7 +441,7 @@ create_action_bar (void)
gtk_widget_show (widget);
gtk_container_add (GTK_CONTAINER (box), widget);
gtk_box_append (GTK_BOX (box), widget);
info = new_widget_info ("action-bar", box, SMALL);
@ -456,7 +456,7 @@ create_text_view (void)
widget = gtk_frame_new (NULL);
text_view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), text_view);
gtk_box_append (GTK_BOX (widget), text_view);
/* Bad hack to add some size to the widget */
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
"Multiline\nText\n\n", -1);
@ -498,7 +498,7 @@ create_tree_view (void)
g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, "xalign", 0.5, NULL),
"text", 2, NULL);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
gtk_container_add (GTK_CONTAINER (widget), tree_view);
gtk_box_append (GTK_BOX (widget), tree_view);
info = new_widget_info ("list-and-tree", widget, MEDIUM);
info->no_focus = FALSE;
@ -532,11 +532,11 @@ create_icon_view (void)
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), 0);
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), 1);
gtk_container_add (GTK_CONTAINER (widget), icon_view);
gtk_box_append (GTK_BOX (widget), icon_view);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Icon View"));
info = new_widget_info ("icon-view", vbox, MEDIUM);
@ -559,8 +559,8 @@ create_color_button (void)
picker = gtk_color_button_new_with_rgba (&color);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), picker);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), picker);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Color Button"));
return new_widget_info ("color-button", vbox, SMALL);
@ -576,8 +576,8 @@ create_font_button (void)
picker = gtk_font_button_new_with_font ("Sans Serif 10");
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), picker);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), picker);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Font Button"));
return new_widget_info ("font-button", vbox, SMALL);
@ -599,13 +599,13 @@ create_file_button (void)
gtk_widget_set_size_request (picker, 150, -1);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox2), picker);
gtk_container_add (GTK_CONTAINER (vbox2),
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2),
gtk_label_new ("File Button (Files)"));
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
vbox2);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
@ -619,10 +619,10 @@ create_file_button (void)
g_object_unref (file);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox2), picker);
gtk_container_add (GTK_CONTAINER (vbox2),
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2),
gtk_label_new ("File Button (Select Folder)"));
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
vbox2);
return new_widget_info ("file-button", vbox, MEDIUM);
@ -637,12 +637,12 @@ create_separator (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_container_add (GTK_CONTAINER (hbox),
gtk_box_append (GTK_BOX (hbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
gtk_container_add (GTK_CONTAINER (hbox),
gtk_box_append (GTK_BOX (hbox),
gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), hbox);
gtk_box_append (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nSeparators",
"justify", GTK_JUSTIFY_CENTER,
@ -673,7 +673,7 @@ create_panes (void)
gtk_paned_set_resize_end_child (GTK_PANED (pane), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (pane), FALSE);
gtk_container_add (GTK_CONTAINER (hbox), pane);
gtk_box_append (GTK_BOX (hbox), pane);
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
frame = gtk_frame_new ("");
@ -686,10 +686,10 @@ create_panes (void)
gtk_paned_set_resize_end_child (GTK_PANED (pane), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (pane), FALSE);
gtk_container_add (GTK_CONTAINER (hbox), pane);
gtk_box_append (GTK_BOX (hbox), pane);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), hbox);
gtk_box_append (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nPanes",
"justify", GTK_JUSTIFY_CENTER,
@ -852,8 +852,8 @@ create_progressbar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Progress Bar"));
return new_widget_info ("progressbar", vbox, SMALL);
@ -869,8 +869,8 @@ create_level_bar (void)
gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.333);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Level Bar"));
return new_widget_info ("levelbar", vbox, SMALL);
@ -903,8 +903,8 @@ create_scrollbar (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Scrollbar"));
return new_widget_info ("scrollbar", vbox, SMALL);
@ -921,8 +921,8 @@ create_spinbutton (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Spin Button"));
return new_widget_info ("spinbutton", vbox, SMALL);
@ -936,13 +936,13 @@ create_statusbar (void)
GtkWidget *vbox;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Status Bar"));
widget = gtk_statusbar_new ();
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on...");
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_box_append (GTK_BOX (vbox), widget);
info = new_widget_info ("statusbar", vbox, SMALL);
@ -958,14 +958,14 @@ create_scales (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_container_add (GTK_CONTAINER (hbox),
gtk_box_append (GTK_BOX (hbox),
gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0.0, 100.0, 1.0));
gtk_container_add (GTK_CONTAINER (hbox),
gtk_box_append (GTK_BOX (hbox),
gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
0.0, 100.0, 1.0));
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), hbox);
gtk_box_append (GTK_BOX (vbox),
g_object_new (GTK_TYPE_LABEL,
"label", "Horizontal and Vertical\nScales",
"justify", GTK_JUSTIFY_CENTER,
@ -984,8 +984,8 @@ create_image (void)
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Image"));
return new_widget_info ("image", vbox, SMALL);
@ -1004,8 +1004,8 @@ create_spinner (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Spinner"));
return new_widget_info ("spinner", vbox, SMALL);
@ -1022,10 +1022,10 @@ create_volume_button (void)
gtk_widget_set_size_request (widget, 100, 250);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (widget), box);
gtk_box_append (GTK_BOX (widget), box);
button = gtk_volume_button_new ();
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33);
popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button));
@ -1074,8 +1074,8 @@ create_appchooserbutton (void)
picker = gtk_app_chooser_button_new ("text/plain");
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), picker);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), picker);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Application Button"));
return new_widget_info ("appchooserbutton", vbox, SMALL);
@ -1171,9 +1171,9 @@ create_stack (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), switcher);
gtk_container_add (GTK_CONTAINER (vbox), stack);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), switcher);
gtk_box_append (GTK_BOX (vbox), stack);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Stack"));
return new_widget_info ("stack", vbox, ASIS);
@ -1204,9 +1204,9 @@ create_stack_switcher (void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), switcher);
gtk_container_add (GTK_CONTAINER (vbox), stack);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_box_append (GTK_BOX (vbox), switcher);
gtk_box_append (GTK_BOX (vbox), stack);
gtk_box_append (GTK_BOX (vbox),
gtk_label_new ("Stack Switcher"));
return new_widget_info ("stackswitcher", vbox, ASIS);
@ -1239,9 +1239,9 @@ create_sidebar (void)
frame = gtk_frame_new (NULL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (hbox), sidebar);
gtk_container_add (GTK_CONTAINER (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_container_add (GTK_CONTAINER (hbox), stack);
gtk_box_append (GTK_BOX (hbox), sidebar);
gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
gtk_box_append (GTK_BOX (hbox), stack);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
return new_widget_info ("sidebar", frame, ASIS);
@ -1264,33 +1264,33 @@ create_list_box (void)
button = gtk_label_new ("List Box");
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (row), button);
gtk_box_append (GTK_BOX (row), button);
gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line One"));
gtk_box_append (GTK_BOX (row), gtk_label_new ("Line One"));
button = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (row), button);
gtk_box_append (GTK_BOX (row), button);
gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
gtk_list_box_select_row (GTK_LIST_BOX (list), GTK_LIST_BOX_ROW (gtk_widget_get_parent (row)));
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Two"));
gtk_box_append (GTK_BOX (row), gtk_label_new ("Line Two"));
button = gtk_button_new_with_label ("2");
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (row), button);
gtk_box_append (GTK_BOX (row), button);
gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Three"));
gtk_box_append (GTK_BOX (row), gtk_label_new ("Line Three"));
button = gtk_entry_new ();
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (row), button);
gtk_box_append (GTK_BOX (row), button);
gtk_list_box_insert (GTK_LIST_BOX (list), row, -1);
gtk_container_add (GTK_CONTAINER (widget), list);
gtk_box_append (GTK_BOX (widget), list);
info = new_widget_info ("list-box", widget, MEDIUM);
info->no_focus = FALSE;
@ -1315,24 +1315,24 @@ create_flow_box (void)
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (box), 2);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_BROWSE);
button = gtk_label_new ("Child One");
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_with_label ("Child Two");
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (child), gtk_label_new ("Child Three"));
gtk_box_append (GTK_BOX (child), gtk_label_new ("Child Three"));
button = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_container_add (GTK_CONTAINER (child), button);
gtk_container_add (GTK_CONTAINER (box), child);
gtk_box_append (GTK_BOX (child), button);
gtk_box_append (GTK_BOX (box), child);
gtk_flow_box_select_child (GTK_FLOW_BOX (box),
GTK_FLOW_BOX_CHILD (gtk_widget_get_parent (child)));
gtk_container_add (GTK_CONTAINER (widget), box);
gtk_box_append (GTK_BOX (widget), box);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Flow Box"));
gtk_box_append (GTK_BOX (vbox), widget);
gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Flow Box"));
info = new_widget_info ("flow-box", vbox, ASIS);
info->no_focus = FALSE;
@ -1349,7 +1349,7 @@ create_gl_area (void)
widget = gtk_frame_new (NULL);
gears = gtk_gears_new ();
gtk_container_add (GTK_CONTAINER (widget), gears);
gtk_box_append (GTK_BOX (widget), gears);
info = new_widget_info ("glarea", widget, MEDIUM);

View File

@ -0,0 +1,293 @@
#include <gtk/gtk.h>
#include "exampleapp.h"
#include "exampleappwin.h"
struct _ExampleAppWindow
{
GtkApplicationWindow parent;
GSettings *settings;
GtkWidget *stack;
GtkWidget *search;
GtkWidget *searchbar;
GtkWidget *searchentry;
GtkWidget *gears;
GtkWidget *sidebar;
GtkWidget *words;
GtkWidget *lines;
GtkWidget *lines_label;
};
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
static void
search_text_changed (GtkEntry *entry,
ExampleAppWindow *win)
{
const gchar *text;
GtkWidget *tab;
GtkWidget *view;
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
/* Very simple-minded search implementation */
gtk_text_buffer_get_start_iter (buffer, &start);
if (gtk_text_iter_forward_search (&start, text, GTK_TEXT_SEARCH_CASE_INSENSITIVE,
&match_start, &match_end, NULL))
{
gtk_text_buffer_select_range (buffer, &match_start, &match_end);
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (view), &match_start,
0.0, FALSE, 0.0, 0.0);
}
}
static void
find_word (GtkButton *button,
ExampleAppWindow *win)
{
const gchar *word;
word = gtk_button_get_label (button);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void
update_words (ExampleAppWindow *win)
{
GHashTable *strings;
GHashTableIter iter;
GtkWidget *tab, *view, *row;
GtkTextBuffer *buffer;
GtkTextIter start, end;
gchar *word, *key;
GtkWidget *child;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
if (tab == NULL)
return;
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
gtk_text_buffer_get_start_iter (buffer, &start);
while (!gtk_text_iter_is_end (&start))
{
while (!gtk_text_iter_starts_word (&start))
{
if (!gtk_text_iter_forward_char (&start))
goto done;
}
end = start;
if (!gtk_text_iter_forward_word_end (&end))
goto done;
word = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_hash_table_add (strings, g_utf8_strdown (word, -1));
g_free (word);
start = end;
}
done:
while ((child = gtk_widget_get_first_child (win->words)))
gtk_list_box_remove (GTK_LIST_BOX (win->words), child);
g_hash_table_iter_init (&iter, strings);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
{
row = gtk_button_new_with_label (key);
g_signal_connect (row, "clicked",
G_CALLBACK (find_word), win);
gtk_box_append (GTK_BOX (win->words), row);
}
g_hash_table_unref (strings);
}
static void
update_lines (ExampleAppWindow *win)
{
GtkWidget *tab, *view;
GtkTextBuffer *buffer;
int count;
gchar *lines;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
if (tab == NULL)
return;
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
count = gtk_text_buffer_get_line_count (buffer);
lines = g_strdup_printf ("%d", count);
gtk_label_set_text (GTK_LABEL (win->lines), lines);
g_free (lines);
}
static void
visible_child_changed (GObject *stack,
GParamSpec *pspec,
ExampleAppWindow *win)
{
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
return;
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
update_words (win);
update_lines (win);
}
static void
words_changed (GObject *sidebar,
GParamSpec *pspec,
ExampleAppWindow *win)
{
update_words (win);
}
static void
example_app_window_init (ExampleAppWindow *win)
{
GtkBuilder *builder;
GMenuModel *menu;
GAction *action;
gtk_widget_init_template (GTK_WIDGET (win));
win->settings = g_settings_new ("org.gtk.exampleapp");
g_settings_bind (win->settings, "transition",
win->stack, "transition-type",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (win->settings, "show-words",
win->sidebar, "reveal-child",
G_SETTINGS_BIND_DEFAULT);
g_object_bind_property (win->search, "active",
win->searchbar, "search-mode-enabled",
G_BINDING_BIDIRECTIONAL);
g_signal_connect (win->sidebar, "notify::reveal-child",
G_CALLBACK (words_changed), win);
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui");
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (win->gears), menu);
g_object_unref (builder);
action = g_settings_create_action (win->settings, "show-words");
g_action_map_add_action (G_ACTION_MAP (win), action);
g_object_unref (action);
action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible");
g_action_map_add_action (G_ACTION_MAP (win), action);
g_object_unref (action);
g_object_bind_property (win->lines, "visible",
win->lines_label, "visible",
G_BINDING_DEFAULT);
g_object_set (gtk_settings_get_default (), "gtk-shell-shows-app-menu", FALSE, NULL);
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (win), TRUE);
}
static void
example_app_window_dispose (GObject *object)
{
ExampleAppWindow *win;
win = EXAMPLE_APP_WINDOW (object);
g_clear_object (&win->settings);
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
}
static void
example_app_window_class_init (ExampleAppWindowClass *class)
{
G_OBJECT_CLASS (class)->dispose = example_app_window_dispose;
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/exampleapp/window.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines_label);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed);
}
ExampleAppWindow *
example_app_window_new (ExampleApp *app)
{
return g_object_new (EXAMPLE_APP_WINDOW_TYPE, "application", app, NULL);
}
void
example_app_window_open (ExampleAppWindow *win,
GFile *file)
{
gchar *basename;
GtkWidget *scrolled, *view;
gchar *contents;
gsize length;
GtkTextBuffer *buffer;
GtkTextTag *tag;
GtkTextIter start_iter, end_iter;
basename = g_file_get_basename (file);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
{
gtk_text_buffer_set_text (buffer, contents, length);
g_free (contents);
}
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
g_settings_bind (win->settings, "font",
tag, "font",
G_SETTINGS_BIND_DEFAULT);
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
g_free (basename);
gtk_widget_set_sensitive (win->search, TRUE);
update_words (win);
update_lines (win);
}

View File

@ -67,8 +67,8 @@ update_words (ExampleAppWindow *win)
GtkWidget *tab, *view, *row;
GtkTextBuffer *buffer;
GtkTextIter start, end;
GList *children, *l;
gchar *word, *key;
GtkWidget *child;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
@ -98,10 +98,8 @@ update_words (ExampleAppWindow *win)
}
done:
children = gtk_container_get_children (GTK_CONTAINER (win->words));
for (l = children; l; l = l->next)
gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data));
g_list_free (children);
while ((child = gtk_widget_get_first_child (win->words)))
gtk_list_box_remove (GTK_LIST_BOX (win->words), child);
g_hash_table_iter_init (&iter, strings);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
@ -109,7 +107,7 @@ done:
row = gtk_button_new_with_label (key);
g_signal_connect (row, "clicked",
G_CALLBACK (find_word), win);
gtk_container_add (GTK_CONTAINER (win->words), row);
gtk_box_append (GTK_BOX (win->words), row);
}
g_hash_table_unref (strings);

View File

@ -69,8 +69,8 @@ update_words (ExampleAppWindow *win)
GtkWidget *tab, *view, *row;
GtkTextBuffer *buffer;
GtkTextIter start, end;
GList *children, *l;
gchar *word, *key;
GtkWidget *child;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
@ -100,10 +100,8 @@ update_words (ExampleAppWindow *win)
}
done:
children = gtk_container_get_children (GTK_CONTAINER (win->words));
for (l = children; l; l = l->next)
gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data));
g_list_free (children);
while ((child = gtk_widget_get_first_child (win->words)))
gtk_list_box_remove (GTK_LIST_BOX (win->words), child);
g_hash_table_iter_init (&iter, strings);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
@ -111,7 +109,7 @@ done:
row = gtk_button_new_with_label (key);
g_signal_connect (row, "clicked",
G_CALLBACK (find_word), win);
gtk_container_add (GTK_CONTAINER (win->words), row);
gtk_box_append (GTK_BOX (win->words), row);
}
g_hash_table_unref (strings);

View File

@ -228,27 +228,27 @@ new_window (GApplication *app,
button = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-left");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
gtk_container_add (GTK_CONTAINER (toolbar), button);
gtk_box_append (GTK_BOX (toolbar), button);
button = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-center");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
gtk_container_add (GTK_CONTAINER (toolbar), button);
gtk_box_append (GTK_BOX (toolbar), button);
button = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (button), "format-justify-right");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
gtk_container_add (GTK_CONTAINER (toolbar), button);
gtk_box_append (GTK_BOX (toolbar), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign (box, GTK_ALIGN_END);
label = gtk_label_new ("Fullscreen:");
gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_append (GTK_BOX (box), label);
sw = gtk_switch_new ();
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
gtk_container_add (GTK_CONTAINER (box), sw);
gtk_container_add (GTK_CONTAINER (toolbar), box);
gtk_box_append (GTK_BOX (box), sw);
gtk_box_append (GTK_BOX (toolbar), box);
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
@ -406,12 +406,12 @@ edit_accels (GSimpleAction *action,
gtk_window_set_application (GTK_WINDOW (dialog), app);
actions = gtk_application_list_action_descriptions (app);
combo = gtk_combo_box_text_new ();
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
for (i = 0; actions[i]; i++)
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]);
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog);
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), entry);
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), entry);
gtk_dialog_add_button (GTK_DIALOG (dialog), "Close", GTK_RESPONSE_CLOSE);
gtk_dialog_add_button (GTK_DIALOG (dialog), "Set", GTK_RESPONSE_APPLY);
g_signal_connect (dialog, "response", G_CALLBACK (response), dialog);

View File

@ -25,7 +25,7 @@ activate (GtkApplication *app,
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_show (window);
}

View File

@ -23,10 +23,10 @@ activate_cb (GtkApplication *app,
entry = gtk_search_entry_new ();
gtk_widget_set_hexpand (entry, TRUE);
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_box_append (GTK_BOX (box), entry);
menu_button = gtk_menu_button_new ();
gtk_container_add (GTK_CONTAINER (box), menu_button);
gtk_box_append (GTK_BOX (box), menu_button);
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_EDITABLE (entry));
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (search_bar), window);

View File

@ -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);

View File

@ -36,31 +36,25 @@ G_DEFINE_TYPE_WITH_CODE (GtkNotebookPageAccessible, gtk_notebook_page_accessible
static GtkWidget *
find_label_child (GtkContainer *container)
find_label_child (GtkWidget *widget)
{
GList *children, *tmp_list;
GtkWidget *child;
children = gtk_container_get_children (container);
child = NULL;
for (tmp_list = children; tmp_list != NULL; tmp_list = tmp_list->next)
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
if (GTK_IS_LABEL (tmp_list->data))
if (GTK_IS_LABEL (child))
return child;
else
{
child = GTK_WIDGET (tmp_list->data);
break;
}
else if (GTK_IS_CONTAINER (tmp_list->data))
{
child = find_label_child (GTK_CONTAINER (tmp_list->data));
if (child)
break;
GtkWidget *w = find_label_child (child);
if (w)
return w;
}
}
g_list_free (children);
return child;
return NULL;
}
static GtkWidget *
@ -81,10 +75,7 @@ get_label_from_notebook_page (GtkNotebookPageAccessible *page)
if (GTK_IS_LABEL (child))
return child;
if (GTK_IS_CONTAINER (child))
child = find_label_child (GTK_CONTAINER (child));
return child;
return find_label_child (child);
}
static const gchar *

View File

@ -99,12 +99,11 @@ gtk_scrolled_window_accessible_initialize (AtkObject *obj,
obj->role = ATK_ROLE_SCROLL_PANE;
}
static gint
static int
gtk_scrolled_window_accessible_get_n_children (AtkObject *object)
{
GtkWidget *widget;
GtkScrolledWindow *scrolled_window;
GList *children;
gint n_children;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
@ -113,10 +112,9 @@ gtk_scrolled_window_accessible_get_n_children (AtkObject *object)
scrolled_window = GTK_SCROLLED_WINDOW (widget);
children = gtk_container_get_children (GTK_CONTAINER (widget));
n_children = g_list_length (children);
g_list_free (children);
n_children = 0;
if (gtk_scrolled_window_get_child (scrolled_window))
n_children++;
if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
n_children++;
if (gtk_scrolled_window_get_vscrollbar (scrolled_window))
@ -132,9 +130,8 @@ gtk_scrolled_window_accessible_ref_child (AtkObject *obj,
GtkWidget *widget;
GtkScrolledWindow *scrolled_window;
GtkWidget *hscrollbar, *vscrollbar;
GList *children, *tmp_list;
gint n_children;
AtkObject *accessible = NULL;
GtkWidget *c;
GtkWidget *chosen = NULL;
g_return_val_if_fail (child >= 0, NULL);
@ -143,35 +140,21 @@ gtk_scrolled_window_accessible_ref_child (AtkObject *obj,
return NULL;
scrolled_window = GTK_SCROLLED_WINDOW (widget);
c = gtk_scrolled_window_get_child (scrolled_window);
hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window);
vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window);
children = gtk_container_get_children (GTK_CONTAINER (widget));
n_children = g_list_length (children);
if (child == 2)
chosen = vscrollbar;
else if (child == 1)
chosen = c ? hscrollbar : vscrollbar;
else if (child == 0)
chosen = c ? c : (hscrollbar ? hscrollbar : vscrollbar);
if (child == n_children)
{
if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
accessible = gtk_widget_get_accessible (hscrollbar);
else if (gtk_scrolled_window_get_vscrollbar (scrolled_window))
accessible = gtk_widget_get_accessible (vscrollbar);
}
else if (child == n_children + 1 &&
gtk_scrolled_window_get_hscrollbar (scrolled_window) &&
gtk_scrolled_window_get_vscrollbar (scrolled_window))
accessible = gtk_widget_get_accessible (vscrollbar);
else if (child < n_children)
{
tmp_list = g_list_nth (children, child);
if (tmp_list)
accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
}
if (chosen)
return g_object_ref (gtk_widget_get_accessible (chosen));
g_list_free (children);
if (accessible)
g_object_ref (accessible);
return accessible;
return NULL;
}
static void

View File

@ -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;
}

View File

@ -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

View File

@ -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));

View File

@ -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);
}
/**

View File

@ -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));

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -123,7 +123,7 @@
*
* // Add the label, and show everything weve added
*
* gtk_container_add (GTK_CONTAINER (content_area), label);
* gtk_box_append (GTK_BOX (content_area), label);
* gtk_widget_show (dialog);
* }
* ]|
@ -379,7 +379,7 @@ add_to_action_area (GtkDialog *dialog,
GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog);
gtk_widget_set_valign (child, GTK_ALIGN_BASELINE);
gtk_container_add (GTK_CONTAINER (priv->action_area), child);
gtk_box_append (GTK_BOX (priv->action_area), child);
apply_response_for_action_area (dialog, child, response_id);
}
@ -432,21 +432,28 @@ gtk_dialog_constructed (GObject *object)
if (priv->use_header_bar)
{
GList *children, *l;
GtkWidget *child;
children = NULL;
for (child = gtk_widget_get_first_child (priv->action_area);
child != NULL;
child = gtk_widget_get_next_sibling (child))
children = g_list_append (children, child);
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
for (l = children; l != NULL; l = l->next)
{
GtkWidget *child = l->data;
gboolean has_default;
ResponseData *rd;
gint response_id;
child = l->data;
has_default = gtk_widget_has_default (child);
rd = get_response_data (child, FALSE);
response_id = rd ? rd->response_id : GTK_RESPONSE_NONE;
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (priv->action_area), child);
gtk_box_remove (GTK_BOX (priv->action_area), child);
add_to_header_bar (dialog, child, response_id);
g_object_unref (child);
@ -610,22 +617,22 @@ static GList *
get_action_children (GtkDialog *dialog)
{
GtkDialogPrivate *priv = gtk_dialog_get_instance_private (dialog);
GtkWidget *parent;
GtkWidget *child;
GList *children;
if (priv->constructed && priv->use_header_bar)
{
GtkWidget *child;
children = NULL;
for (child = gtk_widget_get_first_child (priv->headerbar);
child != NULL;
child = gtk_widget_get_next_sibling (child))
children = g_list_append (children, child);
}
parent = priv->headerbar;
else
children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
parent = priv->action_area;
return children;
children = NULL;
for (child = gtk_widget_get_first_child (parent);
child != NULL;
child = gtk_widget_get_next_sibling (child))
children = g_list_prepend (children, child);
return g_list_reverse (children);
}
/* A far too tricky heuristic for getting the right initial

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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))

View File

@ -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));

View File

@ -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);

View File

@ -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)
{

View File

@ -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));

View File

@ -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

View File

@ -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
{

View File

@ -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)

View File

@ -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);
}

View File

@ -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;

View File

@ -70,18 +70,6 @@ static void gtk_menu_section_box_new_submenu (GtkMenuTrackerItem *ite
static GtkWidget * gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
GtkMenuSectionBox *parent);
static void
gtk_menu_section_box_sync_item (GtkWidget *widget,
gpointer user_data)
{
MenuData *data = (MenuData *)user_data;
if (GTK_IS_MENU_SECTION_BOX (widget))
gtk_menu_section_box_sync_separators (GTK_MENU_SECTION_BOX (widget), data);
else
data->n_items++;
}
/* We are trying to implement the following rules here:
*
* rule 1: never ever show separators for empty sections
@ -104,11 +92,20 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
gboolean has_label;
gboolean separator_condition;
gint n_items_before;
GtkWidget *child;
n_items_before = data->n_items;
previous_section_is_iconic = data->previous_is_iconic;
gtk_container_foreach (GTK_CONTAINER (box->item_box), gtk_menu_section_box_sync_item, data);
for (child = gtk_widget_get_first_child (GTK_WIDGET (box->item_box));
child != NULL;
child = gtk_widget_get_next_sibling (child))
{
if (GTK_IS_MENU_SECTION_BOX (child))
gtk_menu_section_box_sync_separators (GTK_MENU_SECTION_BOX (child), data);
else
data->n_items++;
}
is_not_empty_item = (data->n_items > n_items_before);
@ -148,7 +145,7 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
if (should_have_separator)
gtk_box_insert_child_after (GTK_BOX (box), box->separator, NULL);
else
gtk_container_remove (GTK_CONTAINER (box), box->separator);
gtk_box_remove (GTK_BOX (box), box->separator);
}
static gboolean
@ -212,11 +209,15 @@ gtk_menu_section_box_remove_func (gint position,
GtkMenuSectionBox *box = user_data;
GtkMenuTrackerItem *item;
GtkWidget *widget;
GList *children;
int pos;
children = gtk_container_get_children (GTK_CONTAINER (box->item_box));
widget = g_list_nth_data (children, position);
for (widget = gtk_widget_get_first_child (GTK_WIDGET (box->item_box)), pos = 0;
widget != NULL;
widget = gtk_widget_get_next_sibling (widget), pos++)
{
if (pos == position)
break;
}
item = g_object_get_data (G_OBJECT (widget), "GtkMenuTrackerItem");
if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU))
@ -229,9 +230,7 @@ gtk_menu_section_box_remove_func (gint position,
gtk_stack_remove (GTK_STACK (stack), subbox);
}
gtk_container_remove (GTK_CONTAINER (box->item_box),
g_list_nth_data (children, position));
g_list_free (children);
gtk_box_remove (GTK_BOX (box->item_box), widget);
gtk_menu_section_box_schedule_separator_sync (box);
}
@ -387,7 +386,7 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
{
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
}
gtk_container_add (GTK_CONTAINER (box->item_box), widget);
gtk_box_append (GTK_BOX (box->item_box), widget);
if (position == 0)
gtk_box_reorder_child_after (GTK_BOX (box->item_box), widget, NULL);
@ -434,7 +433,7 @@ gtk_menu_section_box_init (GtkMenuSectionBox *box)
item_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
box->item_box = GTK_BOX (item_box);
gtk_container_add (GTK_CONTAINER (box), item_box);
gtk_box_append (GTK_BOX (box), item_box);
gtk_widget_set_halign (GTK_WIDGET (item_box), GTK_ALIGN_FILL);
gtk_widget_set_halign (GTK_WIDGET (box), GTK_ALIGN_FILL);
}
@ -602,7 +601,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
gtk_widget_add_css_class (GTK_WIDGET (box->item_box), "inline-buttons");
spacer = gtk_builtin_icon_new ("none");
gtk_container_add (GTK_CONTAINER (box->item_box), spacer);
gtk_box_append (GTK_BOX (box->item_box), spacer);
gtk_size_group_add_widget (box->indicators, spacer);
if (label != NULL)
@ -613,11 +612,11 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
gtk_widget_set_hexpand (title, TRUE);
gtk_widget_set_halign (title, GTK_ALIGN_START);
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (box->item_box), title);
gtk_box_append (GTK_BOX (box->item_box), title);
}
item_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box->item_box), item_box);
gtk_box_append (GTK_BOX (box->item_box), item_box);
box->item_box = GTK_BOX (item_box);
}
else if (hint && g_str_equal (hint, "circular-buttons"))
@ -639,7 +638,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_valign (separator, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (separator, TRUE);
gtk_container_add (GTK_CONTAINER (box->separator), separator);
gtk_box_append (GTK_BOX (box->separator), separator);
title = gtk_label_new (label);
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
@ -647,7 +646,7 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
gtk_widget_set_halign (title, GTK_ALIGN_START);
gtk_label_set_xalign (GTK_LABEL (title), 0.0);
gtk_widget_add_css_class (title, GTK_STYLE_CLASS_TITLE);
gtk_container_add (GTK_CONTAINER (box->separator), title);
gtk_box_append (GTK_BOX (box->separator), title);
}
else
{

View File

@ -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);

View File

@ -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);

View File

@ -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),

View File

@ -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

View File

@ -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);
}
}

View File

@ -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:

View File

@ -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);

View File

@ -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));

View File

@ -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);
}
/*

View File

@ -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);

View File

@ -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

View File

@ -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 @@
* "Im 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;

View File

@ -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)));
* ]|
*

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));
}

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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, Im 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);

View File

@ -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);

View File

@ -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);

View File

@ -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));

Some files were not shown because too many files have changed in this diff Show More