[gtk/stack-add-child] stack: Add gtk_stack_add_child
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/stack-add-child] stack: Add gtk_stack_add_child
- Date: Tue, 15 Sep 2020 22:39:50 +0000 (UTC)
commit cc9fe4b354a6ae14f7f85d62d7807955d7a54799
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Sep 15 18:37:56 2020 -0400
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
docs/reference/gtk/gtk4-sections.txt | 1 +
docs/reference/gtk/migrating-3to4.md | 2 +-
gtk/gtkstack.c | 19 +++++++++++++++++++
gtk/gtkstack.h | 3 +++
4 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index d3986d02d6..62d617d582 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md
index 8f99501358..59800003b5 100644
--- a/docs/reference/gtk/migrating-3to4.md
+++ b/docs/reference/gtk/migrating-3to4.md
@@ -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 | - |
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 75a2fa9e30..8fd95a39f1 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -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
diff --git a/gtk/gtkstack.h b/gtk/gtkstack.h
index 6253890aa5..cf506b49fb 100644
--- a/gtk/gtkstack.h
+++ b/gtk/gtkstack.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]