stack: Add gtk_stack_add_child

The name of children is not essential, so add
a way to add children without providing one.

Fixes: #3165
This commit is contained in:
Matthias Clasen 2020-09-15 18:37:56 -04:00
parent e4d29ba9fd
commit cc9fe4b354
4 changed files with 24 additions and 1 deletions

View File

@ -5975,6 +5975,7 @@ gtk_stack_page_set_icon_name
gtk_stack_page_get_child
GtkStack
gtk_stack_new
gtk_stack_add_child
gtk_stack_add_named
gtk_stack_add_titled
gtk_stack_remove

View File

@ -606,7 +606,7 @@ The replacements for gtk_container_add() are:
| GtkListBox | gtk_list_box_insert() |
| GtkNotebook | gtk_notebook_append_page() |
| GtkPaned | gtk_paned_set_start_child(), gtk_paned_set_end_child() |
| GtkStack | gtk_stack_add_named() |
| GtkStack | gtk_stack_add_child() |
| GtkTextView | gtk_text_view_add_child_at_anchor(), gtk_text_view_add_overlay() |
| GtkTreeView | - |

View File

@ -1292,6 +1292,25 @@ gtk_stack_add_titled (GtkStack *stack,
return gtk_stack_add_internal (stack, child, name, title);
}
/**
* gtk_stack_add_child:
* @stack: a #GtkStack
* @child: the widget to add
*
* Adds a child to @stack.
*
* Returns: (transfer none): the #GtkStackPage for @child
*/
GtkStackPage *
gtk_stack_add_child (GtkStack *stack,
GtkWidget *child)
{
g_return_val_if_fail (GTK_IS_STACK (stack), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
return gtk_stack_add_internal (stack, child, NULL, NULL);
}
/**
* gtk_stack_add_named:
* @stack: a #GtkStack

View File

@ -113,6 +113,9 @@ GType gtk_stack_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_stack_new (void);
GDK_AVAILABLE_IN_ALL
GtkStackPage * gtk_stack_add_child (GtkStack *stack,
GtkWidget *child);
GDK_AVAILABLE_IN_ALL
GtkStackPage * gtk_stack_add_named (GtkStack *stack,
GtkWidget *child,
const char *name);