Stop using container api on GtkHeaderBar

This commit is contained in:
Matthias Clasen 2020-05-08 09:26:11 -04:00
parent d59d9d4bd5
commit abfa4d4a5c
3 changed files with 20 additions and 10 deletions

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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,