[gtk/kill-containers: 3/8] fixed: Add gtk_fixed_remove



commit 032017f47a5d332e2c63ebf11c316c29c80cebbe
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 7 15:02:39 2020 -0400

    fixed: Add gtk_fixed_remove
    
    This is the replacement for gtk_container_reomve.

 docs/reference/gtk/gtk4-sections.txt |  1 +
 gtk/gtkfixed.c                       | 20 +++++++++++++++-----
 gtk/gtkfixed.h                       |  3 +++
 3 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index ff6eb43237..ddc5a983cf 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1229,6 +1229,7 @@ gtk_filter_list_model_get_type
 GtkFixed
 gtk_fixed_new
 gtk_fixed_put
+gtk_fixed_remove
 gtk_fixed_move
 <SUBSECTION Standard>
 GTK_FIXED
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 3d35f0a24b..40f3576eba 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -78,8 +78,6 @@
 
 static void gtk_fixed_add           (GtkContainer     *container,
                                      GtkWidget        *widget);
-static void gtk_fixed_remove        (GtkContainer     *container,
-                                     GtkWidget        *widget);
 static void gtk_fixed_forall        (GtkContainer     *container,
                                      GtkCallback       callback,
                                      gpointer          callback_data);
@@ -296,10 +294,22 @@ gtk_fixed_add (GtkContainer *container,
   gtk_fixed_put (GTK_FIXED (container), widget, 0, 0);
 }
 
-static void
-gtk_fixed_remove (GtkContainer *container,
-                  GtkWidget    *widget)
+/**
+ * gtk_fixed_remove:
+ * @fixed: a #GtkFixed
+ * @widget: the child widget to remove
+ *
+ * Removes a child from @fixed, after it has been added
+ * with gtk_fixed_put().
+ */
+void
+gtk_fixed_remove (GtkFixed  *fixed,
+                  GtkWidget *widget)
 {
+  g_return_if_fail (GTK_IS_FIXED (fixed));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (fixed));
+
   gtk_widget_unparent (widget);
 }
 
diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h
index 539dfed970..77acdf3e85 100644
--- a/gtk/gtkfixed.h
+++ b/gtk/gtkfixed.h
@@ -70,6 +70,9 @@ void            gtk_fixed_put                   (GtkFixed     *fixed,
                                                  gint          x,
                                                  gint          y);
 GDK_AVAILABLE_IN_ALL
+void            gtk_fixed_remove                (GtkFixed     *fixed,
+                                                 GtkWidget    *widget);
+GDK_AVAILABLE_IN_ALL
 void            gtk_fixed_move                  (GtkFixed     *fixed,
                                                  GtkWidget    *widget,
                                                  gint          x,


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