[gtk/wip/exalm/headerbar: 1/2] headerbar: Don't use gtk_widget_unparent() with GtkBox




commit 319755662f5a683794b12a49c6b6f21f22f1b4ae
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Feb 8 17:52:10 2021 +0500

    headerbar: Don't use gtk_widget_unparent() with GtkBox
    
    gtk_widget_unparent() is for widget implementations, it's not supposed to
    be used from outside.

 gtk/gtkheaderbar.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 30423b9d48..6f90f38f6b 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -743,8 +743,17 @@ gtk_header_bar_set_show_title_buttons (GtkHeaderBar *bar,
     create_window_controls (bar);
   else
     {
-      g_clear_pointer (&bar->start_window_controls, gtk_widget_unparent);
-      g_clear_pointer (&bar->end_window_controls, gtk_widget_unparent);
+      if (bar->start_window_controls)
+        {
+          gtk_box_remove (GTK_BOX (bar->start_box), bar->start_window_controls);
+          bar->start_window_controls = NULL;
+        }
+
+      if (ar->end_window_controls)
+        {
+          gtk_box_remove (GTK_BOX (bar->end_box), bar->end_window_controls);
+          bar->end_window_controls = NULL;
+        }
     }
 
   g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_SHOW_TITLE_BUTTONS]);


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