Use gtk_frame_set_child throughout

Replace all uses of gtk_container_add for
frames with gtk_frame_set_child.
This commit is contained in:
Matthias Clasen 2020-05-01 13:41:22 -04:00
parent 7f975472a7
commit 1706b80815
30 changed files with 99 additions and 106 deletions

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

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

@ -125,7 +125,7 @@ do_dialog (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 (frame), vbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
/* Standard message dialog */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);

View File

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

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

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

View File

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

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

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

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

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

View File

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

@ -149,7 +149,7 @@ activate (GtkApplication *app,
/* 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

@ -977,13 +977,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (frame), label_widget);
gtk_frame_set_child (GTK_FRAME (frame), 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 (frame), child);
gtk_frame_set_child (GTK_FRAME (frame), child);
gtk_widget_show (frame);

View File

@ -603,7 +603,7 @@ gtk_entry_completion_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (priv->popup_window), popup_frame);
priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (popup_frame), priv->vbox);
gtk_frame_set_child (GTK_FRAME (popup_frame), priv->vbox);
gtk_container_add (GTK_CONTAINER (priv->scrolled_window), priv->tree_view);
gtk_widget_set_hexpand (priv->scrolled_window, TRUE);

View File

@ -1292,13 +1292,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (frame), label_widget);
gtk_frame_set_child (GTK_FRAME (frame), 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 (frame), child);
gtk_frame_set_child (GTK_FRAME (frame), child);
gtk_widget_show (frame);

View File

@ -25,6 +25,7 @@
#include "gtkcellareacontext.h"
#include "gtkcelllayout.h"
#include "gtkdragsource.h"
#include "gtkframe.h"
#include "gtkimage.h"
#include "gtkintl.h"
#include "gtklabel.h"
@ -925,22 +926,16 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if (priv->child)
{
if (current_child != priv->child)
{
gtk_container_remove (GTK_CONTAINER (frame),
current_child);
gtk_container_add (GTK_CONTAINER (frame),
priv->child);
}
gtk_frame_set_child (GTK_FRAME (frame), priv->child);
}
else
else
{
if (current_child == NULL)
{
current_child = gtk_label_new (NULL);
gtk_widget_show (current_child);
gtk_container_add (GTK_CONTAINER (frame),
current_child);
}
{
current_child = gtk_label_new (NULL);
gtk_widget_show (current_child);
gtk_frame_set_child (GTK_FRAME (frame), current_child);
}
g_return_if_fail (GTK_IS_LABEL (current_child));

View File

@ -231,7 +231,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
gtk_container_add (GTK_CONTAINER (sl), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_add_css_class (box, GTK_STYLE_CLASS_VIEW);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (box), box2);

View File

@ -147,8 +147,7 @@ main (int argc, char *argv[])
revealer = gtk_revealer_new ();
gtk_widget_set_halign (revealer, GTK_ALIGN_END);
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay),
revealer);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), revealer);
gtk_widget_show (revealer);
frame = gtk_frame_new (NULL);
@ -158,7 +157,7 @@ main (int argc, char *argv[])
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_frame_set_child (GTK_FRAME (frame), hbox);
gtk_widget_show (hbox);
label = gtk_label_new ("This is a transparent overlay widget!!!!\nAmazing, eh?");

View File

@ -347,7 +347,7 @@ open_valigned_label_window (void)
frame = gtk_frame_new (NULL);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);

View File

@ -157,7 +157,7 @@ create_frame (const char *caption,
NULL);
gtk_label_set_markup (GTK_LABEL (label), caption);
gtk_container_add (GTK_CONTAINER (frame), child);
gtk_frame_set_child (GTK_FRAME (frame), child);
return frame;
}

View File

@ -193,7 +193,7 @@ simple_cell_area (void)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_frame_set_child (GTK_FRAME (frame), iconview);
/* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
@ -437,7 +437,7 @@ focus_cell_area (void)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_frame_set_child (GTK_FRAME (frame), iconview);
/* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
@ -536,8 +536,7 @@ background_area (void)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_frame_set_child (GTK_FRAME (frame), iconview);
/* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);

View File

@ -81,7 +81,7 @@ create_box_window (void)
gtk_widget_set_margin_bottom (toggle, 5);
g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (on_toggle_hexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_frame_set_child (GTK_FRAME (colorbox), toggle);
gtk_container_add (GTK_CONTAINER (box3), colorbox);
@ -96,7 +96,7 @@ create_box_window (void)
gtk_widget_set_margin_bottom (toggle, 5);
g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (on_toggle_vexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_frame_set_child (GTK_FRAME (colorbox), toggle);
gtk_container_add (GTK_CONTAINER (box3), colorbox);
gtk_container_add (GTK_CONTAINER (box3),
gtk_label_new ("VBox 3 Bottom"));
@ -134,7 +134,7 @@ create_grid_window (void)
gtk_widget_set_margin_bottom (toggle, 5);
g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (on_toggle_hexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_frame_set_child (GTK_FRAME (colorbox), toggle);
gtk_grid_attach (GTK_GRID (grid), colorbox, 1, 1, 1, 1);
@ -149,7 +149,7 @@ create_grid_window (void)
gtk_widget_set_margin_bottom (toggle, 5);
g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (on_toggle_vexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_frame_set_child (GTK_FRAME (colorbox), toggle);
gtk_grid_attach (GTK_GRID (grid), colorbox, 1, 2, 1, 1);

View File

@ -321,7 +321,7 @@ main (int argc,
label_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
group_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (frame), group_box);
gtk_frame_set_child (GTK_FRAME (frame), group_box);
/* OPEN */
add_new_filechooser_button ("_Open:", "Select A File",

View File

@ -51,7 +51,7 @@ populate_flowbox_simple (GtkFlowBox *flowbox)
gtk_widget_show (widget);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (frame), widget);
gtk_frame_set_child (GTK_FRAME (frame), widget);
g_object_set_data_full (G_OBJECT (frame), "id", (gpointer)g_strdup (text), g_free);
gtk_container_add (GTK_CONTAINER (flowbox), frame);
@ -73,7 +73,7 @@ populate_flowbox_focus (GtkFlowBox *flowbox)
frame = gtk_frame_new (NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (frame), box);
gtk_frame_set_child (GTK_FRAME (frame), box);
widget = gtk_label_new ("Label");
gtk_container_add (GTK_CONTAINER (box), widget);
@ -146,7 +146,7 @@ populate_flowbox_wrappy (GtkFlowBox *flowbox)
gtk_widget_show (widget);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (frame), widget);
gtk_frame_set_child (GTK_FRAME (frame), widget);
gtk_label_set_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_wrap_mode (GTK_LABEL (widget), PANGO_WRAP_WORD);

View File

@ -82,7 +82,7 @@ int main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (frame));
widget = gtk_button_new_with_label ("Hello!");
gtk_container_add (GTK_CONTAINER (frame), widget);
gtk_frame_set_child (GTK_FRAME (frame), widget);
grid = GTK_GRID (gtk_grid_new ());
gtk_grid_set_row_spacing (grid, 12);

View File

@ -960,27 +960,27 @@ static void create_labels (GtkWidget *widget)
frame = gtk_frame_new ("Normal Label");
label = gtk_label_new ("This is a Normal label");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Multi-line Label");
label = gtk_label_new ("This is a Multi-line label.\nSecond line\nThird line");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Left Justified Label");
label = gtk_label_new ("This is a Left-Justified\nMulti-line label.\nThird line");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Right Justified Label");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START);
label = gtk_label_new ("This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Internationalized Label");
@ -993,13 +993,13 @@ static void create_labels (GtkWidget *widget)
"Chinese (Traditional) <span lang=\"zh-tw\">\345\205\203\346\260\243 \351\226\213\347\231\274</span>\n"
"Japanese <span lang=\"ja\">\345\205\203\346\260\227 \351\226\213\347\231\272</span>");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Bidirection Label");
label = gtk_label_new ("\342\200\217Arabic \330\247\331\204\330\263\331\204\330\247\331\205 \330\271\331\204\331\212\331\203\331\205\n"
"\342\200\217Hebrew \327\251\327\234\327\225\327\235");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Links in a label");
@ -1007,7 +1007,7 @@ static void create_labels (GtkWidget *widget)
"as hyperlinks, which can be clicked\n"
"or activated via <a href=\"keynav\">keynav</a>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
@ -1023,7 +1023,7 @@ static void create_labels (GtkWidget *widget)
"many extra spaces. ");
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Filled, wrapped label");
@ -1036,14 +1036,14 @@ static void create_labels (GtkWidget *widget)
"unfortunately.");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_FILL);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Underlined label");
label = gtk_label_new ("This label is underlined!\n"
"This one is underlined (\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257) in quite a funky fashion");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
frame = gtk_frame_new ("Markup label");
@ -1070,7 +1070,7 @@ static void create_labels (GtkWidget *widget)
g_assert (gtk_label_get_mnemonic_keyval (GTK_LABEL (label)) == GDK_KEY_s);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_frame_set_child (GTK_FRAME (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);
}
@ -1352,7 +1352,7 @@ create_tooltips (GtkWidget *widget)
"label_xalign", (double) 0.5,
NULL);
gtk_container_add (GTK_CONTAINER (box2), frame);
gtk_container_add (GTK_CONTAINER (frame), box3);
gtk_frame_set_child (GTK_FRAME (frame), box3);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box1), separator);
@ -1789,7 +1789,7 @@ create_modal_window (GtkWidget *widget)
/* Pack widgets */
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_container_add (GTK_CONTAINER (box1), frame1);
gtk_container_add (GTK_CONTAINER (frame1), box2);
gtk_frame_set_child (GTK_FRAME (frame1), box2);
gtk_container_add (GTK_CONTAINER (box2), btnColor);
gtk_container_add (GTK_CONTAINER (box2), btnFile);
gtk_container_add (GTK_CONTAINER (box1), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
@ -2628,7 +2628,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
/* Time, month, hex spinners */
@ -2706,7 +2706,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), frame);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
@ -2783,7 +2783,7 @@ create_spins (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (main_vbox), frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_frame_set_child (GTK_FRAME (frame), vbox);
val_label = gtk_label_new ("0.0");
@ -3134,7 +3134,7 @@ create_cursors (GtkWidget *widget)
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (darea), 80);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (darea), 80);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), cursor_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_frame_set_child (GTK_FRAME (frame), darea);
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed", G_CALLBACK (cursor_pressed_cb), entry);
@ -3277,7 +3277,7 @@ create_forward_back (const char *title,
GtkWidget *back_button = gtk_button_new_with_label ("Back");
GtkWidget *forward_button = gtk_button_new_with_label ("Forward");
gtk_container_add (GTK_CONTAINER (frame), bbox);
gtk_frame_set_child (GTK_FRAME (frame), bbox);
gtk_container_add (GTK_CONTAINER (bbox), back_button);
gtk_container_add (GTK_CONTAINER (bbox), forward_button);
@ -3563,7 +3563,7 @@ create_display_screen (GtkWidget *widget)
gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
gtk_grid_set_column_spacing (GTK_GRID (grid), 3);
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_frame_set_child (GTK_FRAME (frame), grid);
label_dpy = gtk_label_new ("move to another X display");
combo_dpy = gtk_combo_box_text_new_with_entry ();
@ -4152,7 +4152,7 @@ create_pane_options (GtkPaned *paned,
frame = gtk_frame_new (frame_label);
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_frame_set_child (GTK_FRAME (frame), grid);
label = gtk_label_new (label1);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
@ -4230,7 +4230,7 @@ create_panes (GtkWidget *widget)
gtk_paned_add1 (GTK_PANED (hpaned), frame);
button = gtk_button_new_with_label ("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);
@ -4303,7 +4303,7 @@ paned_keyboard_window1 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (hpaned1), frame1, FALSE, TRUE);
vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame1), vbox1);
gtk_frame_set_child (GTK_FRAME (frame1), vbox1);
button7 = gtk_button_new_with_label ("button7");
gtk_container_add (GTK_CONTAINER (vbox1), button7);
@ -4321,10 +4321,10 @@ paned_keyboard_window1 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (vpaned1), frame2, FALSE, TRUE);
frame5 = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (frame2), frame5);
gtk_frame_set_child (GTK_FRAME (frame2), frame5);
hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (frame5), hbox1);
gtk_frame_set_child (GTK_FRAME (frame5), hbox1);
button5 = gtk_button_new_with_label ("button5");
gtk_container_add (GTK_CONTAINER (hbox1), button5);
@ -4336,10 +4336,10 @@ paned_keyboard_window1 (GtkWidget *widget)
gtk_paned_pack2 (GTK_PANED (vpaned1), frame3, TRUE, TRUE);
frame4 = gtk_frame_new ("Buttons");
gtk_container_add (GTK_CONTAINER (frame3), frame4);
gtk_frame_set_child (GTK_FRAME (frame3), frame4);
grid1 = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (frame4), grid1);
gtk_frame_set_child (GTK_FRAME (frame4), grid1);
button1 = gtk_button_new_with_label ("button1");
gtk_grid_attach (GTK_GRID (grid1), button1, 0, 0, 1, 1);
@ -4384,7 +4384,7 @@ paned_keyboard_window2 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (hpaned2), frame6, FALSE, TRUE);
button13 = gtk_button_new_with_label ("button13");
gtk_container_add (GTK_CONTAINER (frame6), button13);
gtk_frame_set_child (GTK_FRAME (frame6), button13);
hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_paned_pack2 (GTK_PANED (hpaned2), hbox2, TRUE, TRUE);
@ -4396,13 +4396,13 @@ paned_keyboard_window2 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (vpaned2), frame7, FALSE, TRUE);
button12 = gtk_button_new_with_label ("button12");
gtk_container_add (GTK_CONTAINER (frame7), button12);
gtk_frame_set_child (GTK_FRAME (frame7), button12);
frame8 = gtk_frame_new (NULL);
gtk_paned_pack2 (GTK_PANED (vpaned2), frame8, TRUE, TRUE);
button11 = gtk_button_new_with_label ("button11");
gtk_container_add (GTK_CONTAINER (frame8), button11);
gtk_frame_set_child (GTK_FRAME (frame8), button11);
button10 = gtk_button_new_with_label ("button10");
gtk_container_add (GTK_CONTAINER (hbox2), button10);
@ -4449,7 +4449,7 @@ paned_keyboard_window3 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (hpaned3), frame9, FALSE, TRUE);
button14 = gtk_button_new_with_label ("button14");
gtk_container_add (GTK_CONTAINER (frame9), button14);
gtk_frame_set_child (GTK_FRAME (frame9), button14);
hpaned4 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_pack2 (GTK_PANED (hpaned3), hpaned4, TRUE, TRUE);
@ -4458,7 +4458,7 @@ paned_keyboard_window3 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (hpaned4), frame10, FALSE, TRUE);
button15 = gtk_button_new_with_label ("button15");
gtk_container_add (GTK_CONTAINER (frame10), button15);
gtk_frame_set_child (GTK_FRAME (frame10), button15);
hpaned5 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_pack2 (GTK_PANED (hpaned4), hpaned5, TRUE, TRUE);
@ -4467,13 +4467,13 @@ paned_keyboard_window3 (GtkWidget *widget)
gtk_paned_pack1 (GTK_PANED (hpaned5), frame11, FALSE, TRUE);
button16 = gtk_button_new_with_label ("button16");
gtk_container_add (GTK_CONTAINER (frame11), button16);
gtk_frame_set_child (GTK_FRAME (frame11), button16);
frame12 = gtk_frame_new (NULL);
gtk_paned_pack2 (GTK_PANED (hpaned5), frame12, TRUE, TRUE);
button17 = gtk_button_new_with_label ("button17");
gtk_container_add (GTK_CONTAINER (frame12), button17);
gtk_frame_set_child (GTK_FRAME (frame12), button17);
return window3;
}
@ -5407,7 +5407,7 @@ create_progress_bar (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_frame_set_child (GTK_FRAME (frame), vbox2);
pdata->pbar = gtk_progress_bar_new ();
gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (pdata->pbar),
@ -5429,7 +5429,7 @@ create_progress_bar (GtkWidget *widget)
gtk_container_add (GTK_CONTAINER (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_frame_set_child (GTK_FRAME (frame), vbox2);
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);

View File

@ -142,7 +142,7 @@ int main (int argc, char *argv[])
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
scales = g_slist_prepend (scales, scale);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("With fill level");
@ -151,7 +151,7 @@ int main (int argc, char *argv[])
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_range_set_show_fill_level (GTK_RANGE (scale), TRUE);
gtk_range_set_fill_level (GTK_RANGE (scale), 50);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Simple marks");
@ -161,7 +161,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, NULL);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Simple marks up");
@ -171,7 +171,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_TOP, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, NULL);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Labeled marks");
@ -183,7 +183,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Some labels");
@ -193,7 +193,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_TOP, labels[0]);
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL);
gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, labels[2]);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Above and below");
@ -204,7 +204,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[1], GTK_POS_BOTTOM, bath_labels[1]);
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[2], GTK_POS_BOTTOM, bath_labels[2]);
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[3], GTK_POS_TOP, bath_labels[3]);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Positions");
@ -215,7 +215,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[1], GTK_POS_RIGHT, pos_labels[1]);
gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[2], GTK_POS_TOP, pos_labels[2]);
gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]);
gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_frame_set_child (GTK_FRAME (frame), scale);
gtk_container_add (GTK_CONTAINER (box), frame);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

View File

@ -101,7 +101,7 @@ scrollable_policy (void)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (swindow);
gtk_container_add (GTK_CONTAINER (frame), swindow);
gtk_frame_set_child (GTK_FRAME (frame), swindow);
viewport = gtk_viewport_new (NULL, NULL);
label = gtk_label_new ("Here is a wrapping label with a minimum width-chars of 40 and "

View File

@ -34,7 +34,7 @@ int main (int argc, char *argv[])
button = gtk_button_new_from_icon_name ("document-save-symbolic");
gtk_container_add (GTK_CONTAINER (box3), button);
gtk_container_add (GTK_CONTAINER (frame), box3);
gtk_frame_set_child (GTK_FRAME (frame), box3);
gtk_widget_show (GTK_WIDGET (window));