[gtk/kill-containers: 27/43] Stop using container api on GtkHeaderBar



commit 50ddf26944df8e0340d5701a6d41cbdfa5ba0619
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 8 09:26:11 2020 -0400

    Stop using container api on GtkHeaderBar

 gtk/gtkdialog.c            | 22 ++++++++++++++--------
 gtk/gtkfilechooserdialog.c |  6 +++++-
 gtk/gtkshortcutswindow.c   |  2 +-
 3 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 106e1e0ee7..64cd525586 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -390,19 +390,17 @@ update_suggested_action (GtkDialog *dialog)
 
   if (priv->use_header_bar)
     {
-      GList *children, *l;
+      GtkWidget *child;
 
-      children = gtk_container_get_children (GTK_CONTAINER (priv->headerbar));
-      for (l = children; l != NULL; l = l->next)
+      for (child = gtk_widget_get_first_child (priv->headerbar);
+           child != NULL;
+           child = gtk_widget_get_next_sibling (child))
         {
-          GtkWidget *child = l->data;
-
           if (gtk_widget_has_css_class (child, GTK_STYLE_CLASS_DEFAULT))
             gtk_widget_add_css_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
           else
             gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_SUGGESTED_ACTION);
         }
-      g_list_free (children);
     }
 }
 
@@ -615,7 +613,15 @@ get_action_children (GtkDialog *dialog)
   GList *children;
 
   if (priv->constructed && priv->use_header_bar)
-    children = gtk_container_get_children (GTK_CONTAINER (priv->headerbar));
+    {
+      GtkWidget *child;
+
+      children = NULL;
+      for (child = gtk_widget_get_first_child (priv->headerbar);
+           child != NULL;
+           child = gtk_widget_get_next_sibling (child))
+        children = g_list_append (children, child);
+    }
   else
     children = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
 
@@ -1513,7 +1519,7 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
           if (is_action)
             {
               g_object_ref (object);
-              gtk_container_remove (GTK_CONTAINER (priv->headerbar), GTK_WIDGET (object));
+              gtk_header_bar_remove (GTK_HEADER_BAR (priv->headerbar), GTK_WIDGET (object));
               add_to_header_bar (dialog, GTK_WIDGET (object), ad->response_id);
               g_object_unref (object);
             }
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 1eae65ae18..2bb05003ed 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -461,6 +461,7 @@ setup_search (GtkFileChooserDialog *dialog)
 {
   GtkFileChooserDialogPrivate *priv = gtk_file_chooser_dialog_get_instance_private (dialog);
   gboolean use_header;
+  GtkWidget *child;
 
   if (priv->search_setup)
     return;
@@ -521,7 +522,10 @@ setup_search (GtkFileChooserDialog *dialog)
 
       gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header), box);
 
-      gtk_container_forall (GTK_CONTAINER (header), add_button, dialog);
+      for (child = gtk_widget_get_first_child (header);
+           child != NULL;
+           child = gtk_widget_get_next_sibling (child))
+        add_button (child, dialog);
     }
 }
 
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index 1e87a8a732..2ca5fb26bc 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -852,7 +852,7 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
   search_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
                                 "icon-name", "edit-find-symbolic",
                                 NULL);
-  gtk_container_add (GTK_CONTAINER (priv->header_bar), search_button);
+  gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->header_bar), search_button);
 
   priv->main_box = g_object_new (GTK_TYPE_BOX,
                            "orientation", GTK_ORIENTATION_VERTICAL,


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