[gtk/kill-containers: 19/49] flowbox: Add gtk_flow_box_remove



commit 2aa8475c254efceac13ca9761cc557c1ff8c4298
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 7 20:24:05 2020 -0400

    flowbox: Add gtk_flow_box_remove
    
    This is the replacement for gtk_container_remove.

 docs/reference/gtk/gtk4-sections.txt |  1 +
 gtk/gtkflowbox.c                     | 19 +++++++++++++++----
 gtk/gtkflowbox.h                     |  3 +++
 3 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 95553a7988..22d212a887 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5712,6 +5712,7 @@ gtk_revealer_get_type
 GtkFlowBox
 gtk_flow_box_new
 gtk_flow_box_insert
+gtk_flow_box_remove
 gtk_flow_box_get_child_at_index
 gtk_flow_box_get_child_at_pos
 gtk_flow_box_set_hadjustment
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 36d534f459..b8ff3dd637 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2986,16 +2986,27 @@ gtk_flow_box_add (GtkContainer *container,
   gtk_flow_box_insert (GTK_FLOW_BOX (container), child, -1);
 }
 
-static void
-gtk_flow_box_remove (GtkContainer *container,
-                     GtkWidget    *widget)
+/**
+ * gtk_flow_box_remove:
+ * @box: a #GtkFlowBox
+ * @widget: the child widget to remove
+ *
+ * Removes a child from @box.
+ */
+void
+gtk_flow_box_remove (GtkFlowBox *box,
+                     GtkWidget  *widget)
 {
-  GtkFlowBox *box = GTK_FLOW_BOX (container);
   GtkFlowBoxPrivate *priv = BOX_PRIV (box);
   gboolean was_visible;
   gboolean was_selected;
   GtkFlowBoxChild *child;
 
+  g_return_if_fail (GTK_IS_FLOW_BOX (box));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (box) ||
+                    gtk_widget_get_parent (gtk_widget_get_parent (widget)) == GTK_WIDGET (box));
+
   if (GTK_IS_FLOW_BOX_CHILD (widget))
     child = GTK_FLOW_BOX_CHILD (widget);
   else
diff --git a/gtk/gtkflowbox.h b/gtk/gtkflowbox.h
index 9b1729490d..75d9498955 100644
--- a/gtk/gtkflowbox.h
+++ b/gtk/gtkflowbox.h
@@ -147,6 +147,9 @@ void                  gtk_flow_box_insert                       (GtkFlowBox
                                                                  GtkWidget         *widget,
                                                                  gint               position);
 GDK_AVAILABLE_IN_ALL
+void                  gtk_flow_box_remove                       (GtkFlowBox        *box,
+                                                                 GtkWidget         *widget);
+GDK_AVAILABLE_IN_ALL
 GtkFlowBoxChild      *gtk_flow_box_get_child_at_index           (GtkFlowBox        *box,
                                                                  gint               idx);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]