diff options
author | Christopher Davis <christopherdavis@gnome.org> | 2021-09-29 19:45:45 -0700 |
---|---|---|
committer | Christopher Davis <christopherdavis@gnome.org> | 2021-10-12 11:07:17 -0700 |
commit | 454ca897bb0d41f0926c91d6668440470e7855bf (patch) | |
tree | c4bfc62877c7771addc40238ea529a16c74b8c7a | |
parent | 222d927e93346e2c4633ddab15dde1e8a5e812ed (diff) | |
download | gtk+-454ca897bb0d41f0926c91d6668440470e7855bf.tar.gz |
gtkflowbox: Add prepend() and append()
These functions are common across container implementations,
but GtkFlowBox was missing them.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4277
-rw-r--r-- | gtk/gtkflowbox.c | 48 | ||||
-rw-r--r-- | gtk/gtkflowbox.h | 6 |
2 files changed, 54 insertions, 0 deletions
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 188b76c562..a3de9deaaa 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -4073,6 +4073,54 @@ gtk_flow_box_insert_widget (GtkFlowBox *box, } /** + * gtk_flow_box_prepend: + * @self: a `GtkFlowBox + * @child: the `GtkWidget` to add + * + * Adds @child to the start of @self. + * + * If a sort function is set, the widget will + * actually be inserted at the calculated position. + * + * See also: [method@Gtk.FlowBox.insert]. + * + * Since: 4.6 + */ +void +gtk_flow_box_prepend (GtkFlowBox *self, + GtkWidget *child) +{ + g_return_if_fail (GTK_IS_FLOW_BOX (self)); + g_return_if_fail (GTK_IS_WIDGET (child)); + + gtk_flow_box_insert (self, child, 0); +} + +/** + * gtk_flow_box_append: + * @self: a `GtkFlowBox + * @child: the `GtkWidget` to add + * + * Adds @child to the end of @self. + * + * If a sort function is set, the widget will + * actually be inserted at the calculated position. + * + * See also: [method@Gtk.FlowBox.insert]. + * + * Since: 4.6 + */ +void +gtk_flow_box_append (GtkFlowBox *self, + GtkWidget *child) +{ + g_return_if_fail (GTK_IS_FLOW_BOX (self)); + g_return_if_fail (GTK_IS_WIDGET (child)); + + gtk_flow_box_insert (self, child, -1); +} + +/** * gtk_flow_box_insert: * @box: a `GtkFlowBox` * @widget: the `GtkWidget` to add diff --git a/gtk/gtkflowbox.h b/gtk/gtkflowbox.h index 3625d18ddf..a8f3da2eda 100644 --- a/gtk/gtkflowbox.h +++ b/gtk/gtkflowbox.h @@ -147,6 +147,12 @@ void gtk_flow_box_set_activate_on_single_click (GtkFlowBox GDK_AVAILABLE_IN_ALL gboolean gtk_flow_box_get_activate_on_single_click (GtkFlowBox *box); +GDK_AVAILABLE_IN_4_6 +void gtk_flow_box_prepend (GtkFlowBox *self, + GtkWidget *child); +GDK_AVAILABLE_IN_4_6 +void gtk_flow_box_append (GtkFlowBox *self, + GtkWidget *child); GDK_AVAILABLE_IN_ALL void gtk_flow_box_insert (GtkFlowBox *box, GtkWidget *widget, |