[gtk/wip/baedert/for-master: 83/97] colorchooserwidget: Get rid of a gtk_widget_destroy() call



commit 4c7012e8fdde37607c7a33870b1db9ac33f3e9f2
Author: Timm Bäder <mail baedert org>
Date:   Thu Feb 20 17:54:56 2020 +0100

    colorchooserwidget: Get rid of a gtk_widget_destroy() call

 gtk/gtkcolorchooserwidget.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index 0b6b3afe4b..5ab782e2a1 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -781,20 +781,16 @@ add_custom_color (GtkColorChooserWidget *cc,
                   const GdkRGBA         *color)
 {
   GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
-  GtkWidget *last;
   GtkWidget *p;
   GList *children;
 
   children = gtk_container_get_children (GTK_CONTAINER (priv->custom));
   if (g_list_length (children) >= 9)
     {
-      last = g_list_last (children)->data;
-      if (last == GTK_WIDGET (priv->current))
-        priv->current = NULL;
+      GtkWidget *last = gtk_widget_get_last_child (priv->custom);
 
-      gtk_widget_destroy (last);
+      gtk_container_remove (GTK_CONTAINER (priv->custom), last);
     }
-
   g_list_free (children);
 
   p = gtk_color_swatch_new ();


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