Merge branch 'bin-removal' into 'master'

Bin removal

See merge request GNOME/gtk!1820
This commit is contained in:
Matthias Clasen 2020-05-05 12:55:50 +00:00
commit b74a3de299
326 changed files with 3294 additions and 2752 deletions

View File

@ -426,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
editor = constraint_editor_new (model, constraint);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
@ -460,7 +460,7 @@ edit_guide (ConstraintEditorWindow *win,
gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
editor = guide_editor_new (guide);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
gtk_widget_show (window);

View File

@ -216,7 +216,7 @@ constraint_view_add_child (ConstraintView *view,
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "child");
gtk_widget_set_name (frame, name);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_set_parent (frame, GTK_WIDGET (view));
update_weak_position (view, frame, 100, 100);
@ -259,7 +259,7 @@ constraint_view_add_guide (ConstraintView *view,
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "guide");
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
g_object_set_data (G_OBJECT (guide), "frame", frame);

View File

@ -39,7 +39,7 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
static GQuark child_data_quark = 0;
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_BIN)
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_WIDGET)
static void
blur_overlay_set_overlay_child (GtkWidget *widget,
@ -204,7 +204,7 @@ blur_overlay_size_allocate (GtkWidget *widget,
GtkWidget *child;
GtkWidget *main_widget;
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
main_widget = overlay->main_widget;
if (main_widget && gtk_widget_get_visible (main_widget))
gtk_widget_size_allocate (main_widget,
&(GtkAllocation) {
@ -290,43 +290,6 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
return TRUE;
}
static void
blur_overlay_add (GtkContainer *container,
GtkWidget *widget)
{
BlurOverlay *overlay = BLUR_OVERLAY (container);
gtk_widget_insert_after (widget, GTK_WIDGET (container), NULL);
overlay->main_widget = widget;
}
static void
blur_overlay_remove (GtkContainer *container,
GtkWidget *widget)
{
BlurOverlay *overlay = BLUR_OVERLAY (container);
gtk_widget_unparent (widget);
if (overlay->main_widget == widget)
overlay->main_widget = NULL;
}
static void
blur_overlay_forall (GtkContainer *overlay,
GtkCallback callback,
gpointer callback_data)
{
GtkWidget *child;
child = gtk_widget_get_first_child (GTK_WIDGET (overlay));
while (child != NULL)
{
GtkWidget *next = gtk_widget_get_next_sibling (child);
(* callback) (child, callback_data);
child = next;
}
}
static void
blur_overlay_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
@ -420,21 +383,32 @@ blur_overlay_snapshot (GtkWidget *widget,
gsk_render_node_unref (main_widget_node);
}
static void
blur_overlay_dispose (GObject *object)
{
BlurOverlay *overlay = BLUR_OVERLAY (object);
GtkWidget *child;
g_clear_pointer (&overlay->main_widget, gtk_widget_unparent);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (overlay))))
gtk_widget_unparent (child);
G_OBJECT_CLASS (blur_overlay_parent_class)->dispose (object);
}
static void
blur_overlay_class_init (BlurOverlayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = blur_overlay_dispose;
widget_class->measure = blur_overlay_measure;
widget_class->size_allocate = blur_overlay_size_allocate;
widget_class->snapshot = blur_overlay_snapshot;
container_class->add = blur_overlay_add;
container_class->remove = blur_overlay_remove;
container_class->forall = blur_overlay_forall;
klass->get_child_position = blur_overlay_get_child_position;
signals[GET_CHILD_POSITION] =
@ -477,3 +451,11 @@ blur_overlay_add_overlay (BlurOverlay *overlay,
blur_overlay_set_overlay_child (widget, child);
}
void
blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget)
{
gtk_widget_insert_after (widget, GTK_WIDGET (overlay), NULL);
overlay->main_widget = widget;
}

View File

@ -37,14 +37,14 @@ typedef struct _BlurOverlayClass BlurOverlayClass;
struct _BlurOverlay
{
GtkBin parent_instance;
GtkWidget parent_instance;
GtkWidget *main_widget;
};
struct _BlurOverlayClass
{
GtkBinClass parent_class;
GtkWidgetClass parent_class;
gboolean (*get_child_position) (BlurOverlay *overlay,
GtkWidget *widget,
@ -59,6 +59,9 @@ GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);
G_END_DECLS

View File

@ -118,7 +118,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");

View File

@ -324,7 +324,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 10);
gtk_widget_set_margin_top (vbox, 10);
gtk_widget_set_margin_bottom (vbox, 10);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
/* A combobox demonstrating cell renderers, separators and
* insensitive rows
@ -337,7 +337,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
model = create_icon_store ();
combo = gtk_combo_box_new_with_model (model);
@ -381,7 +381,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
model = create_capital_store ();
combo = gtk_combo_box_new_with_model (model);
@ -412,7 +412,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
combo = gtk_combo_box_text_new_with_entry ();
fill_combo_entry (combo);
@ -421,8 +421,7 @@ do_combobox (GtkWidget *do_widget)
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry);
gtk_combo_box_set_child (GTK_COMBO_BOX (combo), entry);
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
@ -433,7 +432,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 5);
gtk_widget_set_margin_top (box, 5);
gtk_widget_set_margin_bottom (box, 5);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");

View File

@ -266,7 +266,7 @@ do_constraints (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (simple_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@ -222,7 +222,7 @@ do_constraints2 (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (interactive_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@ -142,7 +142,7 @@ do_constraints3 (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
grid = g_object_new (vfl_grid_get_type (), NULL);
gtk_widget_set_hexpand (grid, TRUE);

View File

@ -34,7 +34,7 @@ do_css_accordion (GtkWidget *do_widget)
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_button_new_with_label ("This");
gtk_container_add (GTK_CONTAINER (container), child);

View File

@ -92,7 +92,7 @@ do_css_basics (GtkWidget *do_widget)
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text, "changed",

View File

@ -94,7 +94,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
container = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_drawing_area_new ();
gtk_widget_set_name (child, "canvas");

View File

@ -80,7 +80,7 @@ do_css_pixbufs (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), paned);
gtk_window_set_child (GTK_WINDOW (window), paned);
/* Need a filler so we get a handle */
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

View File

@ -99,7 +99,7 @@ do_css_shadows (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), paned);
gtk_window_set_child (GTK_WINDOW (window), paned);
child = create_toolbar ();
gtk_container_add (GTK_CONTAINER (paned), child);

View File

@ -118,14 +118,14 @@ do_dialog (GtkWidget *do_widget)
gtk_widget_set_margin_end (frame, 8);
gtk_widget_set_margin_top (frame, 8);
gtk_widget_set_margin_bottom (frame, 8);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_window_set_child (GTK_WINDOW (window), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 8);
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
/* Standard message dialog */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);

View File

@ -443,7 +443,7 @@ do_dnd (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), box2);
@ -474,7 +474,7 @@ do_dnd (GtkWidget *do_widget)
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box3, "linked");
gtk_container_add (GTK_CONTAINER (sw), box3);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
for (i = 0; colors[i]; i++)
{

View File

@ -202,7 +202,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 16);
gtk_widget_set_margin_top (vbox, 16);
gtk_widget_set_margin_bottom (vbox, 16);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
/*
* Create the checkerboard area
@ -221,7 +221,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), checkerboard_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_frame_set_child (GTK_FRAME (frame), da);
/*
* Create the scribble area
@ -240,7 +240,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_frame_set_child (GTK_FRAME (frame), da);
g_signal_connect (da, "size-allocate",
G_CALLBACK (scribble_size_allocate), NULL);

View File

@ -360,7 +360,7 @@ do_editable_cells (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 (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_label_new ("Shopping list (you can edit the cells!)"));
@ -387,7 +387,7 @@ do_editable_cells (GtkWidget *do_widget)
g_object_unref (numbers_model);
g_object_unref (items_model);
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* some buttons */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);

View File

@ -59,7 +59,7 @@ do_entry_completion (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 (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
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.");

View File

@ -33,7 +33,7 @@ do_entry_undo (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 (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),

View File

@ -78,7 +78,7 @@ do_expander (GtkWidget *do_widget)
"A second paragraph will contain even more "
"innuendo, just to make you scroll down or "
"resize the window. Do it already !", -1);
gtk_container_add (GTK_CONTAINER (sw), tv);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_container_add (GTK_CONTAINER (area), expander);
g_signal_connect (expander, "notify::expanded",

View File

@ -161,7 +161,7 @@ create_menu_button (void)
GtkWidget *w = gtk_menu_button_new ();
GtkWidget *popover = gtk_popover_new ();
gtk_container_add (GTK_CONTAINER (popover), gtk_button_new_with_label ("Hey!"));
gtk_popover_set_child (GTK_POPOVER (popover), gtk_button_new_with_label ("Hey!"));
gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
gtk_menu_button_set_popover (GTK_MENU_BUTTON (w), popover);
g_signal_connect (w, "map", G_CALLBACK (mapped), NULL);

View File

@ -131,10 +131,10 @@ create_demo_window (GtkWidget *do_widget)
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_window_set_child (GTK_WINDOW (window), sw);
fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (sw), fixed);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), fixed);
gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);

View File

@ -37,7 +37,7 @@ color_swatch_new (const gchar *color)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (area), 24);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (area), 24);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area), draw_color, (gpointer) color, NULL);
gtk_container_add (GTK_CONTAINER (button), area);
gtk_button_set_child (GTK_BUTTON (button), area);
return button;
}
@ -735,8 +735,8 @@ do_flowbox (GtkWidget *do_widget)
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), 30);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (flowbox), GTK_SELECTION_NONE);
gtk_container_add (GTK_CONTAINER (scrolled), flowbox);
gtk_container_add (GTK_CONTAINER (window), scrolled);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), flowbox);
gtk_window_set_child (GTK_WINDOW (window), scrolled);
for (i = 0; colors[i]; i++)
gtk_container_add (GTK_CONTAINER (flowbox), color_swatch_new (colors[i]));

View File

@ -93,7 +93,7 @@ do_gears (GtkWidget *do_widget)
gtk_widget_set_margin_top (overlay, 12);
gtk_widget_set_margin_bottom (overlay, 12);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_START);
@ -103,11 +103,11 @@ do_gears (GtkWidget *do_widget)
fps_label = gtk_label_new ("");
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (frame), fps_label);
gtk_frame_set_child (GTK_FRAME (frame), fps_label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (overlay), box);
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);

View File

@ -153,7 +153,7 @@ do_gestures (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), drawing_area);
gtk_window_set_child (GTK_WINDOW (window), drawing_area);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
drawing_area_draw,

View File

@ -401,7 +401,7 @@ create_glarea_window (GtkWidget *do_widget)
gtk_widget_set_margin_top (box, 12);
gtk_widget_set_margin_bottom (box, 12);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
gl_area = gtk_gl_area_new ();
gtk_widget_set_hexpand (gl_area, TRUE);

View File

@ -36,23 +36,23 @@ do_headerbar (GtkWidget *do_widget)
icon = g_themed_icon_new ("mail-send-receive-symbolic");
image = gtk_image_new_from_gicon (icon);
g_object_unref (icon);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_button_set_child (GTK_BUTTON (button), image);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_container_add (GTK_CONTAINER (window), gtk_text_view_new ());
gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
}
if (!gtk_widget_get_visible (window))

View File

@ -266,8 +266,8 @@ do_hypertext (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
show_page (buffer, 1);
}

View File

@ -66,9 +66,9 @@ populate_icons (void)
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
}
static char *content;
@ -102,9 +102,9 @@ populate_text (gboolean hilight)
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), textview);
}
static void
@ -126,9 +126,9 @@ populate_image (void)
hincrement = 5;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), image);
}
static void
@ -137,9 +137,8 @@ set_widget_type (int type)
if (tick_cb)
gtk_widget_remove_tick_callback (window, tick_cb);
if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
gtk_container_remove (GTK_CONTAINER (scrolledwindow),
gtk_bin_get_child (GTK_BIN (scrolledwindow)));
if (gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (scrolledwindow)))
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), NULL);
selected = type;

View File

@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
load_pixbufs ();
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
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);
@ -312,7 +312,7 @@ do_iconview (GtkWidget *do_widget)
/* Connect to the "item-activated" signal */
g_signal_connect (icon_view, "item-activated",
G_CALLBACK (item_activated), store);
gtk_container_add (GTK_CONTAINER (sw), icon_view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), icon_view);
gtk_widget_grab_focus (icon_view);
}

View File

@ -146,7 +146,7 @@ do_iconview_edit (GtkWidget *do_widget)
"text", COL_TEXT,
NULL);
gtk_container_add (GTK_CONTAINER (window), icon_view);
gtk_window_set_child (GTK_WINDOW (window), icon_view);
}
if (!gtk_widget_get_visible (window))

View File

@ -346,7 +346,7 @@ do_images (GtkWidget *do_widget)
gtk_widget_set_margin_end (base_vbox, 16);
gtk_widget_set_margin_top (base_vbox, 16);
gtk_widget_set_margin_bottom (base_vbox, 16);
gtk_container_add (GTK_CONTAINER (window), base_vbox);
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);
@ -367,7 +367,7 @@ do_images (GtkWidget *do_widget)
image = gtk_image_new_from_icon_name ("gtk3-demo");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (frame), image);
gtk_frame_set_child (GTK_FRAME (frame), image);
/* Animation */
@ -384,7 +384,7 @@ do_images (GtkWidget *do_widget)
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
gtk_container_add (GTK_CONTAINER (frame), picture);
gtk_frame_set_child (GTK_FRAME (frame), picture);
/* Symbolic icon */
@ -402,7 +402,7 @@ do_images (GtkWidget *do_widget)
image = gtk_image_new_from_gicon (gicon);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_container_add (GTK_CONTAINER (frame), image);
gtk_frame_set_child (GTK_FRAME (frame), image);
/* Progressive */
@ -423,7 +423,7 @@ do_images (GtkWidget *do_widget)
* will create the pixbuf and fill it in.
*/
picture = gtk_picture_new ();
gtk_container_add (GTK_CONTAINER (frame), picture);
gtk_frame_set_child (GTK_FRAME (frame), picture);
start_progressive_loading (picture);
@ -443,7 +443,7 @@ do_images (GtkWidget *do_widget)
video = gtk_video_new_for_resource ("/images/gtk-logo.webm");
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
gtk_container_add (GTK_CONTAINER (frame), video);
gtk_frame_set_child (GTK_FRAME (frame), video);
/* Widget paintables */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);

View File

@ -66,7 +66,7 @@ do_infobar (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
bar = gtk_info_bar_new ();
gtk_container_add (GTK_CONTAINER (vbox), bar);
@ -143,7 +143,7 @@ do_infobar (GtkWidget *do_widget)
gtk_widget_set_margin_end (actions, 8);
gtk_widget_set_margin_top (actions, 8);
gtk_widget_set_margin_bottom (actions, 8);
gtk_container_add (GTK_CONTAINER (frame), actions);
gtk_frame_set_child (GTK_FRAME (frame), actions);
}
if (!gtk_widget_get_visible (window))

View File

@ -81,7 +81,7 @@ do_links (GtkWidget *do_widget)
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_container_add (GTK_CONTAINER (window), label);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_widget_show (label);
}

View File

@ -266,7 +266,7 @@ do_list_store (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
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);
@ -289,7 +289,7 @@ do_list_store (GtkWidget *do_widget)
g_object_unref (model);
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* add columns to the tree view */
add_columns (GTK_TREE_VIEW (treeview));

View File

@ -360,7 +360,7 @@ do_listbox (GtkWidget *do_widget)
&window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new ("Messages from GTK and friends");
gtk_container_add (GTK_CONTAINER (vbox), label);
scrolled = gtk_scrolled_window_new (NULL, NULL);
@ -368,7 +368,7 @@ do_listbox (GtkWidget *do_widget)
gtk_widget_set_vexpand (scrolled, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), scrolled);
listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (scrolled), listbox);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox);
gtk_list_box_set_sort_func (GTK_LIST_BOX (listbox), (GtkListBoxSortFunc)gtk_message_row_sort, listbox, NULL);
gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (listbox), FALSE);

View File

@ -571,7 +571,7 @@ display_image (const char *resource)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), image);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
return sw;
}
@ -614,7 +614,7 @@ display_text (const char *resource)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), textview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
return sw;
}

View File

@ -63,7 +63,7 @@ do_markup (GtkWidget *do_widget)
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_container_add (GTK_CONTAINER (window), stack);
gtk_window_set_child (GTK_WINDOW (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
@ -86,7 +86,7 @@ do_markup (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
@ -99,7 +99,7 @@ do_markup (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
gtk_stack_add_named (GTK_STACK (stack), sw, "source");

View File

@ -37,7 +37,7 @@ do_overlay (GtkWidget *do_widget)
overlay = gtk_overlay_new ();
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (overlay), grid);
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
entry = gtk_entry_new ();
@ -78,7 +78,7 @@ do_overlay (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (entry, 8);
gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@ -57,9 +57,9 @@ do_overlay2 (GtkWidget *do_widget)
gtk_text_iter_forward_word_end (&end);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_container_add (GTK_CONTAINER (sw), text);
gtk_window_set_child (GTK_WINDOW (window), overlay);
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@ -389,7 +389,7 @@ do_paint (GtkWidget *toplevel)
window = gtk_window_new ();
draw_area = drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), draw_area);
gtk_window_set_child (GTK_WINDOW (window), draw_area);
headerbar = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);

View File

@ -164,7 +164,7 @@ do_paintable (GtkWidget *do_widget)
nuclear = gtk_nuclear_icon_new (0.0);
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
gtk_window_set_child (GTK_WINDOW (window), image);
g_object_unref (nuclear);
}

View File

@ -196,7 +196,7 @@ do_paintable_animated (GtkWidget *do_widget)
nuclear = gtk_nuclear_animation_new ();
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
gtk_window_set_child (GTK_WINDOW (window), image);
g_object_unref (nuclear);
}

View File

@ -298,7 +298,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
video = gtk_video_new_for_media_stream (nuclear);
gtk_container_add (GTK_CONTAINER (window), video);
gtk_window_set_child (GTK_WINDOW (window), video);
g_object_unref (nuclear);
}

View File

@ -103,7 +103,7 @@ create_pane_options (GtkPaned *paned,
gtk_widget_set_margin_bottom (frame, 4);
table = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
label = gtk_label_new (label1);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
@ -159,7 +159,7 @@ do_panes (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_widget_set_margin_start (vpaned, 5);
@ -176,7 +176,7 @@ do_panes (GtkWidget *do_widget)
gtk_paned_add1 (GTK_PANED (hpaned), frame);
button = gtk_button_new_with_mnemonic ("_Hi there");
gtk_container_add (GTK_CONTAINER(frame), button);
gtk_frame_set_child (GTK_FRAME (frame), button);
frame = gtk_frame_new (NULL);
gtk_widget_set_size_request (frame, 80, 60);

View File

@ -53,7 +53,7 @@ do_password_entry (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 18);
gtk_widget_set_margin_top (box, 18);
gtk_widget_set_margin_bottom (box, 18);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
entry = gtk_password_entry_new ();
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);

View File

@ -294,7 +294,7 @@ do_peg_solitaire (GtkWidget *do_widget)
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
for (x = 0; x < 7; x++)
{

View File

@ -29,7 +29,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 20);
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (window), table);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Color:");
gtk_widget_set_halign (label, GTK_ALIGN_START);

View File

@ -212,7 +212,7 @@ do_pixbufs (GtkWidget *do_widget)
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), da);
gtk_window_set_child (GTK_WINDOW (window), da);
gtk_widget_add_tick_callback (da, on_tick, NULL, NULL);
}

View File

@ -185,7 +185,7 @@ do_rotated_text (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
/* Add a drawing area */
drawing_area = gtk_drawing_area_new ();

View File

@ -269,7 +269,7 @@ do_search_entry (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 (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");

View File

@ -78,7 +78,7 @@ do_search_entry2 (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
entry = gtk_search_entry_new ();
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
@ -87,7 +87,7 @@ do_search_entry2 (GtkWidget *do_widget)
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_container_add (GTK_CONTAINER (searchbar), container);
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container);
gtk_container_add (GTK_CONTAINER (vbox), searchbar);
/* Hook the search bar to key presses */

View File

@ -65,7 +65,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (list, 6);
gtk_widget_set_margin_start (list, 6);
gtk_widget_set_margin_end (list, 6);
gtk_container_add (GTK_CONTAINER (window), list);
gtk_window_set_child (GTK_WINDOW (window), list);
for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
{

View File

@ -74,7 +74,7 @@ do_sidebar (GtkWidget *do_widget)
g_object_set (gtk_stack_get_page (GTK_STACK (stack), widget), "title", c, NULL);
}
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
}
if (!gtk_widget_get_visible (window))

View File

@ -112,7 +112,7 @@ do_sizegroup (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 (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
g_object_set_data_full (G_OBJECT (window), "size-group", size_group, g_object_unref);
@ -128,7 +128,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 5);
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
add_row (GTK_GRID (table), 0, size_group, "_Foreground", color_options);
add_row (GTK_GRID (table), 1, size_group, "_Background", color_options);
@ -144,7 +144,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (table, 5);
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_frame_set_child (GTK_FRAME (frame), table);
add_row (GTK_GRID (table), 0, size_group, "_Dashing", dash_options);
add_row (GTK_GRID (table), 1, size_group, "_Line ends", end_options);

View File

@ -267,15 +267,10 @@ start_puzzle (GdkPaintable *paintable)
guint x, y;
float aspect_ratio;
/* Remove the old grid (if there is one) */
grid = gtk_bin_get_child (GTK_BIN (frame));
if (grid)
gtk_container_remove (GTK_CONTAINER (frame), grid);
/* Create a new grid */
grid = gtk_grid_new ();
gtk_widget_set_can_focus (grid, TRUE);
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (frame), grid);
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
if (aspect_ratio == 0.0)
aspect_ratio = 1.0;
@ -345,7 +340,7 @@ reshuffle (void)
{
GtkWidget *grid;
grid = gtk_bin_get_child (GTK_BIN (frame));
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
if (solved)
start_puzzle (puzzle);
else
@ -372,13 +367,14 @@ reconfigure (void)
child = selected->data;
g_list_free (selected);
}
image = gtk_bin_get_child (GTK_BIN (child));
image = gtk_flow_box_child_get_child (GTK_FLOW_BOX_CHILD (child));
puzzle = gtk_image_get_paintable (GTK_IMAGE (image));
start_puzzle (puzzle);
start_puzzle (puzzle);
popover = gtk_widget_get_ancestor (size_spin, GTK_TYPE_POPOVER);
gtk_popover_popdown (GTK_POPOVER (popover));
grid = gtk_bin_get_child (GTK_BIN (frame));
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
gtk_widget_grab_focus (grid);
}
@ -429,7 +425,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_media_stream_play (media);
add_choice (choices, GDK_PAINTABLE (media));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), choices);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), choices);
gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
label = gtk_label_new ("Size");
@ -445,7 +441,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (apply, "clicked", G_CALLBACK (reconfigure), NULL);
popover = gtk_popover_new ();
gtk_container_add (GTK_CONTAINER (popover), tweaks);
gtk_popover_set_child (GTK_POPOVER (popover), tweaks);
tweak = gtk_menu_button_new ();
gtk_menu_button_set_popover (GTK_MENU_BUTTON (tweak), popover);
@ -468,7 +464,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_window_set_child (GTK_WINDOW (window), frame);
start_puzzle (puzzle);
}

View File

@ -46,8 +46,8 @@ do_tabs (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
}
if (!gtk_widget_get_visible (window))

View File

@ -80,7 +80,7 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_widget_set_margin_end (box, 18);
gtk_widget_set_margin_top (box, 18);
gtk_widget_set_margin_bottom (box, 18);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
entry = demo_tagged_entry_new ();
gtk_container_add (GTK_CONTAINER (box), entry);

View File

@ -69,7 +69,7 @@ do_textmask (GtkWidget *do_widget)
da = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), da);
gtk_window_set_child (GTK_WINDOW (window), da);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_text, NULL, NULL);
}

View File

@ -159,7 +159,7 @@ create_text_view (GtkWidget *hbox,
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (hbox), swindow);
textview = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (swindow), textview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);
timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
@ -188,7 +188,7 @@ do_textscroll (GtkWidget *do_widget)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_window_set_child (GTK_WINDOW (window), hbox);
create_text_view (hbox, TRUE);
create_text_view (hbox, FALSE);

View File

@ -53,8 +53,8 @@ do_textundo (GtkWidget *do_widget)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
}
if (!gtk_widget_get_visible (window))

View File

@ -486,7 +486,7 @@ do_textview (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (window), vpaned);
gtk_window_set_child (GTK_WINDOW (window), vpaned);
/* For convenience, we just use the autocreated buffer from
* the first text view; you could also create the buffer
@ -503,7 +503,7 @@ do_textview (GtkWidget *do_widget)
GTK_POLICY_AUTOMATIC);
gtk_paned_add1 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view1);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view1);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
@ -511,7 +511,7 @@ do_textview (GtkWidget *do_widget)
GTK_POLICY_AUTOMATIC);
gtk_paned_add2 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
create_tags (buffer);
insert_text (GTK_TEXT_VIEW (view1));
@ -547,7 +547,7 @@ recursive_attach_view (int depth,
/* Frame is to add a black border around each child view */
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (frame), child_view);
gtk_frame_set_child (GTK_FRAME (frame), child_view);
gtk_text_view_add_child_at_anchor (view, frame, anchor);
@ -594,8 +594,8 @@ easter_egg_callback (GtkWidget *button,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
window_ptr = &window;
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);

View File

@ -31,7 +31,7 @@ do_theming_style_classes (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
g_object_unref (builder);
}

View File

@ -29,10 +29,10 @@ do_transparent (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
overlay = blur_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
button = gtk_button_new_with_label ("Don't click this button!");
label = gtk_bin_get_child (GTK_BIN (button));
label = gtk_button_get_child (GTK_BUTTON (button));
gtk_widget_set_margin_start (label, 50);
gtk_widget_set_margin_end (label, 50);
gtk_widget_set_margin_top (label, 50);
@ -45,7 +45,7 @@ do_transparent (GtkWidget *do_widget)
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
button = gtk_button_new_with_label ("Maybe this one?");
label = gtk_bin_get_child (GTK_BIN (button));
label = gtk_button_get_child (GTK_BUTTON (button));
gtk_widget_set_margin_start (label, 50);
gtk_widget_set_margin_end (label, 50);
gtk_widget_set_margin_top (label, 50);
@ -58,7 +58,7 @@ do_transparent (GtkWidget *do_widget)
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
gtk_container_add (GTK_CONTAINER (overlay), picture);
blur_overlay_set_child (BLUR_OVERLAY (overlay), picture);
}
if (!gtk_widget_get_visible (window))

View File

@ -402,7 +402,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_window_set_child (GTK_WINDOW (window), vbox);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
@ -426,7 +426,7 @@ do_tree_store (GtkWidget *do_widget)
add_columns (GTK_TREE_VIEW (treeview));
gtk_container_add (GTK_CONTAINER (sw), treeview);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
/* expand all rows after the treeview widget has been realized */
g_signal_connect (treeview, "realize",

View File

@ -71,7 +71,7 @@ do_video_player (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
video = gtk_video_new ();
gtk_container_add (GTK_CONTAINER (window), video);
gtk_window_set_child (GTK_WINDOW (window), video);
title = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);

View File

@ -228,7 +228,7 @@ selected_context_changed (GtkListBox *list, IconBrowserWindow *win)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (win->search), FALSE);
label = gtk_bin_get_child (GTK_BIN (row));
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
win->current_context = g_object_get_data (G_OBJECT (label), "context");
gtk_tree_model_filter_refilter (win->filter_model);
}

View File

@ -551,7 +551,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@ -304,7 +304,6 @@
<title>Abstract Base Classes</title>
<xi:include href="xml/gtkwidget.xml" />
<xi:include href="xml/gtkcontainer.xml" />
<xi:include href="xml/gtkbin.xml" />
<xi:include href="xml/gtkrange.xml" />
<xi:include href="xml/gtkimcontext.xml" />
<xi:include href="xml/gtknativedialog.xml" />

View File

@ -198,6 +198,8 @@ gtk_aspect_frame_set_ratio
gtk_aspect_frame_get_ratio
gtk_aspect_frame_set_obey_child
gtk_aspect_frame_get_obey_child
gtk_aspect_frame_set_child
gtk_aspect_frame_get_child
<SUBSECTION Standard>
GTK_ASPECT_FRAME
GTK_IS_ASPECT_FRAME
@ -209,24 +211,6 @@ GTK_ASPECT_FRAME_GET_CLASS
gtk_aspect_frame_get_type
</SECTION>
<SECTION>
<FILE>gtkbin</FILE>
<TITLE>GtkBin</TITLE>
GtkBin
GtkBinClass
gtk_bin_get_child
<SUBSECTION Standard>
GTK_BIN
GTK_IS_BIN
GTK_TYPE_BIN
GTK_BIN_CLASS
GTK_IS_BIN_CLASS
GTK_BIN_GET_CLASS
<SUBSECTION Private>
GtkBinPrivate
gtk_bin_get_type
</SECTION>
<SECTION>
<FILE>gtkbox</FILE>
<TITLE>GtkBox</TITLE>
@ -537,6 +521,8 @@ gtk_button_get_use_underline
gtk_button_set_use_underline
gtk_button_set_icon_name
gtk_button_get_icon_name
gtk_button_set_child
gtk_button_get_child
<SUBSECTION Standard>
GTK_BUTTON
@ -659,6 +645,8 @@ gtk_combo_box_set_entry_text_column
gtk_combo_box_get_entry_text_column
gtk_combo_box_set_popup_fixed_width
gtk_combo_box_get_popup_fixed_width
gtk_combo_box_set_child
gtk_combo_box_get_child
<SUBSECTION Standard>
GTK_TYPE_COMBO_BOX
GTK_COMBO_BOX
@ -1382,6 +1370,8 @@ gtk_font_chooser_dialog_get_type
GtkFrame
GtkFrameClass
gtk_frame_new
gtk_frame_set_child
gtk_frame_get_child
gtk_frame_set_label
gtk_frame_get_label
gtk_frame_set_label_widget
@ -2200,6 +2190,8 @@ gtk_scrollbar_get_type
<TITLE>GtkScrolledWindow</TITLE>
GtkScrolledWindow
gtk_scrolled_window_new
gtk_scrolled_window_get_child
gtk_scrolled_window_set_child
gtk_scrolled_window_get_hadjustment
gtk_scrolled_window_set_hadjustment
gtk_scrolled_window_get_vadjustment
@ -2251,6 +2243,8 @@ GtkScrolledWindowPrivate
<TITLE>GtkSearchBar</TITLE>
GtkSearchBar
gtk_search_bar_new
gtk_search_bar_set_child
gtk_search_bar_get_child
gtk_search_bar_connect_entry
gtk_search_bar_get_search_mode
gtk_search_bar_set_search_mode
@ -3854,6 +3848,8 @@ GtkViewport
gtk_viewport_new
gtk_viewport_set_scroll_to_focus
gtk_viewport_get_scroll_to_focus
gtk_viewport_set_child
gtk_viewport_get_child
<SUBSECTION Standard>
GTK_VIEWPORT
GTK_IS_VIEWPORT
@ -4193,6 +4189,8 @@ gtk_requisition_get_type
GtkWindow
GtkWindowClass
gtk_window_new
gtk_window_get_child
gtk_window_set_child
gtk_window_set_title
gtk_window_set_resizable
gtk_window_get_resizable
@ -5468,7 +5466,10 @@ GtkLockButtonPrivate
GtkOverlay
gtk_overlay_new
gtk_overlay_set_child
gtk_overlay_get_child
gtk_overlay_add_overlay
gtk_overlay_remove_overlay
gtk_overlay_get_measure_overlay
gtk_overlay_set_measure_overlay
gtk_overlay_get_clip_overlay
@ -5669,6 +5670,8 @@ gtk_stack_switcher_get_type
<TITLE>GtkRevealer</TITLE>
GtkRevealer
gtk_revealer_new
gtk_revealer_get_child
gtk_revealer_set_child
gtk_revealer_get_reveal_child
gtk_revealer_set_reveal_child
gtk_revealer_get_child_revealed
@ -5738,6 +5741,8 @@ gtk_flow_box_bind_model
<SUBSECTION GtkFlowBoxChild>
GtkFlowBoxChild
gtk_flow_box_child_new
gtk_flow_box_child_set_child
gtk_flow_box_child_get_child
gtk_flow_box_child_get_index
gtk_flow_box_child_is_selected
gtk_flow_box_child_changed
@ -5768,6 +5773,8 @@ GtkPopover
gtk_popover_new
gtk_popover_popup
gtk_popover_popdown
gtk_popover_set_child
gtk_popover_get_child
gtk_popover_set_pointing_to
gtk_popover_get_pointing_to
gtk_popover_set_position

View File

@ -16,7 +16,6 @@ gtk_application_window_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type
gtk_assistant_page_get_type
gtk_bin_get_type
gtk_bin_layout_get_type
gtk_box_get_type
gtk_box_layout_get_type

View File

@ -307,13 +307,13 @@ create_combo_box_entry (void)
model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
widget = g_object_new (GTK_TYPE_COMBO_BOX,
"has-entry", TRUE,
"model", model,
"entry-text-column", 0,
NULL);
"has-entry", TRUE,
"model", model,
"entry-text-column", 0,
NULL);
g_object_unref (model);
child = gtk_bin_get_child (GTK_BIN (widget));
child = gtk_combo_box_get_child (GTK_COMBO_BOX (widget));
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@ -876,7 +876,7 @@ create_scrolledwindow (void)
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
label = gtk_label_new ("Scrolled Window");
gtk_container_add (GTK_CONTAINER (scrolledwin), label);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwin), label);
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
}
@ -1122,15 +1122,15 @@ create_headerbar (void)
GtkWidget *button;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (bar), "Header Bar");
gtk_window_set_title (GTK_WINDOW (window), "Header Bar");
view = gtk_text_view_new ();
gtk_widget_show (view);
gtk_widget_set_size_request (window, 220, 150);
gtk_container_add (GTK_CONTAINER (window), view);
gtk_window_set_child (GTK_WINDOW (window), view);
bar = gtk_header_bar_new ();
gtk_window_set_titlebar (GTK_WINDOW (window), bar);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button);
return new_widget_info ("headerbar", window, ASIS);
@ -1232,7 +1232,7 @@ create_sidebar (void)
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_container_add (GTK_CONTAINER (frame), hbox);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
return new_widget_info ("sidebar", frame, ASIS);
}

View File

@ -113,7 +113,7 @@ activate (GApplication *app,
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (button_menu));
gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (win), button);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_widget_show (win);
g_object_unref (button_menu);

View File

@ -37,7 +37,7 @@ search_text_changed (GtkEntry *entry,
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
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 */
@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
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);
@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
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);
@ -266,7 +266,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))

View File

@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
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 */
@ -125,7 +125,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -35,7 +35,7 @@ search_text_changed (GtkEntry *entry,
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
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 */
@ -75,7 +75,7 @@ update_words (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
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);
@ -229,7 +229,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -37,7 +37,7 @@ search_text_changed (GtkEntry *entry,
return;
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
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 */
@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
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);
@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
if (tab == NULL)
return;
view = gtk_bin_get_child (GTK_BIN (tab));
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);
@ -263,7 +263,7 @@ example_app_window_open (ExampleAppWindow *win,
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_container_add (GTK_CONTAINER (scrolled), view);
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));

View File

@ -222,7 +222,7 @@ new_window (GApplication *app,
gtk_window_set_title (GTK_WINDOW (window), "Bloatpad");
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
button = gtk_toggle_button_new ();
@ -259,7 +259,7 @@ new_window (GApplication *app,
g_object_set_data ((GObject*)window, "bloatpad-text", view);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);

View File

@ -143,13 +143,13 @@ activate (GtkApplication *app,
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_window_set_child (GTK_WINDOW (window), frame);
drawing_area = gtk_drawing_area_new ();
/* set a minimum size */
gtk_widget_set_size_request (drawing_area, 100, 100);
gtk_container_add (GTK_CONTAINER (frame), drawing_area);
gtk_frame_set_child (GTK_FRAME (frame), drawing_area);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw_cb, NULL, NULL);

View File

@ -23,7 +23,7 @@ activate (GtkApplication *app,
grid = gtk_grid_new ();
/* Pack the container in the window */
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
button = gtk_button_new_with_label ("Button 1");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);

View File

@ -20,7 +20,7 @@ activate (GtkApplication *app,
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (window), box);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);

View File

@ -83,7 +83,7 @@ new_window (GApplication *app,
gtk_window_set_title (GTK_WINDOW (window), "Plugman");
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_window_set_child (GTK_WINDOW (window), grid);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled, TRUE);
@ -92,7 +92,7 @@ new_window (GApplication *app,
g_object_set_data ((GObject*)window, "plugman-text", view);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);

View File

@ -15,11 +15,11 @@ activate_cb (GtkApplication *app,
search_bar = gtk_search_bar_new ();
gtk_widget_set_valign (search_bar, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (window), search_bar);
gtk_window_set_child (GTK_WINDOW (window), search_bar);
gtk_widget_show (search_bar);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (search_bar), box);
gtk_search_bar_set_child (GTK_SEARCH_BAR (search_bar), box);
entry = gtk_search_entry_new ();
gtk_widget_set_hexpand (entry, TRUE);

View File

@ -19,15 +19,15 @@ new_window (GApplication *app,
gtk_window_set_titlebar (GTK_WINDOW (window), header);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_window_set_child (GTK_WINDOW (window), overlay);
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_container_add (GTK_CONTAINER (scrolled), view);
gtk_container_add (GTK_CONTAINER (overlay), scrolled);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
gtk_overlay_set_child (GTK_OVERLAY (overlay), scrolled);
if (file != NULL)
{

View File

@ -26,7 +26,7 @@
static void atk_action_interface_init (AtkActionIface *iface);
static void atk_image_interface_init (AtkImageIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
@ -60,7 +60,7 @@ get_image_from_button (GtkWidget *button)
{
GtkWidget *image;
image = gtk_bin_get_child (GTK_BIN (button));
image = gtk_button_get_child (GTK_BUTTON (button));
if (GTK_IS_IMAGE (image))
return image;
@ -99,7 +99,7 @@ get_label_from_button (GtkWidget *button)
{
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (button));
child = gtk_button_get_child (GTK_BUTTON (button));
if (GTK_IS_CONTAINER (child))
child = find_label_child (GTK_CONTAINER (child));

View File

@ -31,7 +31,7 @@ struct _GtkComboBoxAccessiblePrivate
static void atk_action_interface_init (AtkActionIface *iface);
static void atk_selection_interface_init (AtkSelectionIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_ADD_PRIVATE (GtkComboBoxAccessible)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
@ -80,7 +80,7 @@ gtk_combo_box_accessible_initialize (AtkObject *obj,
accessible->priv->popup_set = TRUE;
}
if (gtk_combo_box_get_has_entry (combo_box))
atk_object_set_parent (gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (combo_box))), obj);
atk_object_set_parent (gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (combo_box))), obj);
obj->role = ATK_ROLE_COMBO_BOX;
}
@ -181,7 +181,7 @@ gtk_combo_box_accessible_ref_child (AtkObject *obj,
}
else if (i == 1 && gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget)))
{
child = gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (widget)));
child = gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (widget)));
}
else
{

View File

@ -22,7 +22,7 @@
#include "gtk/gtkflowbox.h"
G_DEFINE_TYPE (GtkFlowBoxChildAccessible, gtk_flow_box_child_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
G_DEFINE_TYPE (GtkFlowBoxChildAccessible, gtk_flow_box_child_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
static void
gtk_flow_box_child_accessible_init (GtkFlowBoxChildAccessible *accessible)

View File

@ -22,7 +22,7 @@
#include "gtkframeaccessible.h"
G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
static void
gtk_frame_accessible_initialize (AtkObject *accessible,

View File

@ -22,7 +22,7 @@
#include "gtk/gtklistbox.h"
G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
static void
gtk_list_box_row_accessible_init (GtkListBoxRowAccessible *accessible)
@ -50,7 +50,7 @@ gtk_list_box_row_accessible_ref_state_set (AtkObject *obj)
if (widget != NULL)
{
parent = gtk_widget_get_parent (widget);
if (parent != NULL &&
if (parent != NULL &&
GTK_IS_LIST_BOX (parent) &&
gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE)
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);

View File

@ -21,7 +21,7 @@
#include "gtkscrolledwindowaccessible.h"
G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
static void
visibility_changed (GObject *object,
@ -33,7 +33,6 @@ visibility_changed (GObject *object,
gint index;
gint n_children;
gboolean child_added = FALSE;
GList *children;
AtkObject *child;
GtkWidget *widget;
GtkScrolledWindow *scrolled_window;
@ -45,9 +44,7 @@ visibility_changed (GObject *object,
return;
scrolled_window = GTK_SCROLLED_WINDOW (widget);
children = gtk_container_get_children (GTK_CONTAINER (widget));
index = n_children = g_list_length (children);
g_list_free (children);
index = n_children = 1;
hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window);
vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window);

View File

@ -46,7 +46,7 @@ static void atk_window_interface_init (AtkWindowIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkWindowAccessible,
gtk_window_accessible,
GTK_TYPE_CONTAINER_ACCESSIBLE,
GTK_TYPE_WIDGET_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT,
atk_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
@ -76,33 +76,6 @@ gtk_window_accessible_notify_gtk (GObject *obj,
GTK_WIDGET_ACCESSIBLE_CLASS (gtk_window_accessible_parent_class)->notify_gtk (obj, pspec);
}
static GtkWidget *
find_label_child (GtkContainer *container)
{
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)
{
if (GTK_IS_LABEL (tmp_list->data))
{
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;
}
}
g_list_free (children);
return child;
}
static const gchar *
gtk_window_accessible_get_name (AtkObject *accessible)
{
@ -122,14 +95,6 @@ gtk_window_accessible_get_name (AtkObject *accessible)
GtkWindow *window = GTK_WINDOW (widget);
name = gtk_window_get_title (window);
if (name == NULL && accessible->role == ATK_ROLE_TOOL_TIP)
{
GtkWidget *child;
child = find_label_child (GTK_CONTAINER (window));
if (GTK_IS_LABEL (child))
name = gtk_label_get_text (GTK_LABEL (child));
}
}
return name;
}
@ -244,29 +209,19 @@ gtk_window_accessible_ref_state_set (AtkObject *accessible)
return state_set;
}
static void
count_widget (GtkWidget *widget,
gint *count)
{
(*count)++;
}
static void
prepend_widget (GtkWidget *widget,
GList **list)
{
*list = g_list_prepend (*list, widget);
}
static gint
gtk_window_accessible_get_n_children (AtkObject *object)
{
GtkWidget *window;
GtkWidget *child;
gint count = 0;
window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
gtk_container_forall (GTK_CONTAINER (window),
(GtkCallback) count_widget, &count);
for (child = gtk_widget_get_first_child (GTK_WIDGET (window));
child != NULL;
child = gtk_widget_get_next_sibling (child))
count++;
return count;
}
@ -274,19 +229,19 @@ static AtkObject *
gtk_window_accessible_ref_child (AtkObject *object,
gint i)
{
GtkWidget *window, *ref_child;
GList *children = NULL;
GtkWidget *window, *child;
int pos;
window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
gtk_container_forall (GTK_CONTAINER (window),
(GtkCallback) prepend_widget, &children);
ref_child = g_list_nth_data (children, i);
g_list_free (children);
for (child = gtk_widget_get_first_child (GTK_WIDGET (window)), pos = 0;
child != NULL;
child = gtk_widget_get_next_sibling (child), pos++)
{
if (pos == i)
return g_object_ref (gtk_widget_get_accessible (child));
}
if (!ref_child)
return NULL;
return g_object_ref (gtk_widget_get_accessible (ref_child));
return NULL;
}
static void

View File

@ -46,7 +46,6 @@
#include <gtk/gtkapplicationwindow.h>
#include <gtk/gtkaspectframe.h>
#include <gtk/gtkassistant.h>
#include <gtk/gtkbin.h>
#include <gtk/gtkbinlayout.h>
#include <gtk/gtkborder.h>
#include <gtk/gtkboxlayout.h>

View File

@ -249,7 +249,7 @@ gtk_action_bar_init (GtkActionBar *self)
gtk_center_box_set_start_widget (GTK_CENTER_BOX (self->center_box), self->start_box);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (self->center_box), self->end_box);
gtk_container_add (GTK_CONTAINER (self->revealer), self->center_box);
gtk_revealer_set_child (GTK_REVEALER (self->revealer), self->center_box);
}
static GtkBuildableIface *parent_buildable_iface;

View File

@ -458,7 +458,7 @@ setup_search (GtkAppChooserDialog *self)
button = gtk_toggle_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
image = gtk_image_new_from_icon_name ("edit-find-symbolic");
gtk_container_add (GTK_CONTAINER (button), image);
gtk_button_set_child (GTK_BUTTON (button), image);
gtk_widget_add_css_class (button, "image-button");
gtk_widget_remove_css_class (button, "text-button");

View File

@ -591,7 +591,7 @@ gtk_application_window_real_size_allocate (GtkWidget *widget,
child_allocation.y += menubar_height;
child_allocation.height -= menubar_height;
child = gtk_bin_get_child (GTK_BIN (window));
child = gtk_window_get_child (GTK_WINDOW (window));
if (child != NULL && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation, baseline);
}
@ -668,21 +668,6 @@ gtk_application_window_real_unmap (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->unmap (widget);
}
static void
gtk_application_window_real_forall_internal (GtkContainer *container,
GtkCallback callback,
gpointer user_data)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (container);
GtkApplicationWindowPrivate *priv = gtk_application_window_get_instance_private (window);
if (priv->menubar)
callback (priv->menubar, user_data);
GTK_CONTAINER_CLASS (gtk_application_window_parent_class)
->forall (container, callback, user_data);
}
static void
gtk_application_window_get_property (GObject *object,
guint prop_id,
@ -782,12 +767,9 @@ gtk_application_window_init (GtkApplicationWindow *window)
static void
gtk_application_window_class_init (GtkApplicationWindowClass *class)
{
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
container_class->forall = gtk_application_window_real_forall_internal;
widget_class->measure = gtk_application_window_measure;
widget_class->size_allocate = gtk_application_window_real_size_allocate;
widget_class->realize = gtk_application_window_real_realize;

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