[gtk/kill-containers: 8/21] Stop using container api on GtkNotebook



commit d88214f3c738ac4a325c3148da4b7b63c01aee96
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 8 10:57:21 2020 -0400

    Stop using container api on GtkNotebook

 gtk/gtknotebook.c | 10 ++++------
 tests/testgtk.c   |  8 +++++---
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index ae3038cb71..d9f52259e2 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3335,7 +3335,7 @@ gtk_notebook_detach_tab (GtkNotebook *notebook,
                          GtkWidget   *child)
 {
   notebook->remove_in_detach = TRUE;
-  gtk_container_remove (GTK_CONTAINER (notebook), child);
+  gtk_notebook_remove (notebook, child);
   notebook->remove_in_detach = FALSE;
 }
 
@@ -5553,7 +5553,7 @@ gtk_notebook_menu_item_recreate (GtkNotebook *notebook,
   GtkWidget *menu_item = gtk_widget_get_parent (page->menu_label);
 
   gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label);
-  gtk_container_remove (GTK_CONTAINER (notebook->menu), menu_item);
+  gtk_widget_unparent (menu_item);
   gtk_notebook_menu_item_create (notebook, page);
 }
 
@@ -5808,8 +5808,7 @@ gtk_notebook_remove_page (GtkNotebook *notebook,
     list = g_list_last (notebook->children);
 
   if (list)
-    gtk_container_remove (GTK_CONTAINER (notebook),
-                          ((GtkNotebookPage *) list->data)->child);
+    gtk_notebook_remove (notebook, ((GtkNotebookPage *) list->data)->child);
 }
 
 /* Public GtkNotebook Page Switch Methods :
@@ -6625,8 +6624,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
   if (page->menu_label)
     {
       if (notebook->menu)
-        gtk_container_remove (GTK_CONTAINER (notebook->menu),
-                              gtk_widget_get_parent (page->menu_label));
+        gtk_widget_destroy (gtk_widget_get_parent (page->menu_label));
 
       g_clear_object (&page->menu_label);
     }
diff --git a/tests/testgtk.c b/tests/testgtk.c
index cd900e2406..6774c5dceb 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -3912,9 +3912,11 @@ rotate_notebook (GtkButton   *button,
 static void
 show_all_pages (GtkButton   *button,
                GtkNotebook *notebook)
-{  
-  gtk_container_foreach (GTK_CONTAINER (notebook),
-                        (GtkCallback) gtk_widget_show, NULL);
+{
+  int i;
+
+  for (i = 0; i < gtk_notebook_get_n_pages (notebook); i++)
+    gtk_widget_show (gtk_notebook_get_nth_page (notebook, i)); 
 }
 
 static void


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