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




commit c2ed1f3c013d07e80e6b0dba7e690dfbb01d66c0
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/gtkheaderbar.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 30423b9d48..1b6d617531 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -743,8 +743,15 @@ 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_box && bar->start_window_controls) {
+        gtk_box_remove (GTK_BOX (bar->start_box), bar->start_window_controls);
+        bar->start_window_controls = NULL;
+      }
+
+      if (bar->end_box && bar->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]