[gtk/kill-containers: 13/43] flowbox: Add gtk_flow_box_remove



commit 164a8da7d342a70e6cc33bf313f53e4aa836560f
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 1460199a7d..8c9b9dc4c8 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5706,6 +5706,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 66aac6a95e..924ea1fb99 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2987,16 +2987,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]