[gtk/kill-containers: 39/55] Stop using container api on GtkHeaderBar
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/kill-containers: 39/55] Stop using container api on GtkHeaderBar
- Date: Tue, 12 May 2020 02:43:01 +0000 (UTC)
commit abfa4d4a5c9ed6a06f3a7e3a3d50081ba29deeff
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 f7f8356c6c..6cb112d0ba 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;
@@ -524,7 +525,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]