Stop using gtk_box_pack_end

It might soon go away!
This commit is contained in:
Timm Bäder 2018-12-26 08:20:34 +01:00 committed by Matthias Clasen
parent 09361e7665
commit bd71e744d2
81 changed files with 869 additions and 872 deletions

View File

@ -73,7 +73,7 @@ do_expander (GtkWidget *do_widget)
"resize the window. Do it already !", -1); "resize the window. Do it already !", -1);
gtk_container_add (GTK_CONTAINER (sw), tv); gtk_container_add (GTK_CONTAINER (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw); gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_box_pack_end (GTK_BOX (area), expander); gtk_container_add (GTK_CONTAINER (area), expander);
g_signal_connect (expander, "notify::expanded", g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), window); G_CALLBACK (expander_cb), window);

View File

@ -991,7 +991,7 @@ create_statusbar (void)
gtk_widget_set_halign (widget, GTK_ALIGN_FILL); gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on..."); gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on...");
gtk_box_pack_end (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
info = new_widget_info ("statusbar", vbox, SMALL); info = new_widget_info ("statusbar", vbox, SMALL);
@ -1074,7 +1074,7 @@ create_volume_button (void)
gtk_container_add (GTK_CONTAINER (widget), box); gtk_container_add (GTK_CONTAINER (widget), box);
button = gtk_volume_button_new (); button = gtk_volume_button_new ();
gtk_box_pack_end (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33); gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33);
popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button)); popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button));

View File

@ -210,7 +210,8 @@ gtk_action_bar_set_child_property (GtkContainer *container,
{ {
g_object_ref (child); g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (priv->start_box), child); gtk_container_remove (GTK_CONTAINER (priv->start_box), child);
gtk_box_pack_end (GTK_BOX (priv->end_box), child); gtk_container_add (GTK_CONTAINER (priv->end_box), child);
gtk_box_reorder_child (GTK_BOX (priv->end_box), child, 0);
g_object_unref (child); g_object_unref (child);
} }
} }
@ -478,7 +479,8 @@ gtk_action_bar_pack_end (GtkActionBar *action_bar,
{ {
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar); GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (action_bar);
gtk_box_pack_end (GTK_BOX (priv->end_box), child); gtk_container_add (GTK_CONTAINER (priv->end_box), child);
gtk_box_reorder_child (GTK_BOX (priv->end_box), child, 0);
} }
/** /**

View File

@ -338,7 +338,7 @@ construct_appchooser_widget (GtkAppChooserDialog *self)
/* Need to build the appchooser widget after, because of the content-type construct-only property */ /* Need to build the appchooser widget after, because of the content-type construct-only property */
self->priv->app_chooser_widget = gtk_app_chooser_widget_new (self->priv->content_type); self->priv->app_chooser_widget = gtk_app_chooser_widget_new (self->priv->content_type);
gtk_widget_set_vexpand (self->priv->app_chooser_widget, TRUE); gtk_widget_set_vexpand (self->priv->app_chooser_widget, TRUE);
gtk_box_pack_start (GTK_BOX (self->priv->inner_box), self->priv->app_chooser_widget); gtk_container_add (GTK_CONTAINER (self->priv->inner_box), self->priv->app_chooser_widget);
g_signal_connect (self->priv->app_chooser_widget, "application-selected", g_signal_connect (self->priv->app_chooser_widget, "application-selected",
@ -351,10 +351,10 @@ construct_appchooser_widget (GtkAppChooserDialog *self)
G_CALLBACK (widget_populate_popup_cb), self); G_CALLBACK (widget_populate_popup_cb), self);
/* Add the custom button to the new appchooser */ /* Add the custom button to the new appchooser */
gtk_box_pack_start (GTK_BOX (self->priv->inner_box), gtk_container_add (GTK_CONTAINER (self->priv->inner_box),
self->priv->show_more_button); self->priv->show_more_button);
gtk_box_pack_start (GTK_BOX (self->priv->inner_box), gtk_container_add (GTK_CONTAINER (self->priv->inner_box),
self->priv->software_button); self->priv->software_button);
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget)); info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));

View File

@ -1686,14 +1686,14 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
priv->pages = g_list_insert (priv->pages, page_info, position); priv->pages = g_list_insert (priv->pages, page_info, position);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->regular_title); gtk_container_add (GTK_CONTAINER (priv->sidebar), page_info->regular_title);
gtk_box_pack_start (GTK_BOX (priv->sidebar), page_info->current_title); gtk_container_add (GTK_CONTAINER (priv->sidebar), page_info->current_title);
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position); gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position);
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1); gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (box); gtk_widget_show (box);
gtk_box_pack_start (GTK_BOX (box), page); gtk_container_add (GTK_CONTAINER (box), page);
g_object_set (box, "margin", 12, NULL); g_object_set (box, "margin", 12, NULL);
g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant); g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
@ -1792,7 +1792,7 @@ add_to_action_area (GtkAssistant *assistant,
gtk_widget_set_valign (child, GTK_ALIGN_BASELINE); gtk_widget_set_valign (child, GTK_ALIGN_BASELINE);
gtk_box_pack_end (GTK_BOX (priv->action_area), child); gtk_container_add (GTK_CONTAINER (priv->action_area), child);
} }
/** /**

View File

@ -118,13 +118,6 @@ static void gtk_button_box_get_child_property (GtkContainer *container,
G_DEFINE_TYPE_WITH_PRIVATE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX) G_DEFINE_TYPE_WITH_PRIVATE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
static void
gtk_button_box_add (GtkContainer *container,
GtkWidget *widget)
{
gtk_box_pack_start (GTK_BOX (container), widget);
}
static void static void
gtk_button_box_class_init (GtkButtonBoxClass *class) gtk_button_box_class_init (GtkButtonBoxClass *class)
{ {
@ -143,7 +136,6 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
widget_class->size_allocate = gtk_button_box_size_allocate; widget_class->size_allocate = gtk_button_box_size_allocate;
container_class->remove = gtk_button_box_remove; container_class->remove = gtk_button_box_remove;
container_class->add = gtk_button_box_add;
container_class->set_child_property = gtk_button_box_set_child_property; container_class->set_child_property = gtk_button_box_set_child_property;
container_class->get_child_property = gtk_button_box_get_child_property; container_class->get_child_property = gtk_button_box_get_child_property;

View File

@ -531,14 +531,14 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
add_default_palette (cc); add_default_palette (cc);
cc->priv->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (box, "margin-top", 12, NULL);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), box);
/* translators: label for the custom section in the color chooser */ /* translators: label for the custom section in the color chooser */
cc->priv->custom_label = label = gtk_label_new (_("Custom")); cc->priv->custom_label = label = gtk_label_new (_("Custom"));
gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_box_pack_end (GTK_BOX (cc->priv->palette), label); gtk_container_add (GTK_CONTAINER (cc->priv->palette), label);
cc->priv->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (box, "margin-top", 12, NULL);
gtk_container_add (GTK_CONTAINER (cc->priv->palette), box);
cc->priv->button = button = gtk_color_swatch_new (); cc->priv->button = button = gtk_color_swatch_new ();
gtk_widget_set_name (button, "add-color-button"); gtk_widget_set_name (button, "add-color-button");

View File

@ -1286,12 +1286,12 @@ gtk_container_destroy (GtkWidget *widget)
* *
* Adds @widget to @container. Typically used for simple containers * Adds @widget to @container. Typically used for simple containers
* such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated * such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated
* layout containers such as #GtkBox or #GtkGrid, this function will * layout containers such #GtkGrid, this function will
* pick default packing parameters that may not be correct. So * pick default packing parameters that may not be correct. So
* consider functions such as gtk_box_pack_start() and * consider functions such as gtk_grid_attach() as an alternative
* gtk_grid_attach() as an alternative to gtk_container_add() in * to gtk_container_add() in those cases. A widget may be added to
* those cases. A widget may be added to only one container at a time; * only one container at a time; you cant place the same widget
* you cant place the same widget inside two different containers. * inside two different containers.
* *
* Note that some containers, such as #GtkScrolledWindow or #GtkListBox, * Note that some containers, such as #GtkScrolledWindow or #GtkListBox,
* may add intermediate children between the added widget and the * may add intermediate children between the added widget and the

View File

@ -553,7 +553,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
else else
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 1); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 1);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_widget_show (button); gtk_widget_show (button);
data->spin_button = button; data->spin_button = button;
@ -567,7 +567,7 @@ new_unit_widget (GtkCustomPaperUnixDialog *dialog,
label = gtk_label_new (_("mm")); label = gtk_label_new (_("mm"));
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_widget_show (label); gtk_widget_show (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (mnemonic_label), button); gtk_label_set_mnemonic_widget (GTK_LABEL (mnemonic_label), button);
@ -977,13 +977,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text); g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget); gtk_container_add (GTK_CONTAINER (frame), label_widget);
gtk_widget_set_margin_start (child, 12); gtk_widget_set_margin_start (child, 12);
gtk_widget_set_halign (child, GTK_ALIGN_FILL); gtk_widget_set_halign (child, GTK_ALIGN_FILL);
gtk_widget_set_valign (child, GTK_ALIGN_FILL); gtk_widget_set_valign (child, GTK_ALIGN_FILL);
gtk_box_pack_start (GTK_BOX (frame), child); gtk_container_add (GTK_CONTAINER (frame), child);
gtk_widget_show (frame); gtk_widget_show (frame);
@ -1034,11 +1034,11 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
gtk_box_pack_start (GTK_BOX (content_area), hbox); gtk_container_add (GTK_CONTAINER (content_area), hbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_widget_show (vbox); gtk_widget_show (vbox);
scrolled = gtk_scrolled_window_new (NULL, NULL); scrolled = gtk_scrolled_window_new (NULL, NULL);
@ -1046,7 +1046,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), scrolled); gtk_container_add (GTK_CONTAINER (vbox), scrolled);
gtk_widget_show (scrolled); gtk_widget_show (scrolled);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->custom_paper_list)); treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (priv->custom_paper_list));
@ -1076,7 +1076,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
context = gtk_widget_get_style_context (toolbar); context = gtk_widget_get_style_context (toolbar);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR); gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
gtk_box_pack_start (GTK_BOX (vbox), toolbar); gtk_container_add (GTK_CONTAINER (vbox), toolbar);
gtk_widget_show (toolbar); gtk_widget_show (toolbar);
icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic"); icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic");
@ -1095,7 +1095,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
priv->values_box = vbox; priv->values_box = vbox;
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_widget_show (vbox); gtk_widget_show (vbox);
grid = gtk_grid_new (); grid = gtk_grid_new ();
@ -1127,7 +1127,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
frame = wrap_in_frame (_("Paper Size"), grid); frame = wrap_in_frame (_("Paper Size"), grid);
gtk_widget_show (grid); gtk_widget_show (grid);
gtk_box_pack_start (GTK_BOX (vbox), frame); gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_show (frame); gtk_widget_show (frame);
grid = gtk_grid_new (); grid = gtk_grid_new ();
@ -1200,7 +1200,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
NULL, NULL); NULL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_box_pack_start (GTK_BOX (hbox), combo); gtk_container_add (GTK_CONTAINER (hbox), combo);
gtk_widget_show (combo); gtk_widget_show (combo);
g_signal_connect_swapped (combo, "changed", g_signal_connect_swapped (combo, "changed",
@ -1208,7 +1208,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
frame = wrap_in_frame (_("Paper Margins"), grid); frame = wrap_in_frame (_("Paper Margins"), grid);
gtk_widget_show (grid); gtk_widget_show (grid);
gtk_box_pack_start (GTK_BOX (vbox), frame); gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_show (frame); gtk_widget_show (frame);
update_custom_widgets_from_list (dialog); update_custom_widgets_from_list (dialog);

View File

@ -514,13 +514,13 @@ add_emoji (GtkWidget *list,
gtk_widget_set_focus_on_click (child, FALSE); gtk_widget_set_focus_on_click (child, FALSE);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (child), box); gtk_container_add (GTK_CONTAINER (child), box);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
g_object_set_data (G_OBJECT (child), "base", label); g_object_set_data (G_OBJECT (child), "base", label);
stack = gtk_stack_new (); stack = gtk_stack_new ();
gtk_stack_set_homogeneous (GTK_STACK (stack), TRUE); gtk_stack_set_homogeneous (GTK_STACK (stack), TRUE);
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT); gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT);
gtk_box_pack_start (GTK_BOX (box), stack); gtk_container_add (GTK_CONTAINER (box), stack);
g_object_set_data (G_OBJECT (child), "stack", stack); g_object_set_data (G_OBJECT (child), "stack", stack);
g_variant_get_child (emoji_data, 2, "&s", &shortname); g_variant_get_child (emoji_data, 2, "&s", &shortname);

View File

@ -1219,7 +1219,7 @@ gtk_entry_completion_insert_action (GtkEntryCompletion *completion,
path, NULL, FALSE); path, NULL, FALSE);
gtk_tree_path_free (path); gtk_tree_path_free (path);
gtk_box_pack_start (GTK_BOX (completion->priv->vbox), gtk_container_add (GTK_CONTAINER (completion->priv->vbox),
completion->priv->action_view); completion->priv->action_view);
gtk_widget_show (completion->priv->action_view); gtk_widget_show (completion->priv->action_view);
} }

View File

@ -916,7 +916,7 @@ update_preview_widget_visibility (GtkFileChooserWidget *impl)
if (!priv->preview_label) if (!priv->preview_label)
{ {
priv->preview_label = gtk_label_new (priv->preview_display_name); priv->preview_label = gtk_label_new (priv->preview_display_name);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_label); gtk_container_add (GTK_CONTAINER (priv->preview_box), priv->preview_label);
gtk_box_reorder_child (GTK_BOX (priv->preview_box), priv->preview_label, 0); gtk_box_reorder_child (GTK_BOX (priv->preview_box), priv->preview_label, 0);
gtk_label_set_ellipsize (GTK_LABEL (priv->preview_label), PANGO_ELLIPSIZE_MIDDLE); gtk_label_set_ellipsize (GTK_LABEL (priv->preview_label), PANGO_ELLIPSIZE_MIDDLE);
gtk_widget_show (priv->preview_label); gtk_widget_show (priv->preview_label);
@ -957,7 +957,7 @@ set_preview_widget (GtkFileChooserWidget *impl,
if (priv->preview_widget) if (priv->preview_widget)
{ {
gtk_widget_show (priv->preview_widget); gtk_widget_show (priv->preview_widget);
gtk_box_pack_start (GTK_BOX (priv->preview_box), priv->preview_widget); gtk_container_add (GTK_CONTAINER (priv->preview_box), priv->preview_widget);
gtk_box_reorder_child (GTK_BOX (priv->preview_box), gtk_box_reorder_child (GTK_BOX (priv->preview_box),
priv->preview_widget, priv->preview_widget,
(priv->use_preview_label && priv->preview_label) ? 1 : 0); (priv->use_preview_label && priv->preview_label) ? 1 : 0);
@ -2587,7 +2587,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
gtk_style_context_add_class (gtk_widget_get_style_context (vbox), "search-bar"); gtk_style_context_add_class (gtk_widget_get_style_context (vbox), "search-bar");
priv->save_widgets_table = gtk_grid_new (); priv->save_widgets_table = gtk_grid_new ();
gtk_box_pack_start (GTK_BOX (vbox), priv->save_widgets_table); gtk_container_add (GTK_CONTAINER (vbox), priv->save_widgets_table);
gtk_grid_set_row_spacing (GTK_GRID (priv->save_widgets_table), 12); gtk_grid_set_row_spacing (GTK_GRID (priv->save_widgets_table), 12);
gtk_grid_set_column_spacing (GTK_GRID (priv->save_widgets_table), 12); gtk_grid_set_column_spacing (GTK_GRID (priv->save_widgets_table), 12);
@ -2607,7 +2607,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), priv->location_entry); gtk_label_set_mnemonic_widget (GTK_LABEL (widget), priv->location_entry);
priv->save_widgets = vbox; priv->save_widgets = vbox;
gtk_box_pack_start (GTK_BOX (priv->box), priv->save_widgets); gtk_container_add (GTK_CONTAINER (priv->box), priv->save_widgets);
gtk_box_reorder_child (GTK_BOX (priv->box), priv->save_widgets, 0); gtk_box_reorder_child (GTK_BOX (priv->box), priv->save_widgets, 0);
gtk_widget_show (priv->save_widgets); gtk_widget_show (priv->save_widgets);
} }
@ -2675,7 +2675,7 @@ location_switch_to_filename_entry (GtkFileChooserWidget *impl)
if (!priv->location_entry) if (!priv->location_entry)
{ {
location_entry_create (impl); location_entry_create (impl);
gtk_box_pack_start (GTK_BOX (priv->location_entry_box), priv->location_entry); gtk_container_add (GTK_CONTAINER (priv->location_entry_box), priv->location_entry);
} }
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->current_folder); _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->current_folder);

View File

@ -152,7 +152,7 @@ init_sizing_box (GtkHeaderBar *bar)
w = gtk_label_new (NULL); w = gtk_label_new (NULL);
context = gtk_widget_get_style_context (w); context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE); gtk_style_context_add_class (context, GTK_STYLE_CLASS_TITLE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w); gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
gtk_label_set_line_wrap (GTK_LABEL (w), FALSE); gtk_label_set_line_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END);
@ -161,7 +161,7 @@ init_sizing_box (GtkHeaderBar *bar)
w = gtk_label_new (NULL); w = gtk_label_new (NULL);
context = gtk_widget_get_style_context (w); context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE); gtk_style_context_add_class (context, GTK_STYLE_CLASS_SUBTITLE);
gtk_box_pack_start (GTK_BOX (priv->label_sizing_box), w); gtk_container_add (GTK_CONTAINER (priv->label_sizing_box), w);
gtk_label_set_line_wrap (GTK_LABEL (w), FALSE); gtk_label_set_line_wrap (GTK_LABEL (w), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (w), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (w), PANGO_ELLIPSIZE_END);
@ -189,7 +189,7 @@ create_title_box (const char *title,
gtk_label_set_line_wrap (GTK_LABEL (title_label), FALSE); gtk_label_set_line_wrap (GTK_LABEL (title_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (title_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (title_label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (label_box), title_label); gtk_container_add (GTK_CONTAINER (label_box), title_label);
gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS); gtk_label_set_width_chars (GTK_LABEL (title_label), MIN_TITLE_CHARS);
subtitle_label = gtk_label_new (subtitle); subtitle_label = gtk_label_new (subtitle);
@ -198,7 +198,7 @@ create_title_box (const char *title,
gtk_label_set_line_wrap (GTK_LABEL (subtitle_label), FALSE); gtk_label_set_line_wrap (GTK_LABEL (subtitle_label), FALSE);
gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE); gtk_label_set_single_line_mode (GTK_LABEL (subtitle_label), TRUE);
gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (subtitle_label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (label_box), subtitle_label); gtk_container_add (GTK_CONTAINER (label_box), subtitle_label);
gtk_widget_set_visible (subtitle_label, subtitle && subtitle[0]); gtk_widget_set_visible (subtitle_label, subtitle && subtitle[0]);
if (ret_title_label) if (ret_title_label)
@ -453,7 +453,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
if (button) if (button)
{ {
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
n_children ++; n_children ++;
} }
} }
@ -468,7 +468,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
continue; continue;
} }
gtk_box_pack_start (GTK_BOX (box), separator); gtk_container_add (GTK_CONTAINER (box), separator);
if (i == 1) if (i == 1)
gtk_box_reorder_child (GTK_BOX (box), separator, 0); gtk_box_reorder_child (GTK_BOX (box), separator, 0);

View File

@ -490,6 +490,7 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar,
ad = get_response_data (child, TRUE); ad = get_response_data (child, TRUE);
G_DEBUG_HERE();
ad->response_id = response_id; ad->response_id = response_id;
if (GTK_IS_BUTTON (child)) if (GTK_IS_BUTTON (child))
@ -508,7 +509,7 @@ gtk_info_bar_add_action_widget (GtkInfoBar *info_bar,
else else
g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkInfoBar"); g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkInfoBar");
gtk_box_pack_end (GTK_BOX (priv->action_area), child); gtk_container_add (GTK_CONTAINER (priv->action_area), child);
if (response_id == GTK_RESPONSE_HELP) if (response_id == GTK_RESPONSE_HELP)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (priv->action_area), gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (priv->action_area),
child, TRUE); child, TRUE);

View File

@ -134,7 +134,10 @@ gtk_menu_section_box_sync_separators (GtkMenuSectionBox *box,
return; return;
if (should_have_separator) if (should_have_separator)
gtk_box_pack_start (GTK_BOX (box), box->separator); {
gtk_container_add (GTK_CONTAINER (box), box->separator);
gtk_box_reorder_child (GTK_BOX (box), box->separator, 0);
}
else else
gtk_container_remove (GTK_CONTAINER (box), box->separator); gtk_container_remove (GTK_CONTAINER (box), box->separator);
} }
@ -346,7 +349,7 @@ gtk_menu_section_box_init (GtkMenuSectionBox *box)
item_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); item_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
box->item_box = GTK_BOX (item_box); box->item_box = GTK_BOX (item_box);
gtk_box_pack_end (GTK_BOX (box), item_box); gtk_container_add (GTK_CONTAINER (box), item_box);
gtk_widget_set_halign (GTK_WIDGET (item_box), GTK_ALIGN_FILL); gtk_widget_set_halign (GTK_WIDGET (item_box), GTK_ALIGN_FILL);
gtk_widget_set_halign (GTK_WIDGET (box), GTK_ALIGN_FILL); gtk_widget_set_halign (GTK_WIDGET (box), GTK_ALIGN_FILL);
@ -454,7 +457,8 @@ gtk_menu_section_box_new_submenu (GtkMenuTrackerItem *item,
g_object_set_data (G_OBJECT (button), "focus", focus); g_object_set_data (G_OBJECT (button), "focus", focus);
g_object_set_data (G_OBJECT (focus), "focus", button); g_object_set_data (G_OBJECT (focus), "focus", button);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_box_reorder_child (GTK_BOX (box), button, 0);
g_signal_connect (focus, "clicked", G_CALLBACK (open_submenu), item); g_signal_connect (focus, "clicked", G_CALLBACK (open_submenu), item);
g_signal_connect (button, "clicked", G_CALLBACK (close_submenu), item); g_signal_connect (button, "clicked", G_CALLBACK (close_submenu), item);
@ -515,17 +519,17 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_valign (separator, GTK_ALIGN_CENTER); gtk_widget_set_valign (separator, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box->separator), separator); gtk_container_add (GTK_CONTAINER (box->separator), separator);
title = gtk_label_new (label); title = gtk_label_new (label);
g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE); g_object_bind_property (item, "label", title, "label", G_BINDING_SYNC_CREATE);
gtk_style_context_add_class (gtk_widget_get_style_context (title), GTK_STYLE_CLASS_SEPARATOR); gtk_style_context_add_class (gtk_widget_get_style_context (title), GTK_STYLE_CLASS_SEPARATOR);
gtk_widget_set_halign (title, GTK_ALIGN_START); gtk_widget_set_halign (title, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (box->separator), title); gtk_container_add (GTK_CONTAINER (box->separator), title);
separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_valign (separator, GTK_ALIGN_CENTER); gtk_widget_set_valign (separator, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box->separator), separator); gtk_container_add (GTK_CONTAINER (box->separator), separator);
} }
else else
{ {

View File

@ -140,7 +140,7 @@ gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button)
g_object_ref (priv->arrow_button); g_object_ref (priv->arrow_button);
gtk_container_remove (GTK_CONTAINER (parent), gtk_container_remove (GTK_CONTAINER (parent),
priv->arrow_button); priv->arrow_button);
gtk_box_pack_end (GTK_BOX (box), priv->arrow_button); gtk_container_add (GTK_CONTAINER (box), priv->arrow_button);
g_object_unref (priv->arrow_button); g_object_unref (priv->arrow_button);
} }
@ -284,7 +284,7 @@ gtk_menu_tool_button_init (GtkMenuToolButton *button)
g_object_unref (real_button); g_object_unref (real_button);
arrow_button = gtk_menu_button_new (); arrow_button = gtk_menu_button_new ();
gtk_box_pack_end (GTK_BOX (box), arrow_button); gtk_container_add (GTK_CONTAINER (box), arrow_button);
/* the arrow button is insentive until we set a menu */ /* the arrow button is insentive until we set a menu */
gtk_widget_set_sensitive (arrow_button, FALSE); gtk_widget_set_sensitive (arrow_button, FALSE);

View File

@ -548,17 +548,17 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
/* Build contents */ /* Build contents */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), hbox); gtk_container_add (GTK_CONTAINER (content_area), hbox);
icon = gtk_image_new_from_icon_name ("dialog-password"); icon = gtk_image_new_from_icon_name ("dialog-password");
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE); gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
gtk_widget_set_halign (icon, GTK_ALIGN_CENTER); gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (icon, GTK_ALIGN_START); gtk_widget_set_valign (icon, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (hbox), icon); gtk_container_add (GTK_CONTAINER (hbox), icon);
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_box_pack_start (GTK_BOX (hbox), main_vbox); gtk_container_add (GTK_CONTAINER (hbox), main_vbox);
secondary = strstr (message, "\n"); secondary = strstr (message, "\n");
if (secondary != NULL) if (secondary != NULL)
@ -574,7 +574,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label)); gtk_container_add (GTK_CONTAINER (main_vbox), GTK_WIDGET (label));
g_free (primary); g_free (primary);
attrs = pango_attr_list_new (); attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
@ -587,7 +587,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (label)); gtk_container_add (GTK_CONTAINER (main_vbox), GTK_WIDGET (label));
} }
grid = gtk_grid_new (); grid = gtk_grid_new ();
@ -595,7 +595,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_grid_set_row_spacing (GTK_GRID (grid), 12); gtk_grid_set_row_spacing (GTK_GRID (grid), 12);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_widget_set_margin_bottom (grid, 12); gtk_widget_set_margin_bottom (grid, 12);
gtk_box_pack_start (GTK_BOX (main_vbox), grid); gtk_container_add (GTK_CONTAINER (main_vbox), grid);
can_anonymous = priv->ask_flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED; can_anonymous = priv->ask_flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED;
@ -618,7 +618,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
gtk_grid_attach (GTK_GRID (grid), anon_box, 1, rows++, 1, 1); gtk_grid_attach (GTK_GRID (grid), anon_box, 1, rows++, 1, 1);
choice = gtk_radio_button_new_with_mnemonic (NULL, _("_Anonymous")); choice = gtk_radio_button_new_with_mnemonic (NULL, _("_Anonymous"));
gtk_box_pack_start (GTK_BOX (anon_box), gtk_container_add (GTK_CONTAINER (anon_box),
choice); choice);
g_signal_connect (choice, "toggled", g_signal_connect (choice, "toggled",
G_CALLBACK (pw_dialog_anonymous_toggled), operation); G_CALLBACK (pw_dialog_anonymous_toggled), operation);
@ -626,7 +626,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Registered U_ser")); choice = gtk_radio_button_new_with_mnemonic (group, _("Registered U_ser"));
gtk_box_pack_start (GTK_BOX (anon_box), gtk_container_add (GTK_CONTAINER (anon_box),
choice); choice);
g_signal_connect (choice, "toggled", g_signal_connect (choice, "toggled",
G_CALLBACK (pw_dialog_anonymous_toggled), operation); G_CALLBACK (pw_dialog_anonymous_toggled), operation);
@ -675,7 +675,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER)); GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER));
g_signal_connect (choice, "toggled", g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation); G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice); gtk_container_add (GTK_CONTAINER (remember_box), choice);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Remember password until you _logout")); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember password until you _logout"));
@ -685,7 +685,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION)); GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION));
g_signal_connect (choice, "toggled", g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation); G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice); gtk_container_add (GTK_CONTAINER (remember_box), choice);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
choice = gtk_radio_button_new_with_mnemonic (group, _("Remember _forever")); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember _forever"));
@ -695,7 +695,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY)); GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY));
g_signal_connect (choice, "toggled", g_signal_connect (choice, "toggled",
G_CALLBACK (remember_button_toggled), operation); G_CALLBACK (remember_button_toggled), operation);
gtk_box_pack_start (GTK_BOX (remember_box), choice); gtk_container_add (GTK_CONTAINER (remember_box), choice);
} }
g_signal_connect (G_OBJECT (dialog), "response", g_signal_connect (G_OBJECT (dialog), "response",
@ -1403,7 +1403,7 @@ create_show_processes_dialog (GtkMountOperation *op,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), vbox); gtk_container_add (GTK_CONTAINER (content_area), vbox);
if (secondary != NULL) if (secondary != NULL)
s = g_strdup_printf ("<big><b>%s</b></big>\n\n%s", primary, secondary); s = g_strdup_printf ("<big><b>%s</b></big>\n\n%s", primary, secondary);
@ -1414,7 +1414,7 @@ create_show_processes_dialog (GtkMountOperation *op,
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), s); gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s); g_free (s);
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
/* First count the items in the list then /* First count the items in the list then
* add the buttons in reverse order * add the buttons in reverse order
@ -1464,7 +1464,7 @@ create_show_processes_dialog (GtkMountOperation *op,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view); gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
g_signal_connect (tree_view, "popup-menu", g_signal_connect (tree_view, "popup-menu",
G_CALLBACK (on_popup_menu_for_process_tree_view), G_CALLBACK (on_popup_menu_for_process_tree_view),

View File

@ -1362,8 +1362,8 @@ make_directory_button (GtkPathBar *path_bar,
button_data->image = gtk_image_new (); button_data->image = gtk_image_new ();
button_data->label = gtk_label_new (NULL); button_data->label = gtk_label_new (NULL);
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (child), button_data->image); gtk_container_add (GTK_CONTAINER (child), button_data->image);
gtk_box_pack_start (GTK_BOX (child), button_data->label); gtk_container_add (GTK_CONTAINER (child), button_data->label);
break; break;
case NORMAL_BUTTON: case NORMAL_BUTTON:
default: default:

View File

@ -684,12 +684,12 @@ request_password (GtkPrintBackend *backend,
/* Packing */ /* Packing */
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_pack_start (GTK_BOX (content_area), main_box); gtk_container_add (GTK_CONTAINER (content_area), main_box);
gtk_box_pack_start (GTK_BOX (main_box), icon); gtk_container_add (GTK_CONTAINER (main_box), icon);
gtk_box_pack_start (GTK_BOX (main_box), vbox); gtk_container_add (GTK_CONTAINER (main_box), vbox);
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
/* Right - 2. */ /* Right - 2. */
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
@ -715,10 +715,10 @@ request_password (GtkPrintBackend *backend,
gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]); gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), box); gtk_container_add (GTK_CONTAINER (vbox), box);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_pack_start (GTK_BOX (box), entry); gtk_container_add (GTK_CONTAINER (box), entry);
g_signal_connect (entry, "changed", g_signal_connect (entry, "changed",
G_CALLBACK (store_entry), &(priv->auth_info[i])); G_CALLBACK (store_entry), &(priv->auth_info[i]));
@ -731,7 +731,7 @@ request_password (GtkPrintBackend *backend,
gtk_widget_set_margin_top (chkbtn, 6); gtk_widget_set_margin_top (chkbtn, 6);
gtk_widget_set_margin_bottom (chkbtn, 6); gtk_widget_set_margin_bottom (chkbtn, 6);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbtn), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chkbtn), FALSE);
gtk_box_pack_start (GTK_BOX (vbox), chkbtn); gtk_container_add (GTK_CONTAINER (vbox), chkbtn);
g_signal_connect (chkbtn, "toggled", g_signal_connect (chkbtn, "toggled",
G_CALLBACK (store_auth_info_toggled), G_CALLBACK (store_auth_info_toggled),
&(priv->store_auth_info)); &(priv->store_auth_info));

View File

@ -745,7 +745,7 @@ alternative_append (GtkWidget *box,
button = gtk_radio_button_new_with_label (group, label); button = gtk_radio_button_new_with_label (group, label);
gtk_widget_show (button); gtk_widget_show (button);
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE); gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
g_object_set_data (G_OBJECT (button), "value", (gpointer)value); g_object_set_data (G_OBJECT (button), "value", (gpointer)value);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
@ -776,7 +776,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), 0);
gtk_widget_set_sensitive (GTK_WIDGET (widget), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (widget), FALSE);
gtk_widget_show (priv->combo); gtk_widget_show (priv->combo);
gtk_box_pack_start (GTK_BOX (widget), priv->combo); gtk_container_add (GTK_CONTAINER (widget), priv->combo);
} }
else switch (source->type) else switch (source->type)
{ {
@ -784,7 +784,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->check = gtk_check_button_new_with_mnemonic (source->display_text); priv->check = gtk_check_button_new_with_mnemonic (source->display_text);
g_signal_connect (priv->check, "toggled", G_CALLBACK (check_toggled_cb), widget); g_signal_connect (priv->check, "toggled", G_CALLBACK (check_toggled_cb), widget);
gtk_widget_show (priv->check); gtk_widget_show (priv->check);
gtk_box_pack_start (GTK_BOX (widget), priv->check); gtk_container_add (GTK_CONTAINER (widget), priv->check);
break; break;
case GTK_PRINTER_OPTION_TYPE_PICKONE: case GTK_PRINTER_OPTION_TYPE_PICKONE:
case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD: case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD:
@ -816,7 +816,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
source->choices_display[i], source->choices_display[i],
source->choices[i]); source->choices[i]);
gtk_widget_show (priv->combo); gtk_widget_show (priv->combo);
gtk_box_pack_start (GTK_BOX (widget), priv->combo); gtk_container_add (GTK_CONTAINER (widget), priv->combo);
g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget); g_signal_connect (priv->combo, "changed", G_CALLBACK (combo_changed_cb), widget);
text = g_strdup_printf ("%s:", source->display_text); text = g_strdup_printf ("%s:", source->display_text);
@ -830,7 +830,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_valign (priv->box, GTK_ALIGN_BASELINE); gtk_widget_set_valign (priv->box, GTK_ALIGN_BASELINE);
gtk_widget_show (priv->box); gtk_widget_show (priv->box);
gtk_box_pack_start (GTK_BOX (widget), priv->box); gtk_container_add (GTK_CONTAINER (widget), priv->box);
for (i = 0; i < source->num_choices; i++) for (i = 0; i < source->num_choices; i++)
{ {
group = alternative_append (priv->box, group = alternative_append (priv->box,
@ -858,7 +858,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
gtk_entry_set_activates_default (GTK_ENTRY (priv->entry), gtk_entry_set_activates_default (GTK_ENTRY (priv->entry),
gtk_printer_option_get_activates_default (source)); gtk_printer_option_get_activates_default (source));
gtk_widget_show (priv->entry); gtk_widget_show (priv->entry);
gtk_box_pack_start (GTK_BOX (widget), priv->entry); gtk_container_add (GTK_CONTAINER (widget), priv->entry);
g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget); g_signal_connect (priv->entry, "changed", G_CALLBACK (entry_changed_cb), widget);
text = g_strdup_printf ("%s:", source->display_text); text = g_strdup_printf ("%s:", source->display_text);
@ -871,7 +871,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
case GTK_PRINTER_OPTION_TYPE_FILESAVE: case GTK_PRINTER_OPTION_TYPE_FILESAVE:
priv->button = gtk_button_new (); priv->button = gtk_button_new ();
gtk_widget_show (priv->button); gtk_widget_show (priv->button);
gtk_box_pack_start (GTK_BOX (widget), priv->button); gtk_container_add (GTK_CONTAINER (widget), priv->button);
g_signal_connect (priv->button, "clicked", G_CALLBACK (filesave_choose_cb), widget); g_signal_connect (priv->button, "clicked", G_CALLBACK (filesave_choose_cb), widget);
text = g_strdup_printf ("%s:", source->display_text); text = g_strdup_printf ("%s:", source->display_text);
@ -884,7 +884,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
case GTK_PRINTER_OPTION_TYPE_INFO: case GTK_PRINTER_OPTION_TYPE_INFO:
priv->info_label = gtk_label_new (NULL); priv->info_label = gtk_label_new (NULL);
gtk_label_set_selectable (GTK_LABEL (priv->info_label), TRUE); gtk_label_set_selectable (GTK_LABEL (priv->info_label), TRUE);
gtk_box_pack_start (GTK_BOX (widget), priv->info_label); gtk_container_add (GTK_CONTAINER (widget), priv->info_label);
text = g_strdup_printf ("%s:", source->display_text); text = g_strdup_printf ("%s:", source->display_text);
priv->label = gtk_label_new_with_mnemonic (text); priv->label = gtk_label_new_with_mnemonic (text);
@ -897,7 +897,7 @@ construct_widgets (GtkPrinterOptionWidget *widget)
} }
priv->image = gtk_image_new_from_icon_name ("dialog-warning"); priv->image = gtk_image_new_from_icon_name ("dialog-warning");
gtk_box_pack_start (GTK_BOX (widget), priv->image); gtk_container_add (GTK_CONTAINER (widget), priv->image);
} }
/* /*

View File

@ -1295,13 +1295,13 @@ wrap_in_frame (const gchar *label,
g_free (bold_text); g_free (bold_text);
frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget); gtk_container_add (GTK_CONTAINER (frame), label_widget);
gtk_widget_set_margin_start (child, 12); gtk_widget_set_margin_start (child, 12);
gtk_widget_set_halign (child, GTK_ALIGN_FILL); gtk_widget_set_halign (child, GTK_ALIGN_FILL);
gtk_widget_set_valign (child, GTK_ALIGN_FILL); gtk_widget_set_valign (child, GTK_ALIGN_FILL);
gtk_box_pack_start (GTK_BOX (frame), child); gtk_container_add (GTK_CONTAINER (frame), child);
gtk_widget_show (frame); gtk_widget_show (frame);
@ -1346,14 +1346,14 @@ add_option_to_extension_point (GtkPrinterOption *option,
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE); gtk_widget_set_valign (hbox, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_widget_show (hbox); gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (extension_point), hbox); gtk_container_add (GTK_CONTAINER (extension_point), hbox);
} }
else else
gtk_box_pack_start (GTK_BOX (extension_point), widget); gtk_container_add (GTK_CONTAINER (extension_point), widget);
} }
static gint static gint
@ -1631,7 +1631,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
gtk_widget_show (table); gtk_widget_show (table);
gtk_widget_show (frame); gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (priv->advanced_vbox), gtk_container_add (GTK_CONTAINER (priv->advanced_vbox),
frame); frame);
} }
} }

View File

@ -113,8 +113,8 @@
* "Im the second radio button."); * "Im the second radio button.");
* *
* // Pack them into a box, then show all the widgets * // Pack them into a box, then show all the widgets
* gtk_box_pack_start (GTK_BOX (box), radio1); * gtk_container_add (GTK_CONTAINER (box), radio1);
* gtk_box_pack_start (GTK_BOX (box), radio2); * gtk_container_add (GTK_CONTAINER (box), radio2);
* gtk_container_add (GTK_CONTAINER (window), box); * gtk_container_add (GTK_CONTAINER (window), box);
* gtk_widget_show (window); * gtk_widget_show (window);
* return; * return;

View File

@ -503,9 +503,11 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
else else
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,0);
if (icon) if (icon)
gtk_box_pack_start (GTK_BOX (box), icon); gtk_container_add (GTK_CONTAINER (box), icon);
gtk_box_pack_end (GTK_BOX (box), label);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (button->priv->button), box); gtk_container_add (GTK_CONTAINER (button->priv->button), box);
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button"); gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button"); gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
@ -517,24 +519,24 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
if (icon) if (icon)
{ {
gtk_box_pack_start (GTK_BOX (box), icon); gtk_container_add (GTK_CONTAINER (box), icon);
if (!label) if (!label)
gtk_widget_set_hexpand (icon, TRUE); gtk_widget_set_hexpand (icon, TRUE);
} }
if (label) if (label)
gtk_box_pack_end (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
} }
else else
{ {
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
if (icon) if (icon)
{ {
gtk_box_pack_end (GTK_BOX (box), icon); gtk_container_add (GTK_CONTAINER (box), icon);
if (!label) if (!label)
gtk_widget_set_vexpand (icon, TRUE); gtk_widget_set_vexpand (icon, TRUE);
} }
if (label) if (label)
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
} }
gtk_container_add (GTK_CONTAINER (button->priv->button), box); gtk_container_add (GTK_CONTAINER (button->priv->button), box);
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button"); gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");

View File

@ -859,13 +859,13 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
if (priv->xalign <= 0.5) if (priv->xalign <= 0.5)
{ {
gtk_box_pack_start (GTK_BOX (hbox), priv->frame); gtk_container_add (GTK_CONTAINER (hbox), priv->frame);
gtk_box_pack_start (GTK_BOX (hbox), priv->arrow); gtk_container_add (GTK_CONTAINER (hbox), priv->arrow);
} }
else else
{ {
gtk_box_pack_start (GTK_BOX (hbox), priv->arrow); gtk_container_add (GTK_CONTAINER (hbox), priv->arrow);
gtk_box_pack_start (GTK_BOX (hbox), priv->frame); gtk_container_add (GTK_CONTAINER (hbox), priv->frame);
} }
gtk_container_add (GTK_CONTAINER (priv->frame), child); gtk_container_add (GTK_CONTAINER (priv->frame), child);

View File

@ -168,13 +168,13 @@ add_check_row (GtkInspectorGeneral *gen,
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
check = gtk_image_new_from_icon_name ("object-select-symbolic"); check = gtk_image_new_from_icon_name ("object-select-symbolic");
gtk_widget_set_halign (check, GTK_ALIGN_END); gtk_widget_set_halign (check, GTK_ALIGN_END);
gtk_widget_set_valign (check, GTK_ALIGN_BASELINE); gtk_widget_set_valign (check, GTK_ALIGN_BASELINE);
gtk_widget_set_opacity (check, value ? 1.0 : 0.0); gtk_widget_set_opacity (check, value ? 1.0 : 0.0);
gtk_box_pack_start (GTK_BOX (box), check); gtk_container_add (GTK_CONTAINER (box), check);
row = gtk_list_box_row_new (); row = gtk_list_box_row_new ();
gtk_container_add (GTK_CONTAINER (row), box); gtk_container_add (GTK_CONTAINER (row), box);
@ -208,14 +208,14 @@ add_label_row (GtkInspectorGeneral *gen,
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
label = gtk_label_new (value); label = gtk_label_new (value);
gtk_label_set_selectable (GTK_LABEL (label), TRUE); gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_END); gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_label_set_xalign (GTK_LABEL (label), 1.0); gtk_label_set_xalign (GTK_LABEL (label), 1.0);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
row = gtk_list_box_row_new (); row = gtk_list_box_row_new ();
gtk_container_add (GTK_CONTAINER (row), box); gtk_container_add (GTK_CONTAINER (row), box);

View File

@ -938,7 +938,7 @@ property_editor (GObject *object,
first = b; first = b;
g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j)); g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
gtk_widget_show (b); gtk_widget_show (b);
gtk_box_pack_start (GTK_BOX (box), b); gtk_container_add (GTK_CONTAINER (box), b);
connect_controller (G_OBJECT (b), "toggled", connect_controller (G_OBJECT (b), "toggled",
object, spec, G_CALLBACK (enum_modified)); object, spec, G_CALLBACK (enum_modified));
++j; ++j;
@ -980,7 +980,7 @@ property_editor (GObject *object,
b = gtk_check_button_new_with_label (fclass->values[j].value_name); b = gtk_check_button_new_with_label (fclass->values[j].value_name);
g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j)); g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
gtk_widget_show (b); gtk_widget_show (b);
gtk_box_pack_start (GTK_BOX (box), b); gtk_container_add (GTK_CONTAINER (box), b);
connect_controller (G_OBJECT (b), "toggled", connect_controller (G_OBJECT (b), "toggled",
object, spec, G_CALLBACK (flags_modified)); object, spec, G_CALLBACK (flags_modified));
} }
@ -1603,9 +1603,8 @@ add_gtk_settings_info (GtkInspectorPropEditor *editor)
g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_setting), editor); g_signal_connect_swapped (button, "clicked", G_CALLBACK (reset_setting), editor);
gtk_widget_set_halign (button, GTK_ALIGN_END); gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_show (button);
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
gtk_box_pack_end (GTK_BOX (row), button); gtk_container_add (GTK_CONTAINER (row), button);
switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name)) switch (_gtk_settings_get_setting_source (GTK_SETTINGS (object), name))
{ {

View File

@ -1065,7 +1065,7 @@ gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (widget), hbox); gtk_container_add (GTK_CONTAINER (widget), hbox);
for (i = 0; i < g_list_model_get_n_items (priv->recordings); i++) for (i = 0; i < g_list_model_get_n_items (priv->recordings); i++)
{ {
@ -1106,17 +1106,17 @@ gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
label = gtk_label_new (str); label = gtk_label_new (str);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
g_free (str); g_free (str);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
button = gtk_toggle_button_new (); button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_icon_name (GTK_BUTTON (button), "view-more-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (button), "view-more-symbolic");
gtk_box_pack_end (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
label = gtk_label_new (gtk_inspector_render_recording_get_profiler_info (GTK_INSPECTOR_RENDER_RECORDING (recording))); label = gtk_label_new (gtk_inspector_render_recording_get_profiler_info (GTK_INSPECTOR_RENDER_RECORDING (recording)));
gtk_widget_hide (label); gtk_widget_hide (label);
gtk_box_pack_end (GTK_BOX (widget), label); gtk_container_add (GTK_CONTAINER (widget), label);
g_object_bind_property (button, "active", label, "visible", 0); g_object_bind_property (button, "active", label, "visible", 0);
} }
else else

View File

@ -236,7 +236,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
g_object_set (label, "margin", 10, NULL); g_object_set (label, "margin", 10, NULL);
gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_box_pack_start (GTK_BOX (box2), label); gtk_container_add (GTK_CONTAINER (box2), label);
combo = gtk_combo_box_text_new (); combo = gtk_combo_box_text_new ();
g_object_set (combo, "margin", 10, NULL); g_object_set (combo, "margin", 10, NULL);
@ -249,7 +249,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
g_object_bind_property (group, "mode", g_object_bind_property (group, "mode",
combo, "active", combo, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_box_pack_start (GTK_BOX (box2), combo); gtk_container_add (GTK_CONTAINER (box2), combo);
listbox = gtk_list_box_new (); listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (box), listbox); gtk_container_add (GTK_CONTAINER (box), listbox);

View File

@ -68,17 +68,17 @@ add_string (GtkInspectorStrvEditor *editor,
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), str); gtk_entry_set_text (GTK_ENTRY (entry), str);
gtk_widget_show (entry); gtk_widget_show (entry);
gtk_box_pack_start (GTK_BOX (box), entry); gtk_container_add (GTK_CONTAINER (box), entry);
g_object_set_data (G_OBJECT (box), "entry", entry); g_object_set_data (G_OBJECT (box), "entry", entry);
g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor); g_signal_connect_swapped (entry, "notify::text", G_CALLBACK (emit_changed), editor);
button = gtk_button_new_from_icon_name ("user-trash-symbolic"); button = gtk_button_new_from_icon_name ("user-trash-symbolic");
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button"); gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
gtk_widget_show (button); gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor); g_signal_connect (button, "clicked", G_CALLBACK (remove_string), editor);
gtk_box_pack_start (GTK_BOX (editor->box), box); gtk_container_add (GTK_CONTAINER (editor->box), box);
gtk_widget_grab_focus (entry); gtk_widget_grab_focus (entry);
@ -107,8 +107,8 @@ gtk_inspector_strv_editor_init (GtkInspectorStrvEditor *editor)
gtk_widget_show (editor->button); gtk_widget_show (editor->button);
g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor); g_signal_connect (editor->button, "clicked", G_CALLBACK (add_cb), editor);
gtk_box_pack_start (GTK_BOX (editor), editor->box); gtk_container_add (GTK_CONTAINER (editor), editor->box);
gtk_box_pack_start (GTK_BOX (editor), editor->button); gtk_container_add (GTK_CONTAINER (editor), editor->button);
} }
static void static void

View File

@ -174,37 +174,40 @@ main (int argc, char *argv[])
gtk_widget_show (hbox); gtk_widget_show (hbox);
fps_label = gtk_label_new (""); fps_label = gtk_label_new ("");
gtk_widget_set_hexpand (fps_label, TRUE);
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (hbox), fps_label); gtk_container_add (GTK_CONTAINER (hbox), fps_label);
gtk_widget_show (fps_label);
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label)); gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
spinner = gtk_spinner_new ();
gtk_box_pack_end (GTK_BOX (hbox), spinner);
gtk_widget_show (spinner);
gtk_spinner_start (GTK_SPINNER (spinner));
check = gtk_check_button_new_with_label ("Animate spinner");
gtk_box_pack_end (GTK_BOX (hbox), check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
g_signal_connect (check, "toggled",
G_CALLBACK (toggle_spin), spinner);
check = gtk_check_button_new_with_label ("Overlay");
gtk_box_pack_end (GTK_BOX (hbox), check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
gtk_widget_show (check);
g_signal_connect (check, "toggled",
G_CALLBACK (toggle_overlay), revealer);
button = gtk_menu_button_new (); button = gtk_menu_button_new ();
gtk_menu_button_set_direction (GTK_MENU_BUTTON (button), GTK_ARROW_UP); gtk_menu_button_set_direction (GTK_MENU_BUTTON (button), GTK_ARROW_UP);
popover = gtk_popover_new (NULL); popover = gtk_popover_new (NULL);
label = gtk_label_new ("Popovers work too!"); label = gtk_label_new ("Popovers work too!");
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (popover), label); gtk_container_add (GTK_CONTAINER (popover), label);
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover); gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover);
gtk_widget_show (button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_end (GTK_BOX (hbox), button);
check = gtk_check_button_new_with_label ("Overlay");
gtk_container_add (GTK_CONTAINER (hbox), check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
g_signal_connect (check, "toggled",
G_CALLBACK (toggle_overlay), revealer);
check = gtk_check_button_new_with_label ("Animate spinner");
gtk_container_add (GTK_CONTAINER (hbox), check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
spinner = gtk_spinner_new ();
gtk_container_add (GTK_CONTAINER (hbox), spinner);
gtk_spinner_start (GTK_SPINNER (spinner));
g_signal_connect (check, "toggled",
G_CALLBACK (toggle_spin), spinner);
scrolled = gtk_scrolled_window_new (NULL, NULL); scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),

View File

@ -52,18 +52,18 @@ main (int argc, char **argv)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
adjustment = gtk_adjustment_new (20, 0, 200, 1, 10, 0);
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_box_pack_end (GTK_BOX (vbox), scale);
label = gtk_label_new ("Event processing time (ms):");
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_box_pack_end (GTK_BOX (vbox), label);
da = gtk_drawing_area_new (); da = gtk_drawing_area_new ();
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), on_draw, NULL, NULL);
gtk_widget_set_vexpand (da, TRUE); gtk_widget_set_vexpand (da, TRUE);
gtk_box_pack_end (GTK_BOX (vbox), da); gtk_container_add (GTK_CONTAINER (vbox), da);
label = gtk_label_new ("Event processing time (ms):");
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), label);
adjustment = gtk_adjustment_new (20, 0, 200, 1, 10, 0);
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_container_add (GTK_CONTAINER (vbox), scale);
controller = gtk_event_controller_motion_new (); controller = gtk_event_controller_motion_new ();
g_signal_connect (controller, "motion", g_signal_connect (controller, "motion",

View File

@ -65,7 +65,7 @@ main (int argc, char *argv[])
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (box), sw); gtk_container_add (GTK_CONTAINER (box), sw);
content = get_content (); content = get_content ();

View File

@ -321,15 +321,15 @@ create_custom_widget (GtkPrintOperation *operation,
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
label = gtk_label_new ("Font:"); label = gtk_label_new ("Font:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_widget_show (label); gtk_widget_show (label);
font = gtk_font_button_new_with_font (data->font); font = gtk_font_button_new_with_font (data->font);
gtk_box_pack_start (GTK_BOX (hbox), font); gtk_container_add (GTK_CONTAINER (hbox), font);
gtk_widget_show (font); gtk_widget_show (font);
data->font_button = font; data->font_button = font;

View File

@ -32,7 +32,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL); GTK_POLICY_EXTERNAL);
gtk_box_pack_start (GTK_BOX (box), sw); gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new (); tv = gtk_text_view_new ();
fill_text_view (tv, "Left"); fill_text_view (tv, "Left");
gtk_container_add (GTK_CONTAINER (sw), tv); gtk_container_add (GTK_CONTAINER (sw), tv);
@ -43,7 +43,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL); GTK_POLICY_EXTERNAL);
gtk_box_pack_start (GTK_BOX (box), sw); gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new (); tv = gtk_text_view_new ();
fill_text_view (tv, "Middle"); fill_text_view (tv, "Middle");
gtk_container_add (GTK_CONTAINER (sw), tv); gtk_container_add (GTK_CONTAINER (sw), tv);
@ -52,7 +52,7 @@ main (int argc, char *argv[])
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_EXTERNAL); GTK_POLICY_EXTERNAL);
gtk_box_pack_start (GTK_BOX (box), sw); gtk_container_add (GTK_CONTAINER (box), sw);
tv = gtk_text_view_new (); tv = gtk_text_view_new ();
fill_text_view (tv, "Right"); fill_text_view (tv, "Right");
gtk_container_add (GTK_CONTAINER (sw), tv); gtk_container_add (GTK_CONTAINER (sw), tv);

View File

@ -75,7 +75,7 @@ key_test (void)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_widget_show (box); gtk_widget_show (box);
gtk_container_add (GTK_CONTAINER (window), box); gtk_container_add (GTK_CONTAINER (window), box);
gtk_box_pack_start (GTK_BOX (box), sw); gtk_container_add (GTK_CONTAINER (box), sw);
store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT); store = gtk_list_store_new (3, G_TYPE_INT, G_TYPE_UINT, G_TYPE_UINT);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));

View File

@ -116,8 +116,9 @@ activate (GApplication *gapp)
"margin", 20, "margin", 20,
"row-spacing", 12, "row-spacing", 12,
"column-spacing", 12, "column-spacing", 12,
"vexpand", TRUE,
NULL); NULL);
gtk_box_pack_start (GTK_BOX (box), grid); gtk_container_add (GTK_CONTAINER (box), grid);
label = gtk_label_new ("Start"); label = gtk_label_new ("Start");
gtk_widget_set_halign (label, GTK_ALIGN_END); gtk_widget_set_halign (label, GTK_ALIGN_END);
@ -151,7 +152,7 @@ activate (GApplication *gapp)
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), check, 1, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 1, 3, 1, 1);
gtk_box_pack_end (GTK_BOX (box), bar); gtk_container_add (GTK_CONTAINER (box), bar);
gtk_container_add (GTK_CONTAINER (window), box); gtk_container_add (GTK_CONTAINER (window), box);
gtk_widget_show (window); gtk_widget_show (window);
} }

View File

@ -325,7 +325,7 @@ open_valigned_label_window (void)
label = gtk_label_new ("Both labels expand"); label = gtk_label_new ("Both labels expand");
gtk_widget_show (label); gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
label = gtk_label_new ("Some wrapping text with width-chars = 15 and max-width-chars = 35"); label = gtk_label_new ("Some wrapping text with width-chars = 15 and max-width-chars = 35");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
@ -341,7 +341,7 @@ open_valigned_label_window (void)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
gtk_window_present (GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window));
} }

View File

@ -74,22 +74,22 @@ main (int argc,
gtk_container_add (GTK_CONTAINER (toplevel), box); gtk_container_add (GTK_CONTAINER (toplevel), box);
button = gtk_app_chooser_button_new ("image/jpeg"); button = gtk_app_chooser_button_new ("image/jpeg");
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect (button, "changed", g_signal_connect (button, "changed",
G_CALLBACK (combo_changed_cb), NULL); G_CALLBACK (combo_changed_cb), NULL);
w = gtk_label_new (NULL); w = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (w), "<b>Selected app info</b>"); gtk_label_set_markup (GTK_LABEL (w), "<b>Selected app info</b>");
gtk_box_pack_start (GTK_BOX (box), w); gtk_container_add (GTK_CONTAINER (box), w);
w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (box), w); gtk_container_add (GTK_CONTAINER (box), w);
sel_image = gtk_image_new (); sel_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (w), sel_image); gtk_container_add (GTK_CONTAINER (w), sel_image);
sel_name = gtk_label_new (NULL); sel_name = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (w), sel_name); gtk_container_add (GTK_CONTAINER (w), sel_name);
gtk_app_chooser_button_set_heading (GTK_APP_CHOOSER_BUTTON (button), "Choose one, <i>not</i> two"); gtk_app_chooser_button_set_heading (GTK_APP_CHOOSER_BUTTON (button), "Choose one, <i>not</i> two");
gtk_app_chooser_button_append_separator (GTK_APP_CHOOSER_BUTTON (button)); gtk_app_chooser_button_append_separator (GTK_APP_CHOOSER_BUTTON (button));

View File

@ -377,13 +377,13 @@ create_nonlinear_assistant (GtkWidget *widget)
page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
button = gtk_radio_button_new_with_label (NULL, "branch A"); button = gtk_radio_button_new_with_label (NULL, "branch A");
gtk_box_pack_start (GTK_BOX (page), button); gtk_container_add (GTK_CONTAINER (page), button);
g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('A')); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('A'));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
button = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), button = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)),
"branch B"); "branch B");
gtk_box_pack_start (GTK_BOX (page), button); gtk_container_add (GTK_CONTAINER (page), button);
g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('B')); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (select_branch), GINT_TO_POINTER ('B'));
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page); gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
@ -648,7 +648,7 @@ create_page_flipping_assistant (GtkWidget *widget)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE); gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (page), gtk_container_add (GTK_CONTAINER (page),
get_test_page ("Page 2")); get_test_page ("Page 2"));
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page); gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2"); gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Page 2");
@ -718,7 +718,7 @@ main (int argc, gchar *argv[])
g_signal_connect (G_OBJECT (button), "clicked", g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (buttons[i].func), NULL); G_CALLBACK (buttons[i].func), NULL);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
} }
gtk_widget_show (window); gtk_widget_show (window);

View File

@ -100,7 +100,7 @@ main (int argc,
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
char *aligns_names[] = { "FILL", "BASELINE" }; char *aligns_names[] = { "FILL", "BASELINE" };
GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE}; GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE};
@ -140,7 +140,7 @@ main (int argc,
} }
grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
combo = gtk_combo_box_text_new (); combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]);
@ -152,7 +152,7 @@ main (int argc,
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_signal_connect (G_OBJECT (combo), "changed", g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (baseline_position_changed), hbox); G_CALLBACK (baseline_position_changed), hbox);
@ -225,7 +225,7 @@ main (int argc,
vbox, gtk_label_new ("grid")); vbox, gtk_label_new ("grid"));
grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Align me:"); label = gtk_label_new ("Align me:");
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE); gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
@ -292,7 +292,7 @@ main (int argc,
gtk_container_add (GTK_CONTAINER (hbox), grid); gtk_container_add (GTK_CONTAINER (hbox), grid);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
adjustment = gtk_adjustment_new (0.0, -1.0, 5.0, 1.0, 1.0, 0.0); adjustment = gtk_adjustment_new (0.0, -1.0, 5.0, 1.0, 1.0, 0.0);
spin = gtk_spin_button_new (adjustment, 1.0, 0); spin = gtk_spin_button_new (adjustment, 1.0, 0);
@ -317,7 +317,7 @@ main (int argc,
vbox, gtk_label_new ("button box")); vbox, gtk_label_new ("button box"));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
adjustment = gtk_adjustment_new (34.0, 1.0, 64.0, 1.0, 1.0, 0.0); adjustment = gtk_adjustment_new (34.0, 1.0, 64.0, 1.0, 1.0, 0.0);
spin = gtk_spin_button_new (adjustment, 1.0, 0); spin = gtk_spin_button_new (adjustment, 1.0, 0);
@ -330,7 +330,7 @@ main (int argc,
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_set_baseline_position (GTK_BOX (hbox), j); gtk_box_set_baseline_position (GTK_BOX (hbox), j);

View File

@ -129,7 +129,7 @@ main (int argc,
/* GtkHButtonBox */ /* GtkHButtonBox */
hbbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); hbbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox), hbbox); gtk_container_add (GTK_CONTAINER (vbox), hbbox);
for (i = 0; i < N_BUTTONS; i++) { for (i = 0; i < N_BUTTONS; i++) {
buttons[i] = gtk_button_new_with_label (strings[i]); buttons[i] = gtk_button_new_with_label (strings[i]);
@ -142,27 +142,27 @@ main (int argc,
/* GtkVButtonBox */ /* GtkVButtonBox */
vbbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); vbbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (vbox), vbbox); gtk_container_add (GTK_CONTAINER (vbox), vbbox);
/* Options */ /* Options */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
combo_types = gtk_combo_box_text_new (); combo_types = gtk_combo_box_text_new ();
populate_combo_with (GTK_COMBO_BOX_TEXT (combo_types), types); populate_combo_with (GTK_COMBO_BOX_TEXT (combo_types), types);
g_signal_connect (G_OBJECT (combo_types), "changed", G_CALLBACK (combo_types_changed_cb), buttons); g_signal_connect (G_OBJECT (combo_types), "changed", G_CALLBACK (combo_types_changed_cb), buttons);
gtk_box_pack_start (GTK_BOX (hbox), combo_types); gtk_container_add (GTK_CONTAINER (hbox), combo_types);
combo_styles = gtk_combo_box_text_new (); combo_styles = gtk_combo_box_text_new ();
populate_combo_with (GTK_COMBO_BOX_TEXT (combo_styles), styles); populate_combo_with (GTK_COMBO_BOX_TEXT (combo_styles), styles);
g_signal_connect (G_OBJECT (combo_styles), "changed", G_CALLBACK (combo_changed_cb), NULL); g_signal_connect (G_OBJECT (combo_styles), "changed", G_CALLBACK (combo_changed_cb), NULL);
gtk_box_pack_start (GTK_BOX (hbox), combo_styles); gtk_container_add (GTK_CONTAINER (hbox), combo_styles);
option = gtk_check_button_new_with_label ("Help is secondary"); option = gtk_check_button_new_with_label ("Help is secondary");
g_signal_connect (G_OBJECT (option), "toggled", G_CALLBACK (option_cb), buttons[N_BUTTONS - 1]); g_signal_connect (G_OBJECT (option), "toggled", G_CALLBACK (option_cb), buttons[N_BUTTONS - 1]);
gtk_box_pack_start (GTK_BOX (hbox), option); gtk_container_add (GTK_CONTAINER (hbox), option);
gtk_widget_show (window); gtk_widget_show (window);
gtk_widget_hide (vbbox); gtk_widget_hide (vbbox);

View File

@ -89,12 +89,12 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (box), test_widget ("1")); gtk_container_add (GTK_CONTAINER (box), test_widget ("1"));
gtk_box_pack_start (GTK_BOX (box), test_widget ("2")); gtk_container_add (GTK_CONTAINER (box), test_widget ("2"));
gtk_box_pack_start (GTK_BOX (box), test_widget ("3")); gtk_container_add (GTK_CONTAINER (box), test_widget ("3"));
gtk_box_pack_start (GTK_BOX (box), test_widget ("4")); gtk_container_add (GTK_CONTAINER (box), test_widget ("4"));
gtk_box_pack_end (GTK_BOX (box), test_widget ("5")); gtk_container_add (GTK_CONTAINER (box), test_widget ("5"));
gtk_box_pack_end (GTK_BOX (box), test_widget ("6")); gtk_container_add (GTK_CONTAINER (box), test_widget ("6"));
gtk_container_add (GTK_CONTAINER (vbox), box); gtk_container_add (GTK_CONTAINER (vbox), box);
@ -112,14 +112,14 @@ main (int argc, char *argv[])
gtk_widget_set_halign (b, GTK_ALIGN_CENTER); gtk_widget_set_halign (b, GTK_ALIGN_CENTER);
label = gtk_label_new ("Spacing:"); label = gtk_label_new ("Spacing:");
gtk_widget_set_halign (label, GTK_ALIGN_END); gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_box_pack_start (GTK_BOX (b), label); gtk_container_add (GTK_CONTAINER (b), label);
spin = gtk_spin_button_new_with_range (0, 10, 1); spin = gtk_spin_button_new_with_range (0, 10, 1);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE);
gtk_widget_set_halign (spin, GTK_ALIGN_START); gtk_widget_set_halign (spin, GTK_ALIGN_START);
g_signal_connect (spin, "value-changed", g_signal_connect (spin, "value-changed",
G_CALLBACK (spacing_changed), box); G_CALLBACK (spacing_changed), box);
gtk_box_pack_start (GTK_BOX (b), spin); gtk_container_add (GTK_CONTAINER (b), spin);
gtk_container_add (GTK_CONTAINER (vbox), b); gtk_container_add (GTK_CONTAINER (vbox), b);
gtk_widget_show (window); gtk_widget_show (window);

View File

@ -169,10 +169,10 @@ main (gint argc, gchar **argv)
toolbar = gtk_toolbar_new (); toolbar = gtk_toolbar_new ();
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_TEXT);
gtk_box_pack_start (GTK_BOX (main_box), toolbar); gtk_container_add (GTK_CONTAINER (main_box), toolbar);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (main_box), box); gtk_container_add (GTK_CONTAINER (main_box), box);
container = gtk_scrolled_window_new (NULL, NULL); container = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (container), 200); gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (container), 200);
@ -194,28 +194,30 @@ main (gint argc, gchar **argv)
gtk_text_view_get_buffer (GTK_TEXT_VIEW (child))); gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (main_box), container); gtk_container_add (GTK_CONTAINER (main_box), container);
child = gtk_switch_new (); child = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (child), gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR); gtk_switch_set_active (GTK_SWITCH (child), gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR);
g_signal_connect (child, g_signal_connect (child,
"notify::active", "notify::active",
G_CALLBACK (set_orientation), G_CALLBACK (set_orientation),
NULL); NULL);
gtk_box_pack_start (GTK_BOX (container), child); gtk_container_add (GTK_CONTAINER (container), child);
child = gtk_label_new ("left-to-right"); child = gtk_label_new ("left-to-right");
gtk_box_pack_start (GTK_BOX (container), child); gtk_widget_set_hexpand (child, TRUE);
child = gtk_button_new_with_label ("Add button"); gtk_widget_set_halign (child, GTK_ALIGN_START);
g_signal_connect_swapped (child, gtk_container_add (GTK_CONTAINER (container), child);
"clicked",
G_CALLBACK (add_button),
box);
gtk_box_pack_end (GTK_BOX (container), child);
child = gtk_button_new_with_label ("Add toolbutton"); child = gtk_button_new_with_label ("Add toolbutton");
g_signal_connect_swapped (child, g_signal_connect_swapped (child,
"clicked", "clicked",
G_CALLBACK (add_toolbutton), G_CALLBACK (add_toolbutton),
toolbar); toolbar);
gtk_box_pack_end (GTK_BOX (container), child); gtk_container_add (GTK_CONTAINER (container), child);
child = gtk_button_new_with_label ("Add button");
g_signal_connect_swapped (child,
"clicked",
G_CALLBACK (add_button),
box);
gtk_container_add (GTK_CONTAINER (container), child);
add_toolbutton (GTK_TOOLBAR (toolbar)); add_toolbutton (GTK_TOOLBAR (toolbar));
add_toolbutton (GTK_TOOLBAR (toolbar)); add_toolbutton (GTK_TOOLBAR (toolbar));

View File

@ -491,7 +491,7 @@ create_calendar(void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL);
frame = create_frame ("<b>Options</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); frame = create_frame ("<b>Options</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (rpane), frame); gtk_container_add (GTK_CONTAINER (rpane), frame);
size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
context = gtk_widget_get_style_context (calendar); context = gtk_widget_get_style_context (calendar);
@ -512,9 +512,9 @@ create_calendar(void)
gtk_size_group_add_widget (size, label); gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Build the width entry */ /* Build the width entry */
@ -533,9 +533,9 @@ create_calendar(void)
gtk_size_group_add_widget (size, label); gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Build the height entry */ /* Build the height entry */
@ -554,15 +554,15 @@ create_calendar(void)
gtk_size_group_add_widget (size, label); gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Build the right details frame */ /* Build the right details frame */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL);
frame = create_frame ("<b>Details</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_FILL); frame = create_frame ("<b>Details</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_FILL);
gtk_box_pack_start (GTK_BOX (rpane), frame); gtk_container_add (GTK_CONTAINER (rpane), frame);
details = gtk_text_view_new(); details = gtk_text_view_new();
calendar_data.details_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (details)); calendar_data.details_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (details));
@ -580,12 +580,12 @@ create_calendar(void)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), scroller); gtk_container_add (GTK_CONTAINER (vbox), scroller);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
gtk_widget_set_halign (hbox, GTK_ALIGN_START); gtk_widget_set_halign (hbox, GTK_ALIGN_START);
gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER); gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
button = gtk_button_new_with_mnemonic ("Demonstrate _Details"); button = gtk_button_new_with_mnemonic ("Demonstrate _Details");
@ -594,7 +594,7 @@ create_calendar(void)
G_CALLBACK (demonstrate_details), G_CALLBACK (demonstrate_details),
&calendar_data); &calendar_data);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
button = gtk_button_new_with_mnemonic ("_Reset Details"); button = gtk_button_new_with_mnemonic ("_Reset Details");
@ -603,24 +603,24 @@ create_calendar(void)
G_CALLBACK (reset_details), G_CALLBACK (reset_details),
&calendar_data); &calendar_data);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
toggle = gtk_check_button_new_with_mnemonic ("_Use Details"); toggle = gtk_check_button_new_with_mnemonic ("_Use Details");
g_signal_connect (toggle, "toggled", g_signal_connect (toggle, "toggled",
G_CALLBACK(calendar_toggle_details), G_CALLBACK(calendar_toggle_details),
&calendar_data); &calendar_data);
gtk_box_pack_start (GTK_BOX (vbox), toggle); gtk_container_add (GTK_CONTAINER (vbox), toggle);
/* Build the Right frame with the flags in */ /* Build the Right frame with the flags in */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
frame = create_expander ("<b>Flags</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); frame = create_expander ("<b>Flags</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (rpane), frame); gtk_container_add (GTK_CONTAINER (rpane), frame);
for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++) for (i = 0; i < G_N_ELEMENTS (calendar_data.settings); i++)
{ {
toggle = gtk_check_button_new_with_mnemonic(flags[i].label); toggle = gtk_check_button_new_with_mnemonic(flags[i].label);
gtk_box_pack_start (GTK_BOX (vbox), toggle); gtk_container_add (GTK_CONTAINER (vbox), toggle);
calendar_data.flag_checkboxes[i] = toggle; calendar_data.flag_checkboxes[i] = toggle;
g_signal_connect (toggle, "toggled", g_signal_connect (toggle, "toggled",
@ -639,25 +639,25 @@ create_calendar(void)
frame = create_frame ("<b>Signal Events</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER); frame = create_frame ("<b>Signal Events</b>", vbox, GTK_ALIGN_FILL, GTK_ALIGN_CENTER);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Signal:"); label = gtk_label_new ("Signal:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
calendar_data.last_sig = gtk_label_new (""); calendar_data.last_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig); gtk_container_add (GTK_CONTAINER (hbox), calendar_data.last_sig);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Previous signal:"); label = gtk_label_new ("Previous signal:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
calendar_data.prev_sig = gtk_label_new (""); calendar_data.prev_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig); gtk_container_add (GTK_CONTAINER (hbox), calendar_data.prev_sig);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Second previous signal:"); label = gtk_label_new ("Second previous signal:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
calendar_data.prev2_sig = gtk_label_new (""); calendar_data.prev2_sig = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig); gtk_container_add (GTK_CONTAINER (hbox), calendar_data.prev2_sig);
/* /*
* Glue everything together * Glue everything together
@ -672,11 +672,11 @@ create_calendar(void)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, DEF_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (vbox), hpaned); gtk_container_add (GTK_CONTAINER (vbox), hpaned);
gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
gtk_box_pack_start (GTK_BOX (vbox), frame); gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
gtk_box_pack_start (GTK_BOX (vbox), bbox); gtk_container_add (GTK_CONTAINER (vbox), bbox);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);

View File

@ -195,20 +195,18 @@ simple_cell_area (void)
gtk_container_add (GTK_CONTAINER (frame), iconview); gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_box_pack_end (GTK_BOX (hbox), frame);
/* Now add some controls */ /* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_pack_end (GTK_BOX (hbox), vbox);
gtk_container_add (GTK_CONTAINER (hbox), frame);
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (orientation_changed), iconview); G_CALLBACK (orientation_changed), iconview);
@ -216,7 +214,7 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Align 2nd Cell"); widget = gtk_check_button_new_with_label ("Align 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (align_cell_2_toggled), iconview); G_CALLBACK (align_cell_2_toggled), iconview);
@ -224,7 +222,7 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Align 3rd Cell"); widget = gtk_check_button_new_with_label ("Align 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (align_cell_3_toggled), iconview); G_CALLBACK (align_cell_3_toggled), iconview);
@ -233,7 +231,7 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 1st Cell"); widget = gtk_check_button_new_with_label ("Expand 1st Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_1_toggled), iconview); G_CALLBACK (expand_cell_1_toggled), iconview);
@ -241,7 +239,7 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 2nd Cell"); widget = gtk_check_button_new_with_label ("Expand 2nd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_2_toggled), iconview); G_CALLBACK (expand_cell_2_toggled), iconview);
@ -249,7 +247,7 @@ simple_cell_area (void)
widget = gtk_check_button_new_with_label ("Expand 3rd Cell"); widget = gtk_check_button_new_with_label ("Expand 3rd Cell");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (expand_cell_3_toggled), iconview); G_CALLBACK (expand_cell_3_toggled), iconview);
@ -441,19 +439,17 @@ focus_cell_area (void)
gtk_container_add (GTK_CONTAINER (frame), iconview); gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_box_pack_end (GTK_BOX (hbox), frame);
/* Now add some controls */ /* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_pack_end (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), frame);
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (orientation_changed), iconview); G_CALLBACK (orientation_changed), iconview);
@ -461,7 +457,7 @@ focus_cell_area (void)
widget = gtk_check_button_new_with_label ("Focus Sibling"); widget = gtk_check_button_new_with_label ("Focus Sibling");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (focus_sibling_toggled), iconview); G_CALLBACK (focus_sibling_toggled), iconview);
@ -530,8 +526,7 @@ background_area (void)
"prepended space distributed to the background area."); "prepended space distributed to the background area.");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_width_chars (GTK_LABEL (label), 40); gtk_label_set_width_chars (GTK_LABEL (label), 40);
gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (main_vbox), label);
gtk_box_pack_start (GTK_BOX (main_vbox), label);
iconview = focus_iconview (TRUE, NULL, NULL); iconview = focus_iconview (TRUE, NULL, NULL);
@ -543,20 +538,20 @@ background_area (void)
gtk_container_add (GTK_CONTAINER (frame), iconview); gtk_container_add (GTK_CONTAINER (frame), iconview);
gtk_box_pack_end (GTK_BOX (hbox), frame);
/* Now add some controls */ /* Now add some controls */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
gtk_box_pack_end (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), frame);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox);
gtk_container_add (GTK_CONTAINER (main_vbox), hbox);
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (vbox), widget); gtk_container_add (GTK_CONTAINER (vbox), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (orientation_changed), iconview); G_CALLBACK (orientation_changed), iconview);
@ -565,9 +560,9 @@ background_area (void)
label = gtk_label_new ("Cell spacing"); label = gtk_label_new ("Cell spacing");
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_signal_connect (G_OBJECT (widget), "value-changed", g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (cell_spacing_changed), iconview); G_CALLBACK (cell_spacing_changed), iconview);
@ -578,9 +573,9 @@ background_area (void)
label = gtk_label_new ("Row spacing"); label = gtk_label_new ("Row spacing");
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_signal_connect (G_OBJECT (widget), "value-changed", g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (row_spacing_changed), iconview); G_CALLBACK (row_spacing_changed), iconview);
@ -590,9 +585,9 @@ background_area (void)
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), gtk_icon_view_get_item_padding (GTK_ICON_VIEW (iconview))); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), gtk_icon_view_get_item_padding (GTK_ICON_VIEW (iconview)));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_signal_connect (G_OBJECT (widget), "value-changed", g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (item_padding_changed), iconview); G_CALLBACK (item_padding_changed), iconview);

View File

@ -266,20 +266,20 @@ main (int argc, char **argv)
/* LTR */ /* LTR */
label = gtk_label_new ("Left to right"); label = gtk_label_new ("Left to right");
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
tree = create_tree (FALSE); tree = create_tree (FALSE);
gtk_widget_set_vexpand (tree, TRUE); gtk_widget_set_vexpand (tree, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), tree); gtk_container_add (GTK_CONTAINER (vbox), tree);
/* RTL */ /* RTL */
label = gtk_label_new ("Right to left"); label = gtk_label_new ("Right to left");
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
tree = create_tree (TRUE); tree = create_tree (TRUE);
gtk_widget_set_vexpand (tree, TRUE); gtk_widget_set_vexpand (tree, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), tree); gtk_container_add (GTK_CONTAINER (vbox), tree);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();

View File

@ -1075,7 +1075,7 @@ main (int argc, char **argv)
/* GtkCellView */ /* GtkCellView */
tmp = gtk_frame_new ("GtkCellView"); tmp = gtk_frame_new ("GtkCellView");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1096,7 +1096,7 @@ main (int argc, char **argv)
/* GtkComboBox list */ /* GtkComboBox list */
tmp = gtk_frame_new ("GtkComboBox (list)"); tmp = gtk_frame_new ("GtkComboBox (list)");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1136,7 +1136,7 @@ main (int argc, char **argv)
/* GtkComboBox dynamic list */ /* GtkComboBox dynamic list */
tmp = gtk_frame_new ("GtkComboBox (dynamic list)"); tmp = gtk_frame_new ("GtkComboBox (dynamic list)");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1179,7 +1179,7 @@ main (int argc, char **argv)
/* GtkComboBox custom entry */ /* GtkComboBox custom entry */
tmp = gtk_frame_new ("GtkComboBox (custom)"); tmp = gtk_frame_new ("GtkComboBox (custom)");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1233,7 +1233,7 @@ main (int argc, char **argv)
/* GtkComboBox tree */ /* GtkComboBox tree */
tmp = gtk_frame_new ("GtkComboBox (tree)"); tmp = gtk_frame_new ("GtkComboBox (tree)");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1276,18 +1276,18 @@ main (int argc, char **argv)
/* GtkComboBox (grid mode) */ /* GtkComboBox (grid mode) */
tmp = gtk_frame_new ("GtkComboBox (grid mode)"); tmp = gtk_frame_new ("GtkComboBox (grid mode)");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
comboboxgrid = create_combo_box_grid_demo (); comboboxgrid = create_combo_box_grid_demo ();
gtk_box_pack_start (GTK_BOX (boom), comboboxgrid); gtk_container_add (GTK_CONTAINER (boom), comboboxgrid);
/* GtkComboBoxEntry */ /* GtkComboBoxEntry */
tmp = gtk_frame_new ("GtkComboBox with entry"); tmp = gtk_frame_new ("GtkComboBox with entry");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1299,7 +1299,7 @@ main (int argc, char **argv)
/* Phylogenetic tree */ /* Phylogenetic tree */
tmp = gtk_frame_new ("What are you ?"); tmp = gtk_frame_new ("What are you ?");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1321,7 +1321,7 @@ main (int argc, char **argv)
/* Capitals */ /* Capitals */
tmp = gtk_frame_new ("Where are you ?"); tmp = gtk_frame_new ("Where are you ?");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1352,7 +1352,7 @@ main (int argc, char **argv)
/* Aligned Food */ /* Aligned Food */
tmp = gtk_frame_new ("Hungry ?"); tmp = gtk_frame_new ("Hungry ?");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1386,7 +1386,7 @@ main (int argc, char **argv)
/* Ellipsizing growing combos */ /* Ellipsizing growing combos */
tmp = gtk_frame_new ("Unconstrained Menu"); tmp = gtk_frame_new ("Unconstrained Menu");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); boom = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (tmp), boom); gtk_container_add (GTK_CONTAINER (tmp), boom);
@ -1405,7 +1405,7 @@ main (int argc, char **argv)
gtk_combo_box_set_popup_fixed_width (GTK_COMBO_BOX (combobox), FALSE); gtk_combo_box_set_popup_fixed_width (GTK_COMBO_BOX (combobox), FALSE);
tmp = gtk_frame_new ("Looong"); tmp = gtk_frame_new ("Looong");
gtk_box_pack_start (GTK_BOX (mainbox), tmp); gtk_container_add (GTK_CONTAINER (mainbox), tmp);
combobox = gtk_combo_box_text_new (); combobox = gtk_combo_box_text_new ();
for (i = 0; i < 200; i++) for (i = 0; i < 200; i++)
{ {

View File

@ -247,30 +247,30 @@ main (int argc, char **argv)
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (content_area), hbox); gtk_container_add (GTK_CONTAINER (content_area), hbox);
combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (hbox), combo_vbox); gtk_container_add (GTK_CONTAINER (hbox), combo_vbox);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<b>Menu mode</b>"); gtk_label_set_markup (GTK_LABEL (label), "<b>Menu mode</b>");
gtk_box_pack_start (GTK_BOX (combo_vbox), label); gtk_container_add (GTK_CONTAINER (combo_vbox), label);
menu_combo = create_combo ("menu-combo", FALSE); menu_combo = create_combo ("menu-combo", FALSE);
gtk_widget_set_margin_start (menu_combo, 12); gtk_widget_set_margin_start (menu_combo, 12);
gtk_box_pack_start (GTK_BOX (combo_vbox), menu_combo); gtk_container_add (GTK_CONTAINER (combo_vbox), menu_combo);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "<b>List mode</b>"); gtk_label_set_markup (GTK_LABEL (label), "<b>List mode</b>");
gtk_box_pack_start (GTK_BOX (combo_vbox), label); gtk_container_add (GTK_CONTAINER (combo_vbox), label);
list_combo = create_combo ("list-combo", TRUE); list_combo = create_combo ("list-combo", TRUE);
gtk_widget_set_margin_start (list_combo, 12); gtk_widget_set_margin_start (list_combo, 12);
gtk_box_pack_start (GTK_BOX (combo_vbox), list_combo); gtk_container_add (GTK_CONTAINER (combo_vbox), list_combo);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled_window, TRUE); gtk_widget_set_hexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_window); gtk_container_add (GTK_CONTAINER (hbox), scrolled_window);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@ -281,24 +281,24 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (hbox), button_vbox); gtk_container_add (GTK_CONTAINER (hbox), button_vbox);
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300); gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
button = gtk_button_new_with_label ("Insert"); button = gtk_button_new_with_label ("Insert");
gtk_box_pack_start (GTK_BOX (button_vbox), button); gtk_container_add (GTK_CONTAINER (button_vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (on_insert), NULL); g_signal_connect (button, "clicked", G_CALLBACK (on_insert), NULL);
button = gtk_button_new_with_label ("Delete"); button = gtk_button_new_with_label ("Delete");
gtk_box_pack_start (GTK_BOX (button_vbox), button); gtk_container_add (GTK_CONTAINER (button_vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (on_delete), NULL); g_signal_connect (button, "clicked", G_CALLBACK (on_delete), NULL);
button = gtk_button_new_with_label ("Reorder"); button = gtk_button_new_with_label ("Reorder");
gtk_box_pack_start (GTK_BOX (button_vbox), button); gtk_container_add (GTK_CONTAINER (button_vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (on_reorder), NULL); g_signal_connect (button, "clicked", G_CALLBACK (on_reorder), NULL);
button = gtk_button_new_with_label ("Animate"); button = gtk_button_new_with_label ("Animate");
gtk_box_pack_start (GTK_BOX (button_vbox), button); gtk_container_add (GTK_CONTAINER (button_vbox), button);
g_signal_connect (button, "clicked", G_CALLBACK (on_animate), NULL); g_signal_connect (button, "clicked", G_CALLBACK (on_animate), NULL);
gtk_widget_show (dialog); gtk_widget_show (dialog);

View File

@ -131,9 +131,9 @@ main (int argc, char *argv[])
gtk_widget_set_vexpand (overlay, TRUE); gtk_widget_set_vexpand (overlay, TRUE);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_box_pack_start (GTK_BOX (vbox), combo); gtk_container_add (GTK_CONTAINER (vbox), combo);
gtk_box_pack_start (GTK_BOX (vbox), scale); gtk_container_add (GTK_CONTAINER (vbox), scale);
gtk_box_pack_start (GTK_BOX (vbox), overlay); gtk_container_add (GTK_CONTAINER (vbox), overlay);
g_object_set_data (G_OBJECT (label), "combo", combo); g_object_set_data (G_OBJECT (label), "combo", combo);

View File

@ -307,7 +307,7 @@ main (int argc, char *argv[])
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example."); gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
/* Create our first entry */ /* Create our first entry */
entry = gtk_entry_new (); entry = gtk_entry_new ();
@ -392,7 +392,7 @@ main (int argc, char *argv[])
g_timeout_add (1000, (GSourceFunc) animation_timer, completion); g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
/* Fourth entry */ /* Fourth entry */
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion")); gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Model-less entry completion"));
entry = gtk_entry_new (); entry = gtk_entry_new ();

View File

@ -53,24 +53,22 @@ create_box_window (void)
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
box3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (box1), gtk_container_add (GTK_CONTAINER (box1),
gtk_label_new ("VBox 1 Top")); gtk_label_new ("VBox 1 Top"));
gtk_box_pack_start (GTK_BOX (box1), gtk_container_add (GTK_CONTAINER (box1),
box2); box2);
gtk_box_pack_end (GTK_BOX (box1), gtk_container_add (GTK_CONTAINER(box1),
gtk_label_new ("VBox 1 Bottom")); gtk_label_new ("VBox 1 Bottom"));
gtk_box_pack_start (GTK_BOX (box2), gtk_container_add (GTK_CONTAINER (box2),
gtk_label_new ("HBox 2 Left")); gtk_label_new ("HBox 2 Left"));
gtk_box_pack_start (GTK_BOX (box2), gtk_container_add (GTK_CONTAINER (box2),
box3); box3);
gtk_box_pack_end (GTK_BOX (box2), gtk_container_add (GTK_CONTAINER(box2),
gtk_label_new ("HBox 2 Right")); gtk_label_new ("HBox 2 Right"));
gtk_box_pack_start (GTK_BOX (box3), gtk_container_add (GTK_CONTAINER (box3),
gtk_label_new ("VBox 3 Top")); gtk_label_new ("VBox 3 Top"));
gtk_box_pack_end (GTK_BOX (box3),
gtk_label_new ("VBox 3 Bottom"));
colorbox = gtk_frame_new (NULL); colorbox = gtk_frame_new (NULL);
@ -82,7 +80,7 @@ create_box_window (void)
G_CALLBACK (on_toggle_hexpand), NULL); G_CALLBACK (on_toggle_hexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle); gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_box_pack_start (GTK_BOX (box3), colorbox); gtk_container_add (GTK_CONTAINER (box3), colorbox);
colorbox = gtk_frame_new (NULL); colorbox = gtk_frame_new (NULL);
@ -93,7 +91,9 @@ create_box_window (void)
g_signal_connect (G_OBJECT (toggle), "toggled", g_signal_connect (G_OBJECT (toggle), "toggled",
G_CALLBACK (on_toggle_vexpand), NULL); G_CALLBACK (on_toggle_vexpand), NULL);
gtk_container_add (GTK_CONTAINER (colorbox), toggle); gtk_container_add (GTK_CONTAINER (colorbox), toggle);
gtk_box_pack_start (GTK_BOX (box3), colorbox); gtk_container_add (GTK_CONTAINER (box3), colorbox);
gtk_container_add (GTK_CONTAINER (box3),
gtk_label_new ("VBox 3 Bottom"));
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (window); gtk_widget_show (window);

View File

@ -9,8 +9,6 @@ expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog)
static void static void
do_not_expand (GtkWidget *child, gpointer data) do_not_expand (GtkWidget *child, gpointer data)
{ {
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child,
"expand", FALSE, "fill", FALSE, NULL);
} }
static void static void
@ -24,7 +22,6 @@ main (int argc, char *argv[])
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *area; GtkWidget *area;
GtkWidget *box;
GtkWidget *expander; GtkWidget *expander;
GtkWidget *sw; GtkWidget *sw;
GtkWidget *tv; GtkWidget *tv;
@ -43,10 +40,6 @@ main (int argc, char *argv[])
"but not the full story."); "but not the full story.");
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog)); area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
/* make the hbox expand */
box = gtk_widget_get_parent (area);
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
"expand", TRUE, "fill", TRUE, NULL);
/* make the labels not expand */ /* make the labels not expand */
gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL); gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL);
@ -74,7 +67,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (expander), sw); gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_widget_set_hexpand (expander, TRUE); gtk_widget_set_hexpand (expander, TRUE);
gtk_widget_set_vexpand (expander, TRUE); gtk_widget_set_vexpand (expander, TRUE);
gtk_box_pack_end (GTK_BOX (area), expander); gtk_container_add (GTK_CONTAINER (area), expander);
g_signal_connect (expander, "notify::expanded", g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), dialog); G_CALLBACK (expander_cb), dialog);

View File

@ -663,11 +663,11 @@ main (int argc, char **argv)
gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog), preview_vbox); gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog), preview_vbox);
preview_label = gtk_label_new (NULL); preview_label = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (preview_vbox), preview_label, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (preview_vbox), preview_label, TRUE, TRUE, 0);
g_object_set (preview_label, "margin", 6, NULL); g_object_set (preview_label, "margin", 6, NULL);
preview_image = gtk_image_new (); preview_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (preview_vbox), preview_image, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (preview_vbox), preview_image, TRUE, TRUE, 0);
g_object_set (preview_image, "margin", 6, NULL); g_object_set (preview_image, "margin", 6, NULL);
update_preview_cb (GTK_FILE_CHOOSER (dialog)); update_preview_cb (GTK_FILE_CHOOSER (dialog));

View File

@ -124,25 +124,25 @@ tests_button_clicked_cb (GtkButton *real_button,
button = gtk_button_new_with_label ("Print Selected Path"); button = gtk_button_new_with_label ("Print Selected Path");
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (print_selected_path_clicked_cb), user_data); G_CALLBACK (print_selected_path_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_show (button); gtk_widget_show (button);
button = gtk_button_new_with_label ("Add $PWD's Parent as Shortcut"); button = gtk_button_new_with_label ("Add $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (add_pwds_parent_as_shortcut_clicked_cb), user_data); G_CALLBACK (add_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_show (button); gtk_widget_show (button);
button = gtk_button_new_with_label ("Remove $PWD's Parent as Shortcut"); button = gtk_button_new_with_label ("Remove $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (del_pwds_parent_as_shortcut_clicked_cb), user_data); G_CALLBACK (del_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_show (button); gtk_widget_show (button);
button = gtk_button_new_with_label ("Unselect all"); button = gtk_button_new_with_label ("Unselect all");
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (unselect_all_clicked_cb), user_data); G_CALLBACK (unselect_all_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
gtk_widget_show (button); gtk_widget_show (button);
g_object_set_data (user_data, "tests-dialog", tests); g_object_set_data (user_data, "tests-dialog", tests);
@ -216,12 +216,12 @@ add_new_filechooser_button (const gchar *mnemonic,
GtkWidget *hbox, *label, *chooser, *button; GtkWidget *hbox, *label, *chooser, *button;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (group_box), hbox); gtk_container_add (GTK_CONTAINER (group_box), hbox);
label = gtk_label_new_with_mnemonic (mnemonic); label = gtk_label_new_with_mnemonic (mnemonic);
gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label); gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label);
gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
chooser = gtk_file_chooser_button_new (g_strconcat(chooser_title, chooser = gtk_file_chooser_button_new (g_strconcat(chooser_title,
" - testfilechooserbutton", NULL), " - testfilechooserbutton", NULL),
@ -235,11 +235,11 @@ add_new_filechooser_button (const gchar *mnemonic,
g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL); g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL);
g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL); g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL);
g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL); g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL);
gtk_box_pack_start (GTK_BOX (hbox), chooser); gtk_container_add (GTK_CONTAINER (hbox), chooser);
button = gtk_button_new_with_label ("Tests"); button = gtk_button_new_with_label ("Tests");
g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser); g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
} }
@ -278,7 +278,7 @@ main (int argc,
frame = gtk_frame_new ("<b>GtkFileChooserButton</b>"); frame = gtk_frame_new ("<b>GtkFileChooserButton</b>");
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
gtk_label_set_use_markup (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (frame))), TRUE); gtk_label_set_use_markup (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (frame))), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame); gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_set_halign (frame, GTK_ALIGN_FILL); gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
gtk_widget_set_valign (frame, GTK_ALIGN_FILL); gtk_widget_set_valign (frame, GTK_ALIGN_FILL);

View File

@ -386,7 +386,7 @@ create_window (void)
gtk_widget_show (vbox); gtk_widget_show (vbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (window), hbox); gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
swindow = gtk_scrolled_window_new (NULL, NULL); swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (swindow, TRUE); gtk_widget_set_hexpand (swindow, TRUE);
@ -394,7 +394,7 @@ create_window (void)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (swindow); gtk_widget_show (swindow);
gtk_box_pack_start (GTK_BOX (hbox), swindow); gtk_container_add (GTK_CONTAINER (hbox), swindow);
flowbox = gtk_flow_box_new (); flowbox = gtk_flow_box_new ();
gtk_widget_set_halign (flowbox, GTK_ALIGN_END); gtk_widget_set_halign (flowbox, GTK_ALIGN_END);
@ -423,14 +423,14 @@ create_window (void)
gtk_widget_show (flowbox_cntl); gtk_widget_show (flowbox_cntl);
gtk_widget_show (expander); gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), flowbox_cntl); gtk_container_add (GTK_CONTAINER (expander), flowbox_cntl);
gtk_box_pack_start (GTK_BOX (vbox), expander); gtk_container_add (GTK_CONTAINER (vbox), expander);
widget = gtk_check_button_new_with_label ("Homogeneous"); widget = gtk_check_button_new_with_label ("Homogeneous");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size"); gtk_widget_set_tooltip_text (widget, "Set whether the items should be displayed at the same size");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (homogeneous_toggled), flowbox); G_CALLBACK (homogeneous_toggled), flowbox);
@ -441,7 +441,7 @@ create_window (void)
flowbox, "activate-on-single-click", flowbox, "activate-on-single-click",
G_BINDING_SYNC_CREATE); G_BINDING_SYNC_CREATE);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
/* Add alignment controls */ /* Add alignment controls */
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
@ -453,7 +453,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the horizontal alignment policy"); gtk_widget_set_tooltip_text (widget, "Set the horizontal alignment policy");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (horizontal_alignment_changed), flowbox); G_CALLBACK (horizontal_alignment_changed), flowbox);
@ -467,7 +467,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the vertical alignment policy"); gtk_widget_set_tooltip_text (widget, "Set the vertical alignment policy");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (vertical_alignment_changed), flowbox); G_CALLBACK (vertical_alignment_changed), flowbox);
@ -480,7 +480,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the flowbox orientation"); gtk_widget_set_tooltip_text (widget, "Set the flowbox orientation");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (orientation_changed), flowbox); G_CALLBACK (orientation_changed), flowbox);
@ -495,7 +495,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the selection mode"); gtk_widget_set_tooltip_text (widget, "Set the selection mode");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (selection_mode_changed), flowbox); G_CALLBACK (selection_mode_changed), flowbox);
@ -506,7 +506,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the minimum amount of items per line before wrapping"); gtk_widget_set_tooltip_text (widget, "Set the minimum amount of items per line before wrapping");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (line_length_changed), flowbox); G_CALLBACK (line_length_changed), flowbox);
@ -519,7 +519,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the natural amount of items per line "); gtk_widget_set_tooltip_text (widget, "Set the natural amount of items per line ");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (max_line_length_changed), flowbox); G_CALLBACK (max_line_length_changed), flowbox);
@ -531,41 +531,41 @@ create_window (void)
gtk_widget_show (hbox); gtk_widget_show (hbox);
widget = gtk_label_new ("H Spacing"); widget = gtk_label_new ("H Spacing");
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0, 30, 1); widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_CSPACING); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_CSPACING);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children"); gtk_widget_set_tooltip_text (widget, "Set the horizontal spacing between children");
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL)); G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));
g_signal_connect (G_OBJECT (widget), "value-changed", g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL)); G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_HORIZONTAL));
gtk_box_pack_start (GTK_BOX (flowbox_cntl), hbox); gtk_container_add (GTK_CONTAINER (flowbox_cntl), hbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_widget_show (hbox); gtk_widget_show (hbox);
widget = gtk_label_new ("V Spacing"); widget = gtk_label_new ("V Spacing");
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0, 30, 1); widget = gtk_spin_button_new_with_range (0, 30, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_RSPACING); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), INITIAL_RSPACING);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children"); gtk_widget_set_tooltip_text (widget, "Set the vertical spacing between children");
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL)); G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));
g_signal_connect (G_OBJECT (widget), "value-changed", g_signal_connect (G_OBJECT (widget), "value-changed",
G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL)); G_CALLBACK (spacing_changed), GINT_TO_POINTER (GTK_ORIENTATION_VERTICAL));
gtk_box_pack_start (GTK_BOX (flowbox_cntl), hbox); gtk_container_add (GTK_CONTAINER (flowbox_cntl), hbox);
/* filtering and sorting */ /* filtering and sorting */
@ -574,7 +574,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out"); gtk_widget_set_tooltip_text (widget, "Set whether some items should be filtered out");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (filter_toggled), flowbox); G_CALLBACK (filter_toggled), flowbox);
@ -584,7 +584,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted"); gtk_widget_set_tooltip_text (widget, "Set whether items should be sorted");
gtk_box_pack_start (GTK_BOX (flowbox_cntl), widget); gtk_container_add (GTK_CONTAINER (flowbox_cntl), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (sort_toggled), flowbox); G_CALLBACK (sort_toggled), flowbox);
@ -597,7 +597,7 @@ create_window (void)
gtk_widget_show (items_cntl); gtk_widget_show (items_cntl);
gtk_widget_show (expander); gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), items_cntl); gtk_container_add (GTK_CONTAINER (expander), items_cntl);
gtk_box_pack_start (GTK_BOX (vbox), expander); gtk_container_add (GTK_CONTAINER (vbox), expander);
/* Add Items control */ /* Add Items control */
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
@ -610,7 +610,7 @@ create_window (void)
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_set_tooltip_text (widget, "Set the item set to use"); gtk_widget_set_tooltip_text (widget, "Set the item set to use");
gtk_box_pack_start (GTK_BOX (items_cntl), widget); gtk_container_add (GTK_CONTAINER (items_cntl), widget);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (items_changed), flowbox); G_CALLBACK (items_changed), flowbox);

View File

@ -146,7 +146,7 @@ int main (int argc, char **argv)
frame = GTK_FRAME (gtk_frame_new ("Test GtkFrame")); frame = GTK_FRAME (gtk_frame_new ("Test GtkFrame"));
gtk_widget_set_vexpand (GTK_WIDGET (frame), TRUE); gtk_widget_set_vexpand (GTK_WIDGET (frame), TRUE);
gtk_box_pack_start (vbox, GTK_WIDGET (frame)); gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (frame));
widget = gtk_button_new_with_label ("Hello!"); widget = gtk_button_new_with_label ("Hello!");
gtk_container_add (GTK_CONTAINER (frame), widget); gtk_container_add (GTK_CONTAINER (frame), widget);
@ -154,7 +154,7 @@ int main (int argc, char **argv)
grid = GTK_GRID (gtk_grid_new ()); grid = GTK_GRID (gtk_grid_new ());
gtk_grid_set_row_spacing (grid, 12); gtk_grid_set_row_spacing (grid, 12);
gtk_grid_set_column_spacing (grid, 6); gtk_grid_set_column_spacing (grid, 6);
gtk_box_pack_start (vbox, GTK_WIDGET (grid)); gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (grid));
xalign = gtk_frame_get_label_align (frame); xalign = gtk_frame_get_label_align (frame);

View File

@ -41,32 +41,32 @@ main (int argc,
gtk_container_add (GTK_CONTAINER (toplevel), hbox); gtk_container_add (GTK_CONTAINER (toplevel), hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
image = gtk_image_new_from_gicon (G_ICON (pixbuf)); image = gtk_image_new_from_gicon (G_ICON (pixbuf));
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE); gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_box_pack_start (GTK_BOX (vbox), image); gtk_container_add (GTK_CONTAINER (vbox), image);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
str = g_strdup_printf ("Normal icon, hash %u", g_icon_hash (G_ICON (pixbuf))); str = g_strdup_printf ("Normal icon, hash %u", g_icon_hash (G_ICON (pixbuf)));
gtk_label_set_label (GTK_LABEL (label), str); gtk_label_set_label (GTK_LABEL (label), str);
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
otherpix = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL); otherpix = gdk_pixbuf_new_from_file ("gnome-textfile.png", NULL);
emblem = g_emblem_new (G_ICON (otherpix)); emblem = g_emblem_new (G_ICON (otherpix));
emblemed = g_emblemed_icon_new (G_ICON (pixbuf), emblem); emblemed = g_emblemed_icon_new (G_ICON (pixbuf), emblem);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
image2 = gtk_image_new_from_gicon (emblemed); image2 = gtk_image_new_from_gicon (emblemed);
gtk_image_set_icon_size (GTK_IMAGE (image2), GTK_ICON_SIZE_LARGE); gtk_image_set_icon_size (GTK_IMAGE (image2), GTK_ICON_SIZE_LARGE);
gtk_box_pack_start (GTK_BOX (vbox), image2); gtk_container_add (GTK_CONTAINER (vbox), image2);
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
str = g_strdup_printf ("Emblemed icon, hash %u", g_icon_hash (emblemed)); str = g_strdup_printf ("Emblemed icon, hash %u", g_icon_hash (emblemed));
gtk_label_set_label (GTK_LABEL (label), str); gtk_label_set_label (GTK_LABEL (label), str);
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
gtk_widget_show (toplevel); gtk_widget_show (toplevel);

View File

@ -148,21 +148,21 @@ box_comparison (void)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), box); gtk_container_add (GTK_CONTAINER (vbox), box);
gtk_box_pack_start (GTK_BOX (box), test_widget ("1", "white")); gtk_container_add (GTK_CONTAINER (box), test_widget ("1", "white"));
label = gtk_label_new ("Some ellipsizing text"); label = gtk_label_new ("Some ellipsizing text");
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), 10); gtk_label_set_width_chars (GTK_LABEL (label), 10);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_pack_start (GTK_BOX (box), test_widget ("2", "green")); gtk_container_add (GTK_CONTAINER (box), test_widget ("2", "green"));
label = gtk_label_new ("Some text that may wrap if needed"); label = gtk_label_new ("Some text that may wrap if needed");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_width_chars (GTK_LABEL (label), 10); gtk_label_set_width_chars (GTK_LABEL (label), 10);
gtk_box_pack_start (GTK_BOX (box), label); gtk_container_add (GTK_CONTAINER (box), label);
gtk_box_pack_start (GTK_BOX (box), test_widget ("3", "red")); gtk_container_add (GTK_CONTAINER (box), test_widget ("3", "red"));
grid = gtk_grid_new (); grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL); gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), GTK_ORIENTATION_VERTICAL);

File diff suppressed because it is too large Load Diff

View File

@ -85,11 +85,11 @@ change_header (GtkButton *button, gpointer data)
gtk_style_context_add_class (gtk_widget_get_style_context (header), "header-bar"); gtk_style_context_add_class (gtk_widget_get_style_context (header), "header-bar");
g_object_set (header, "margin", 10, NULL); g_object_set (header, "margin", 10, NULL);
label = gtk_label_new ("Label"); label = gtk_label_new ("Label");
gtk_box_pack_start (GTK_BOX (header), label); gtk_container_add (GTK_CONTAINER (header), label);
widget = gtk_level_bar_new (); widget = gtk_level_bar_new ();
gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.4); gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.4);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (header), widget); gtk_container_add (GTK_CONTAINER (header), widget);
} }
else else
{ {
@ -142,6 +142,12 @@ main (int argc, char *argv[])
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box); gtk_container_add (GTK_CONTAINER (window), box);
content = gtk_image_new_from_icon_name ("start-here-symbolic");
gtk_image_set_pixel_size (GTK_IMAGE (content), 512);
gtk_container_add (GTK_CONTAINER (box), content);
footer = gtk_action_bar_new (); footer = gtk_action_bar_new ();
gtk_action_bar_set_center_widget (GTK_ACTION_BAR (footer), gtk_check_button_new_with_label ("Middle")); gtk_action_bar_set_center_widget (GTK_ACTION_BAR (footer), gtk_check_button_new_with_label ("Middle"));
button = gtk_toggle_button_new_with_label ("Custom"); button = gtk_toggle_button_new_with_label ("Custom");
@ -153,13 +159,7 @@ main (int argc, char *argv[])
button = gtk_button_new_with_label ("Fullscreen"); button = gtk_button_new_with_label ("Fullscreen");
gtk_action_bar_pack_end (GTK_ACTION_BAR (footer), button); gtk_action_bar_pack_end (GTK_ACTION_BAR (footer), button);
g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window); g_signal_connect (button, "clicked", G_CALLBACK (toggle_fullscreen), window);
gtk_box_pack_end (GTK_BOX (box), footer); gtk_container_add (GTK_CONTAINER (box), footer);
content = gtk_image_new_from_icon_name ("start-here-symbolic");
gtk_image_set_pixel_size (GTK_IMAGE (content), 512);
gtk_box_pack_start (GTK_BOX (box), content);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();

View File

@ -824,7 +824,7 @@ create_window (void)
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (test_clicked), &interfaces[i]); G_CALLBACK (test_clicked), &interfaces[i]);
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
} }
return window; return window;

View File

@ -425,7 +425,7 @@ main (gint argc, gchar **argv)
paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_vexpand (paned, TRUE); gtk_widget_set_vexpand (paned, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), paned); gtk_container_add (GTK_CONTAINER (vbox), paned);
icon_list = gtk_icon_view_new (); icon_list = gtk_icon_view_new ();
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_list), GTK_SELECTION_MULTIPLE); gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_list), GTK_SELECTION_MULTIPLE);
@ -541,43 +541,43 @@ main (gint argc, gchar **argv)
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
gtk_box_pack_start (GTK_BOX (vbox), bbox); gtk_container_add (GTK_CONTAINER (vbox), bbox);
button = gtk_button_new_with_label ("Add some"); button = gtk_button_new_with_label ("Add some");
g_signal_connect (button, "clicked", G_CALLBACK (add_some), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (add_some), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Add many"); button = gtk_button_new_with_label ("Add many");
g_signal_connect (button, "clicked", G_CALLBACK (add_many), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (add_many), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Add large"); button = gtk_button_new_with_label ("Add large");
g_signal_connect (button, "clicked", G_CALLBACK (add_large), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (add_large), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Remove selected"); button = gtk_button_new_with_label ("Remove selected");
g_signal_connect (button, "clicked", G_CALLBACK (foreach_selected_remove), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (foreach_selected_remove), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Swap"); button = gtk_button_new_with_label ("Swap");
g_signal_connect (button, "clicked", G_CALLBACK (swap_rows), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (swap_rows), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
gtk_box_pack_start (GTK_BOX (vbox), bbox); gtk_container_add (GTK_CONTAINER (vbox), bbox);
button = gtk_button_new_with_label ("Select all"); button = gtk_button_new_with_label ("Select all");
g_signal_connect (button, "clicked", G_CALLBACK (select_all), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (select_all), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Unselect all"); button = gtk_button_new_with_label ("Unselect all");
g_signal_connect (button, "clicked", G_CALLBACK (unselect_all), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (unselect_all), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Select nonexisting"); button = gtk_button_new_with_label ("Select nonexisting");
g_signal_connect (button, "clicked", G_CALLBACK (select_nonexisting), icon_list); g_signal_connect (button, "clicked", G_CALLBACK (select_nonexisting), icon_list);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
icon_list = gtk_icon_view_new (); icon_list = gtk_icon_view_new ();

View File

@ -62,22 +62,22 @@ main (int argc, char **argv)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
orientables = g_list_prepend (orientables, box); orientables = g_list_prepend (orientables, box);
gtk_grid_attach (GTK_GRID (grid), box, 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), box, 0, 1, 1, 1);
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkBox 1")); gtk_button_new_with_label ("GtkBox 1"));
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkBox 2")); gtk_button_new_with_label ("GtkBox 2"));
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkBox 3")); gtk_button_new_with_label ("GtkBox 3"));
/* GtkButtonBox */ /* GtkButtonBox */
box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
orientables = g_list_prepend (orientables, box); orientables = g_list_prepend (orientables, box);
gtk_grid_attach (GTK_GRID (grid), box, 1, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), box, 1, 1, 1, 1);
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkButtonBox 1")); gtk_button_new_with_label ("GtkButtonBox 1"));
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkButtonBox 2")); gtk_button_new_with_label ("GtkButtonBox 2"));
gtk_box_pack_start (GTK_BOX (box), gtk_container_add (GTK_CONTAINER (box),
gtk_button_new_with_label ("GtkButtonBox 3")); gtk_button_new_with_label ("GtkButtonBox 3"));
/* GtkSeparator */ /* GtkSeparator */

View File

@ -468,12 +468,12 @@ test_input_stacking (void)
"But the entry does"); "But the entry does");
gtk_widget_set_margin_top (label, 8); gtk_widget_set_margin_top (label, 8);
gtk_widget_set_margin_bottom (label, 8); gtk_widget_set_margin_bottom (label, 8);
gtk_box_pack_start (GTK_BOX (vbox), label); gtk_container_add (GTK_CONTAINER (vbox), label);
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_widget_set_margin_top (entry, 8); gtk_widget_set_margin_top (entry, 8);
gtk_widget_set_margin_bottom (entry, 8); gtk_widget_set_margin_bottom (entry, 8);
gtk_box_pack_start (GTK_BOX (vbox), entry); gtk_container_add (GTK_CONTAINER (vbox), entry);
gtk_container_add (GTK_CONTAINER (win), overlay); gtk_container_add (GTK_CONTAINER (win), overlay);

View File

@ -108,13 +108,13 @@ main(int argc, char **argv)
NULL); NULL);
gtk_widget_set_halign (combo_box, GTK_ALIGN_START); gtk_widget_set_halign (combo_box, GTK_ALIGN_START);
gtk_box_pack_start (GTK_BOX (vbox), combo_box); gtk_container_add (GTK_CONTAINER (vbox), combo_box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
label = gtk_label_new ("Overall Alpha:"); label = gtk_label_new ("Overall Alpha:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
adjustment = gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0); adjustment = gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0);
g_signal_connect (adjustment, "value_changed", g_signal_connect (adjustment, "value_changed",
@ -123,7 +123,7 @@ main(int argc, char **argv)
hscale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment); hscale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_set_digits (GTK_SCALE (hscale), 0); gtk_scale_set_digits (GTK_SCALE (hscale), 0);
gtk_widget_set_hexpand (hscale, TRUE); gtk_widget_set_hexpand (hscale, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), hscale); gtk_container_add (GTK_CONTAINER (hbox), hscale);
/* Compute the size without the drawing area, so we know how big to make the default size */ /* Compute the size without the drawing area, so we know how big to make the default size */
gtk_widget_get_preferred_size ( (vbox), gtk_widget_get_preferred_size ( (vbox),
@ -131,7 +131,7 @@ main(int argc, char **argv)
darea = gtk_drawing_area_new (); darea = gtk_drawing_area_new ();
gtk_widget_set_hexpand (darea, TRUE); gtk_widget_set_hexpand (darea, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), darea); gtk_container_add (GTK_CONTAINER (vbox), darea);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), draw_func, NULL, NULL); gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), draw_func, NULL, NULL);

View File

@ -130,7 +130,7 @@ int main (int argc, char *argv[])
scales = g_slist_prepend (scales, scale); scales = g_slist_prepend (scales, scale);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("With fill level"); frame = gtk_frame_new ("With fill level");
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -139,7 +139,7 @@ int main (int argc, char *argv[])
gtk_range_set_show_fill_level (GTK_RANGE (scale), TRUE); gtk_range_set_show_fill_level (GTK_RANGE (scale), TRUE);
gtk_range_set_fill_level (GTK_RANGE (scale), 50); gtk_range_set_fill_level (GTK_RANGE (scale), 50);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Simple marks"); frame = gtk_frame_new ("Simple marks");
extra_scale = scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); extra_scale = scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -149,7 +149,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], 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_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, NULL);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Simple marks up"); frame = gtk_frame_new ("Simple marks up");
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -159,7 +159,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], 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_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, NULL);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Labeled marks"); frame = gtk_frame_new ("Labeled marks");
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@ -171,7 +171,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]); 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_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Some labels"); frame = gtk_frame_new ("Some labels");
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -181,7 +181,7 @@ int main (int argc, char *argv[])
gtk_scale_add_mark (GTK_SCALE (scale), marks[1], 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, labels[2]); gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, labels[2]);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Above and below"); frame = gtk_frame_new ("Above and below");
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -192,7 +192,7 @@ int main (int argc, char *argv[])
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[2], GTK_POS_BOTTOM, bath_labels[2]);
gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[3], GTK_POS_TOP, bath_labels[3]); gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[3], GTK_POS_TOP, bath_labels[3]);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
frame = gtk_frame_new ("Positions"); frame = gtk_frame_new ("Positions");
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1); scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
@ -203,7 +203,7 @@ int main (int argc, char *argv[])
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[2], GTK_POS_TOP, pos_labels[2]);
gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]); gtk_scale_add_mark (GTK_SCALE (scale), pos_marks[3], GTK_POS_BOTTOM, pos_labels[3]);
gtk_container_add (GTK_CONTAINER (frame), scale); gtk_container_add (GTK_CONTAINER (frame), scale);
gtk_box_pack_start (GTK_BOX (box), frame); gtk_container_add (GTK_CONTAINER (box), frame);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (box1), box2); gtk_container_add (GTK_CONTAINER (box1), box2);

View File

@ -90,11 +90,11 @@ scrollable_policy (void)
gtk_widget_show (vbox); gtk_widget_show (vbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (window), hbox); gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox); gtk_container_add (GTK_CONTAINER (hbox), vbox);
frame = gtk_frame_new ("Scrolled Window"); frame = gtk_frame_new ("Scrolled Window");
gtk_widget_set_hexpand (frame, TRUE); gtk_widget_set_hexpand (frame, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), frame); gtk_container_add (GTK_CONTAINER (hbox), frame);
swindow = gtk_scrolled_window_new (NULL, NULL); swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
@ -128,7 +128,7 @@ scrollable_policy (void)
gtk_widget_show (cntl); gtk_widget_show (cntl);
gtk_widget_show (expander); gtk_widget_show (expander);
gtk_container_add (GTK_CONTAINER (expander), cntl); gtk_container_add (GTK_CONTAINER (expander), cntl);
gtk_box_pack_start (GTK_BOX (vbox), expander); gtk_container_add (GTK_CONTAINER (vbox), expander);
/* Add Horizontal policy control here */ /* Add Horizontal policy control here */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
@ -136,7 +136,7 @@ scrollable_policy (void)
widget = gtk_label_new ("hscroll-policy"); widget = gtk_label_new ("hscroll-policy");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum");
@ -144,8 +144,8 @@ scrollable_policy (void)
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (cntl), hbox); gtk_container_add (GTK_CONTAINER (cntl), hbox);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (horizontal_policy_changed), viewport); G_CALLBACK (horizontal_policy_changed), viewport);
@ -156,7 +156,7 @@ scrollable_policy (void)
widget = gtk_label_new ("vscroll-policy"); widget = gtk_label_new ("vscroll-policy");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_combo_box_text_new (); widget = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum");
@ -164,8 +164,8 @@ scrollable_policy (void)
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (cntl), hbox); gtk_container_add (GTK_CONTAINER (cntl), hbox);
g_signal_connect (G_OBJECT (widget), "changed", g_signal_connect (G_OBJECT (widget), "changed",
G_CALLBACK (vertical_policy_changed), viewport); G_CALLBACK (vertical_policy_changed), viewport);
@ -175,12 +175,12 @@ scrollable_policy (void)
widget = gtk_label_new ("min-content-width"); widget = gtk_label_new ("min-content-width");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0); widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (cntl), hbox); gtk_container_add (GTK_CONTAINER (cntl), hbox);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_show (hbox); gtk_widget_show (hbox);
@ -191,12 +191,12 @@ scrollable_policy (void)
widget = gtk_label_new ("min-content-height"); widget = gtk_label_new ("min-content-height");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0); widget = gtk_spin_button_new_with_range (100.0, 1000.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (cntl), hbox); gtk_container_add (GTK_CONTAINER (cntl), hbox);
gtk_widget_show (widget); gtk_widget_show (widget);
gtk_widget_show (hbox); gtk_widget_show (hbox);
@ -206,7 +206,7 @@ scrollable_policy (void)
/* Add Kinetic scrolling control here */ /* Add Kinetic scrolling control here */
widget = gtk_check_button_new_with_label ("Kinetic scrolling"); widget = gtk_check_button_new_with_label ("Kinetic scrolling");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (cntl), widget); gtk_container_add (GTK_CONTAINER (cntl), widget);
g_signal_connect (G_OBJECT (widget), "toggled", g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (kinetic_scrolling_changed), swindow); G_CALLBACK (kinetic_scrolling_changed), swindow);
@ -218,7 +218,7 @@ scrollable_policy (void)
widget = gtk_menu_button_new (); widget = gtk_menu_button_new ();
gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), popover); gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), popover);
gtk_container_add (GTK_CONTAINER (widget), gtk_label_new ("Popover")); gtk_container_add (GTK_CONTAINER (widget), gtk_label_new ("Popover"));
gtk_box_pack_start (GTK_BOX (cntl), widget); gtk_container_add (GTK_CONTAINER (cntl), widget);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (popover), vbox); gtk_container_add (GTK_CONTAINER (popover), vbox);
@ -228,9 +228,7 @@ scrollable_policy (void)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_box_pack_end (GTK_BOX (vbox), swindow); gtk_container_add (GTK_CONTAINER (vbox), swindow);
gtk_widget_show (swindow);
gtk_widget_show (hbox);
/* Listbox */ /* Listbox */
listbox = gtk_list_box_new (); listbox = gtk_list_box_new ();
@ -242,11 +240,11 @@ scrollable_policy (void)
widget = gtk_label_new ("min-content-width"); widget = gtk_label_new ("min-content-width");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0); widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)),
"value", "value",
@ -256,13 +254,13 @@ scrollable_policy (void)
widget = gtk_label_new ("min-content-height"); widget = gtk_label_new ("min-content-height");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0); widget = gtk_spin_button_new_with_range (0.0, 150.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)),
"value", "value",
@ -275,11 +273,11 @@ scrollable_policy (void)
widget = gtk_label_new ("max-content-width"); widget = gtk_label_new ("max-content-width");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0); widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)),
"value", "value",
@ -289,12 +287,12 @@ scrollable_policy (void)
widget = gtk_label_new ("max-content-height"); widget = gtk_label_new ("max-content-height");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0); widget = gtk_spin_button_new_with_range (250.0, 1000.0, 10.0);
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)), g_object_bind_property (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)),
"value", "value",
@ -307,15 +305,15 @@ scrollable_policy (void)
widget = gtk_button_new_with_label ("Remove"); widget = gtk_button_new_with_label ("Remove");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
g_signal_connect (widget, "clicked", g_signal_connect (widget, "clicked",
G_CALLBACK (remove_row), listbox); G_CALLBACK (remove_row), listbox);
widget = gtk_button_new_with_label ("Add"); widget = gtk_button_new_with_label ("Add");
gtk_widget_set_hexpand (widget, TRUE); gtk_widget_set_hexpand (widget, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), widget); gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
g_signal_connect (widget, "clicked", g_signal_connect (widget, "clicked",
G_CALLBACK (add_row), listbox); G_CALLBACK (add_row), listbox);

View File

@ -65,15 +65,15 @@ int main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), box); gtk_container_add (GTK_CONTAINER (window), box);
w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 15); w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 15);
gtk_box_pack_start (GTK_BOX (box), w); gtk_container_add (GTK_CONTAINER (box), w);
gtk_box_pack_start (GTK_BOX (w), gtk_entry_new ()); gtk_container_add (GTK_CONTAINER (w), gtk_entry_new ());
bu = gtk_button_new_with_label ("Bu"); bu = gtk_button_new_with_label ("Bu");
gtk_box_pack_start (GTK_BOX (w), bu); gtk_container_add (GTK_CONTAINER (w), bu);
c = gtk_switch_new (); c = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (c), TRUE); gtk_switch_set_active (GTK_SWITCH (c), TRUE);
gtk_widget_set_halign (c, GTK_ALIGN_CENTER); gtk_widget_set_halign (c, GTK_ALIGN_CENTER);
gtk_widget_set_valign (c, GTK_ALIGN_CENTER); gtk_widget_set_valign (c, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (box), c); gtk_container_add (GTK_CONTAINER (box), c);
g_signal_connect (bu, "clicked", G_CALLBACK (set_insensitive), w); g_signal_connect (bu, "clicked", G_CALLBACK (set_insensitive), w);
g_signal_connect (bu, "state-flags-changed", G_CALLBACK (state_flags_changed), NULL); g_signal_connect (bu, "state-flags-changed", G_CALLBACK (state_flags_changed), NULL);

View File

@ -60,7 +60,7 @@ prepare_window_for_orientation (GtkOrientation orientation)
g_object_bind_property (wrap_button, "active", spin, "wrap", G_BINDING_SYNC_CREATE); g_object_bind_property (wrap_button, "active", spin, "wrap", G_BINDING_SYNC_CREATE);
GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_start (GTK_BOX (hbox), spin); gtk_container_add (GTK_CONTAINER (hbox), spin);
gtk_container_add (GTK_CONTAINER (mainbox), hbox); gtk_container_add (GTK_CONTAINER (mainbox), hbox);
} }

View File

@ -127,7 +127,7 @@ main (gint argc,
gtk_container_add (GTK_CONTAINER (window), box); gtk_container_add (GTK_CONTAINER (window), box);
switcher = gtk_stack_switcher_new (); switcher = gtk_stack_switcher_new ();
gtk_box_pack_start (GTK_BOX (box), switcher); gtk_container_add (GTK_CONTAINER (box), switcher);
stack = gtk_stack_new (); stack = gtk_stack_new ();
@ -141,9 +141,9 @@ main (gint argc,
sidebar = gtk_stack_sidebar_new (); sidebar = gtk_stack_sidebar_new ();
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack)); gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (layout), sidebar); gtk_container_add (GTK_CONTAINER (layout), sidebar);
gtk_widget_set_hexpand (stack, TRUE); gtk_widget_set_hexpand (stack, TRUE);
gtk_box_pack_start (GTK_BOX (layout), stack); gtk_container_add (GTK_CONTAINER (layout), stack);
gtk_container_add (GTK_CONTAINER (box), layout); gtk_container_add (GTK_CONTAINER (box), layout);

View File

@ -26,12 +26,12 @@ make_switch (gboolean is_on,
sw = gtk_switch_new (); sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), is_on); gtk_switch_set_active (GTK_SWITCH (sw), is_on);
gtk_box_pack_start (GTK_BOX (hbox), sw); gtk_container_add (GTK_CONTAINER (hbox), sw);
gtk_widget_set_sensitive (sw, is_sensitive); gtk_widget_set_sensitive (sw, is_sensitive);
label = gtk_label_new (is_on ? "Enabled" : "Disabled"); label = gtk_label_new (is_on ? "Enabled" : "Disabled");
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
gtk_box_pack_end (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
g_object_bind_property_full (sw, "active", g_object_bind_property_full (sw, "active",
label, "label", label, "label",
@ -116,24 +116,18 @@ make_delayed_switch (gboolean is_on,
sw = gtk_switch_new (); sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), is_on); gtk_switch_set_active (GTK_SWITCH (sw), is_on);
gtk_box_pack_start (GTK_BOX (hbox), sw); gtk_container_add (GTK_CONTAINER (hbox), sw);
gtk_widget_set_sensitive (sw, is_sensitive); gtk_widget_set_sensitive (sw, is_sensitive);
g_signal_connect (sw, "state-set", G_CALLBACK (set_state), NULL); g_signal_connect (sw, "state-set", G_CALLBACK (set_state), NULL);
spinner = gtk_spinner_new (); spinner = gtk_spinner_new ();
gtk_box_pack_start (GTK_BOX (hbox), spinner); gtk_container_add (GTK_CONTAINER (hbox), spinner);
gtk_widget_set_opacity (spinner, 0.0); gtk_widget_set_opacity (spinner, 0.0);
check = gtk_check_button_new ();
gtk_box_pack_end (GTK_BOX (hbox), check);
g_object_bind_property (sw, "state",
check, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
label = gtk_label_new (is_on ? "Enabled" : "Disabled"); label = gtk_label_new (is_on ? "Enabled" : "Disabled");
gtk_widget_set_hexpand (label, TRUE); gtk_widget_set_hexpand (label, TRUE);
gtk_box_pack_end (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
g_object_bind_property_full (sw, "active", g_object_bind_property_full (sw, "active",
label, "label", label, "label",
@ -142,6 +136,12 @@ make_delayed_switch (gboolean is_on,
NULL, NULL,
NULL, NULL); NULL, NULL);
check = gtk_check_button_new ();
gtk_container_add (GTK_CONTAINER (hbox), check);
g_object_bind_property (sw, "state",
check, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
g_signal_connect (sw, "notify", G_CALLBACK (sw_delay_notify), spinner); g_signal_connect (sw, "notify", G_CALLBACK (sw_delay_notify), spinner);
return hbox; return hbox;

View File

@ -457,19 +457,19 @@ main (gint argc, gchar **argv)
gtk_grid_attach (GTK_GRID (grid), hbox2, 1, 2, 1, 1); gtk_grid_attach (GTK_GRID (grid), hbox2, 1, 2, 1, 1);
checkbox = gtk_check_button_new_with_mnemonic("_Vertical"); checkbox = gtk_check_button_new_with_mnemonic("_Vertical");
gtk_box_pack_start (GTK_BOX (hbox1), checkbox); gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
g_signal_connect (checkbox, "toggled", g_signal_connect (checkbox, "toggled",
G_CALLBACK (change_orientation), toolbar); G_CALLBACK (change_orientation), toolbar);
checkbox = gtk_check_button_new_with_mnemonic("_Show Arrow"); checkbox = gtk_check_button_new_with_mnemonic("_Show Arrow");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
gtk_box_pack_start (GTK_BOX (hbox1), checkbox); gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
g_signal_connect (checkbox, "toggled", g_signal_connect (checkbox, "toggled",
G_CALLBACK (change_show_arrow), toolbar); G_CALLBACK (change_show_arrow), toolbar);
checkbox = gtk_check_button_new_with_mnemonic("_Set Toolbar Style:"); checkbox = gtk_check_button_new_with_mnemonic("_Set Toolbar Style:");
g_signal_connect (checkbox, "toggled", G_CALLBACK (set_toolbar_style_toggled), toolbar); g_signal_connect (checkbox, "toggled", G_CALLBACK (set_toolbar_style_toggled), toolbar);
gtk_box_pack_start (GTK_BOX (hbox1), checkbox); gtk_container_add (GTK_CONTAINER (hbox1), checkbox);
option_menu = gtk_combo_box_text_new (); option_menu = gtk_combo_box_text_new ();
gtk_widget_set_sensitive (option_menu, FALSE); gtk_widget_set_sensitive (option_menu, FALSE);
@ -479,7 +479,7 @@ main (gint argc, gchar **argv)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), toolbar_styles[i]); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), toolbar_styles[i]);
gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu),
gtk_toolbar_get_style (GTK_TOOLBAR (toolbar))); gtk_toolbar_get_style (GTK_TOOLBAR (toolbar)));
gtk_box_pack_start (GTK_BOX (hbox2), option_menu); gtk_container_add (GTK_CONTAINER (hbox2), option_menu);
g_signal_connect (option_menu, "changed", g_signal_connect (option_menu, "changed",
G_CALLBACK (change_toolbar_style), toolbar); G_CALLBACK (change_toolbar_style), toolbar);
@ -630,13 +630,16 @@ main (gint argc, gchar **argv)
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 4, 1, 1); gtk_grid_attach (GTK_GRID (grid), hbox, 1, 4, 1, 1);
button = gtk_button_new_with_label ("Drag me to the toolbar"); button = gtk_button_new_with_label ("Drag me to the toolbar");
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
label = gtk_label_new ("Drop index:"); label = gtk_label_new ("Drop index:");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_container_add (GTK_CONTAINER (hbox), label);
label = gtk_label_new (""); label = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (hbox), label); gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (hbox), label);
checkbox = gtk_check_button_new_with_mnemonic("_Right to left"); checkbox = gtk_check_button_new_with_mnemonic("_Right to left");
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
@ -645,7 +648,7 @@ main (gint argc, gchar **argv)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), FALSE);
g_signal_connect (checkbox, "toggled", G_CALLBACK (rtl_toggled), NULL); g_signal_connect (checkbox, "toggled", G_CALLBACK (rtl_toggled), NULL);
gtk_box_pack_end (GTK_BOX (hbox), checkbox); gtk_container_add (GTK_CONTAINER (hbox), checkbox);
targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table)); targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table));
gtk_drag_source_set (button, GDK_BUTTON1_MASK, gtk_drag_source_set (button, GDK_BUTTON1_MASK,

View File

@ -313,7 +313,7 @@ main (int argc, char *argv[])
/* A check button using the tooltip-markup property */ /* A check button using the tooltip-markup property */
button = gtk_check_button_new_with_label ("This one uses the tooltip-markup property"); button = gtk_check_button_new_with_label ("This one uses the tooltip-markup property");
gtk_widget_set_tooltip_text (button, "Hello, I am a static tooltip."); gtk_widget_set_tooltip_text (button, "Hello, I am a static tooltip.");
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
text = gtk_widget_get_tooltip_text (button); text = gtk_widget_get_tooltip_text (button);
markup = gtk_widget_get_tooltip_markup (button); markup = gtk_widget_get_tooltip_markup (button);
@ -326,13 +326,13 @@ main (int argc, char *argv[])
g_object_set (button, "has-tooltip", TRUE, NULL); g_object_set (button, "has-tooltip", TRUE, NULL);
g_signal_connect (button, "query-tooltip", g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_cb), NULL); G_CALLBACK (query_tooltip_cb), NULL);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
/* A label */ /* A label */
button = gtk_label_new ("I am just a label"); button = gtk_label_new ("I am just a label");
gtk_label_set_selectable (GTK_LABEL (button), FALSE); gtk_label_set_selectable (GTK_LABEL (button), FALSE);
gtk_widget_set_tooltip_text (button, "Label & and tooltip"); gtk_widget_set_tooltip_text (button, "Label & and tooltip");
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
text = gtk_widget_get_tooltip_text (button); text = gtk_widget_get_tooltip_text (button);
markup = gtk_widget_get_tooltip_markup (button); markup = gtk_widget_get_tooltip_markup (button);
@ -344,7 +344,7 @@ main (int argc, char *argv[])
button = gtk_label_new ("I am a selectable label"); button = gtk_label_new ("I am a selectable label");
gtk_label_set_selectable (GTK_LABEL (button), TRUE); gtk_label_set_selectable (GTK_LABEL (button), TRUE);
gtk_widget_set_tooltip_markup (button, "<b>Another</b> Label tooltip"); gtk_widget_set_tooltip_markup (button, "<b>Another</b> Label tooltip");
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
text = gtk_widget_get_tooltip_text (button); text = gtk_widget_get_tooltip_text (button);
markup = gtk_widget_get_tooltip_markup (button); markup = gtk_widget_get_tooltip_markup (button);
@ -354,7 +354,7 @@ main (int argc, char *argv[])
/* Another one, with a custom tooltip window */ /* Another one, with a custom tooltip window */
button = gtk_check_button_new_with_label ("This one has a custom tooltip window!"); button = gtk_check_button_new_with_label ("This one has a custom tooltip window!");
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
tooltip_window = gtk_window_new (GTK_WINDOW_POPUP); tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
tooltip_button = gtk_label_new ("blaat!"); tooltip_button = gtk_label_new ("blaat!");
@ -375,7 +375,7 @@ main (int argc, char *argv[])
button = gtk_button_new_with_label ("This one is insensitive"); button = gtk_button_new_with_label ("This one is insensitive");
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
g_object_set (button, "tooltip-text", "Insensitive!", NULL); g_object_set (button, "tooltip-text", "Insensitive!", NULL);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
/* Testcases from Kris without a tree view don't exist. */ /* Testcases from Kris without a tree view don't exist. */
tree_view = gtk_tree_view_new_with_model (create_model ()); tree_view = gtk_tree_view_new_with_model (create_model ());
@ -398,7 +398,7 @@ main (int argc, char *argv[])
gtk_tree_view_column_set_clickable (column, TRUE); gtk_tree_view_column_set_clickable (column, TRUE);
g_object_set (gtk_tree_view_column_get_button (column), "tooltip-text", "Header", NULL); g_object_set (gtk_tree_view_column_get_button (column), "tooltip-text", "Header", NULL);
gtk_box_pack_start (GTK_BOX (box), tree_view); gtk_container_add (GTK_CONTAINER (box), tree_view);
/* And a text view for Matthias */ /* And a text view for Matthias */
buffer = gtk_text_buffer_new (NULL); buffer = gtk_text_buffer_new (NULL);
@ -422,7 +422,7 @@ main (int argc, char *argv[])
g_signal_connect (text_view, "query-tooltip", g_signal_connect (text_view, "query-tooltip",
G_CALLBACK (query_tooltip_text_view_cb), tag); G_CALLBACK (query_tooltip_text_view_cb), tag);
gtk_box_pack_start (GTK_BOX (box), text_view); gtk_container_add (GTK_CONTAINER (box), text_view);
/* Drawing area */ /* Drawing area */
drawing_area = gtk_drawing_area_new (); drawing_area = gtk_drawing_area_new ();
@ -433,7 +433,7 @@ main (int argc, char *argv[])
g_object_set (drawing_area, "has-tooltip", TRUE, NULL); g_object_set (drawing_area, "has-tooltip", TRUE, NULL);
g_signal_connect (drawing_area, "query-tooltip", g_signal_connect (drawing_area, "query-tooltip",
G_CALLBACK (query_tooltip_drawing_area_cb), NULL); G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
gtk_box_pack_start (GTK_BOX (box), drawing_area); gtk_container_add (GTK_CONTAINER (box), drawing_area);
button = gtk_label_new ("Custom tooltip I"); button = gtk_label_new ("Custom tooltip I");
label = gtk_label_new ("See, custom"); label = gtk_label_new ("See, custom");
@ -441,13 +441,13 @@ main (int argc, char *argv[])
g_object_set (button, "has-tooltip", TRUE, NULL); g_object_set (button, "has-tooltip", TRUE, NULL);
g_signal_connect (button, "query-tooltip", g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_label_cb), label); G_CALLBACK (query_tooltip_label_cb), label);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_label_new ("Custom tooltip II"); button = gtk_label_new ("Custom tooltip II");
label = gtk_label_new ("See, custom, too"); label = gtk_label_new ("See, custom, too");
g_object_ref_sink (label); g_object_ref_sink (label);
g_object_set (button, "has-tooltip", TRUE, NULL); g_object_set (button, "has-tooltip", TRUE, NULL);
gtk_box_pack_start (GTK_BOX (box), button); gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect (button, "query-tooltip", g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_label_cb), label); G_CALLBACK (query_tooltip_label_cb), label);

View File

@ -769,7 +769,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Left Pane */ /* Left Pane */
cell = gtk_cell_renderer_text_new (); cell = gtk_cell_renderer_text_new ();
@ -786,52 +786,52 @@ main (int argc, char *argv[])
gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column); gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column);
gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
gtk_box_pack_start (GTK_BOX (hbox), swindow); gtk_container_add (GTK_CONTAINER (hbox), swindow);
/* Middle Pane */ /* Middle Pane */
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (hbox), vbox2); gtk_container_add (GTK_CONTAINER (hbox), vbox2);
bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
gtk_box_pack_start (GTK_BOX (vbox2), bbox); gtk_container_add (GTK_CONTAINER (vbox2), bbox);
button = gtk_button_new_with_mnemonic ("<< (_Q)"); button = gtk_button_new_with_mnemonic ("<< (_Q)");
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)), g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)),
"changed", G_CALLBACK (selection_changed), button); "changed", G_CALLBACK (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_mnemonic (">> (_W)"); button = gtk_button_new_with_mnemonic (">> (_W)");
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)),
"changed", G_CALLBACK (selection_changed), button); "changed", G_CALLBACK (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
gtk_box_pack_start (GTK_BOX (vbox2), bbox); gtk_container_add (GTK_CONTAINER (vbox2), bbox);
button = gtk_button_new_with_mnemonic ("<< (_E)"); button = gtk_button_new_with_mnemonic ("<< (_E)");
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)), g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)),
"changed", G_CALLBACK (selection_changed), button); "changed", G_CALLBACK (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_mnemonic (">> (_R)"); button = gtk_button_new_with_mnemonic (">> (_R)");
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view);
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)),
"changed", G_CALLBACK (selection_changed), button); "changed", G_CALLBACK (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
/* Right Pane */ /* Right Pane */
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (hbox), vbox2); gtk_container_add (GTK_CONTAINER (hbox), vbox2);
swindow = gtk_scrolled_window_new (NULL, NULL); swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@ -846,7 +846,7 @@ main (int argc, char *argv[])
gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column); gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column);
gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view); gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view);
gtk_box_pack_start (GTK_BOX (vbox2), swindow); gtk_container_add (GTK_CONTAINER (vbox2), swindow);
swindow = gtk_scrolled_window_new (NULL, NULL); swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@ -860,7 +860,7 @@ main (int argc, char *argv[])
gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column); gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column);
gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view); gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view);
gtk_box_pack_start (GTK_BOX (vbox2), swindow); gtk_container_add (GTK_CONTAINER (vbox2), swindow);
/* Drag and Drop */ /* Drag and Drop */
@ -890,13 +890,13 @@ main (int argc, char *argv[])
GDK_ACTION_MOVE); GDK_ACTION_MOVE);
gdk_content_formats_unref (targets); gdk_content_formats_unref (targets);
gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)); gtk_container_add (GTK_CONTAINER (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
button = gtk_button_new_with_mnemonic ("_Add new Column"); button = gtk_button_new_with_mnemonic ("_Add new Column");
g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model); g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();

View File

@ -190,7 +190,7 @@ main (int argc, char **argv)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), BORDER_EXPAND); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), BORDER_EXPAND);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), ALL_EXPAND); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), ALL_EXPAND);
gtk_box_pack_start (GTK_BOX (vbox), combo_box); gtk_container_add (GTK_CONTAINER (vbox), combo_box);
/* Scrolled window and tree view */ /* Scrolled window and tree view */
sw = gtk_scrolled_window_new (NULL, NULL); sw = gtk_scrolled_window_new (NULL, NULL);
@ -198,7 +198,7 @@ main (int argc, char **argv)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (sw, TRUE); gtk_widget_set_vexpand (sw, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), sw); gtk_container_add (GTK_CONTAINER (vbox), sw);
tree_view = gtk_tree_view_new_with_model (create_model ()); tree_view = gtk_tree_view_new_with_model (create_model ());
gtk_container_add (GTK_CONTAINER (sw), tree_view); gtk_container_add (GTK_CONTAINER (sw), tree_view);
@ -221,7 +221,7 @@ main (int argc, char **argv)
button = gtk_toggle_button_new_with_label ("Toggle long content row"); button = gtk_toggle_button_new_with_label ("Toggle long content row");
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
G_CALLBACK (toggle_long_content_row), tree_view); G_CALLBACK (toggle_long_content_row), tree_view);
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
/* Set up option menu callback and default item */ /* Set up option menu callback and default item */
g_signal_connect (combo_box, "changed", g_signal_connect (combo_box, "changed",

View File

@ -208,7 +208,7 @@ create_control (GtkWidget *box, gint number, gint cntl, CallbackData *data)
checkbutton = gtk_check_button_new_with_label (name); checkbutton = gtk_check_button_new_with_label (name);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cntl == CNTL_FIXED); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), cntl == CNTL_FIXED);
gtk_box_pack_start (GTK_BOX (box), checkbutton); gtk_container_add (GTK_CONTAINER (box), checkbutton);
g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data); g_signal_connect (G_OBJECT (checkbutton), "toggled", callback, data);
g_free (name); g_free (name);
@ -245,7 +245,7 @@ main (gint argc, gchar **argv)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
tree_model = create_model (); tree_model = create_model ();
tree_view = gtk_tree_view_new_with_model (tree_model); tree_view = gtk_tree_view_new_with_model (tree_model);
@ -350,11 +350,11 @@ main (gint argc, gchar **argv)
800, 250); 800, 250);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Alignment controls */ /* Alignment controls */
cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_box_pack_start (GTK_BOX (hbox), cntl_vbox); gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox);
create_control (cntl_vbox, 1, CNTL_ALIGN, &callback[0]); create_control (cntl_vbox, 1, CNTL_ALIGN, &callback[0]);
create_control (cntl_vbox, 2, CNTL_ALIGN, &callback[1]); create_control (cntl_vbox, 2, CNTL_ALIGN, &callback[1]);
@ -363,7 +363,7 @@ main (gint argc, gchar **argv)
/* Expand controls */ /* Expand controls */
cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_box_pack_start (GTK_BOX (hbox), cntl_vbox); gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox);
create_control (cntl_vbox, 1, CNTL_EXPAND, &callback[0]); create_control (cntl_vbox, 1, CNTL_EXPAND, &callback[0]);
create_control (cntl_vbox, 2, CNTL_EXPAND, &callback[1]); create_control (cntl_vbox, 2, CNTL_EXPAND, &callback[1]);
@ -372,7 +372,7 @@ main (gint argc, gchar **argv)
/* Fixed controls */ /* Fixed controls */
cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); cntl_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_box_pack_start (GTK_BOX (hbox), cntl_vbox); gtk_container_add (GTK_CONTAINER (hbox), cntl_vbox);
create_control (cntl_vbox, 1, CNTL_FIXED, &callback[0]); create_control (cntl_vbox, 1, CNTL_FIXED, &callback[0]);
create_control (cntl_vbox, 2, CNTL_FIXED, &callback[1]); create_control (cntl_vbox, 2, CNTL_FIXED, &callback[1]);

View File

@ -134,14 +134,14 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Reflow test"); gtk_window_set_title (GTK_WINDOW (window), "Reflow test");
g_signal_connect (window, "destroy", gtk_main_quit, NULL); g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Incremental Reflow Test")); gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Incremental Reflow Test"));
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
initialize_model (); initialize_model ();
tree_view = gtk_tree_view_new_with_model (model); tree_view = gtk_tree_view_new_with_model (model);
@ -157,9 +157,9 @@ main (int argc, char *argv[])
NULL); NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view); gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>"); button = gtk_button_new_with_mnemonic ("<b>_Futz!!</b>");
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_label_set_use_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), TRUE); gtk_label_set_use_markup (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), TRUE);
g_signal_connect (button, "clicked", G_CALLBACK (futz), NULL); g_signal_connect (button, "clicked", G_CALLBACK (futz), NULL);
g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL); g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL);

View File

@ -352,14 +352,14 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet"); gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet");
g_signal_connect (window, "destroy", gtk_main_quit, NULL); g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet")); gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
model = make_model (); model = make_model ();
tree_view = gtk_tree_view_new_with_model (model); tree_view = gtk_tree_view_new_with_model (model);
@ -467,14 +467,14 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Model"); gtk_window_set_title (GTK_WINDOW (window), "Model");
g_signal_connect (window, "destroy", gtk_main_quit, NULL); g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("The model revealed")); gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("The model revealed"));
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
tree_view = gtk_tree_view_new_with_model (model); tree_view = gtk_tree_view_new_with_model (model);

View File

@ -122,20 +122,20 @@ main (int argc, char *argv[])
gtk_window_set_title (GTK_WINDOW (window), "Words, words, words - Window 1"); gtk_window_set_title (GTK_WINDOW (window), "Words, words, words - Window 1");
g_signal_connect (window, "destroy", gtk_main_quit, NULL); g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Jonathan and Kristian's list of cool words. (And Anders' cool list of numbers) \n\nThis is just a GtkTreeStore")); gtk_container_add (GTK_CONTAINER (vbox), gtk_label_new ("Jonathan and Kristian's list of cool words. (And Anders' cool list of numbers) \n\nThis is just a GtkTreeStore"));
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry); gtk_container_add (GTK_CONTAINER (vbox), entry);
button = gtk_button_new_with_label ("Switch search method"); button = gtk_button_new_with_label ("Switch search method");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
@ -250,7 +250,7 @@ main (int argc, char *argv[])
"Words, words, words - window 2"); "Words, words, words - window 2");
g_signal_connect (window2, "destroy", gtk_main_quit, NULL); g_signal_connect (window2, "destroy", gtk_main_quit, NULL);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox2), gtk_container_add (GTK_CONTAINER (vbox2),
gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeStore of window 1")); gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeStore of window 1"));
gtk_container_add (GTK_CONTAINER (window2), vbox2); gtk_container_add (GTK_CONTAINER (window2), vbox2);
@ -261,7 +261,7 @@ main (int argc, char *argv[])
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window2, TRUE); gtk_widget_set_vexpand (scrolled_window2, TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), scrolled_window2); gtk_container_add (GTK_CONTAINER (vbox2), scrolled_window2);
tree_view2 = gtk_tree_view_new_with_model (smodel); tree_view2 = gtk_tree_view_new_with_model (smodel);
@ -319,7 +319,7 @@ main (int argc, char *argv[])
"Words, words, words - Window 3"); "Words, words, words - Window 3");
g_signal_connect (window3, "destroy", gtk_main_quit, NULL); g_signal_connect (window3, "destroy", gtk_main_quit, NULL);
vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_box_pack_start (GTK_BOX (vbox3), gtk_container_add (GTK_CONTAINER (vbox3),
gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeModelSort of window 2")); gtk_label_new ("Jonathan and Kristian's list of words.\n\nA GtkTreeModelSort wrapping the GtkTreeModelSort of window 2"));
gtk_container_add (GTK_CONTAINER (window3), vbox3); gtk_container_add (GTK_CONTAINER (window3), vbox3);
@ -330,7 +330,7 @@ main (int argc, char *argv[])
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand (scrolled_window3, TRUE); gtk_widget_set_vexpand (scrolled_window3, TRUE);
gtk_box_pack_start (GTK_BOX (vbox3), scrolled_window3); gtk_container_add (GTK_CONTAINER (vbox3), scrolled_window3);
tree_view3 = gtk_tree_view_new_with_model (ssmodel); tree_view3 = gtk_tree_view_new_with_model (ssmodel);

View File

@ -56,7 +56,7 @@ show_dialog (void)
gtk_window_set_resizable (GTK_WINDOW (dialog), resizable); gtk_window_set_resizable (GTK_WINDOW (dialog), resizable);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
label); label);
gtk_widget_show (label); gtk_widget_show (label);

View File

@ -329,7 +329,7 @@ make_window (gint view_type)
/* Put them together */ /* Put them together */
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view); gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window); gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
@ -338,7 +338,7 @@ make_window (gint view_type)
/* buttons */ /* buttons */
button = gtk_button_new_with_label ("gtk_tree_store_remove"); button = gtk_button_new_with_label ("gtk_tree_store_remove");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (selection, "changed", g_signal_connect (selection, "changed",
G_CALLBACK (selection_changed), G_CALLBACK (selection_changed),
button); button);
@ -350,9 +350,9 @@ make_window (gint view_type)
button = gtk_button_new_with_label ("gtk_tree_store_insert"); button = gtk_button_new_with_label ("gtk_tree_store_insert");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (hbox), entry); gtk_container_add (GTK_CONTAINER (hbox), entry);
g_object_set_data (G_OBJECT (button), "user_data", entry); g_object_set_data (G_OBJECT (button), "user_data", entry);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_insert), G_CALLBACK (iter_insert),
@ -361,9 +361,9 @@ make_window (gint view_type)
button = gtk_button_new_with_label ("gtk_tree_store_set"); button = gtk_button_new_with_label ("gtk_tree_store_set");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (hbox), entry); gtk_container_add (GTK_CONTAINER (hbox), entry);
g_object_set_data (G_OBJECT (button), "user_data", entry); g_object_set_data (G_OBJECT (button), "user_data", entry);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_change), G_CALLBACK (iter_change),
@ -372,16 +372,16 @@ make_window (gint view_type)
button = gtk_button_new_with_label ("gtk_tree_store_insert_with_values"); button = gtk_button_new_with_label ("gtk_tree_store_insert_with_values");
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), hbox); gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_box_pack_start (GTK_BOX (hbox), button); gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (hbox), entry); gtk_container_add (GTK_CONTAINER (hbox), entry);
g_object_set_data (G_OBJECT (button), "user_data", entry); g_object_set_data (G_OBJECT (button), "user_data", entry);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_insert_with_values), G_CALLBACK (iter_insert_with_values),
tree_view); tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_insert_before"); button = gtk_button_new_with_label ("gtk_tree_store_insert_before");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_insert_before), G_CALLBACK (iter_insert_before),
tree_view); tree_view);
@ -391,7 +391,7 @@ make_window (gint view_type)
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_insert_after"); button = gtk_button_new_with_label ("gtk_tree_store_insert_after");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_insert_after), G_CALLBACK (iter_insert_after),
tree_view); tree_view);
@ -401,13 +401,13 @@ make_window (gint view_type)
gtk_widget_set_sensitive (button, FALSE); gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_prepend"); button = gtk_button_new_with_label ("gtk_tree_store_prepend");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_prepend), G_CALLBACK (iter_prepend),
tree_view); tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_append"); button = gtk_button_new_with_label ("gtk_tree_store_append");
gtk_box_pack_start (GTK_BOX (vbox), button); gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (iter_append), G_CALLBACK (iter_append),
tree_view); tree_view);