[gtk/kill-containers: 38/51] Stop using container api on GtkFlowBox
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/kill-containers: 38/51] Stop using container api on GtkFlowBox
- Date: Fri, 8 May 2020 13:41:54 +0000 (UTC)
commit 46b50a38f1ef06cbe60d423b3473a4ff65d4a9f6
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 7 23:24:58 2020 -0400
Stop using container api on GtkFlowBox
GtkContainer is going away.
demos/gtk-demo/flowbox.c | 2 +-
tests/testflowbox.c | 21 +++++++--------------
2 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/demos/gtk-demo/flowbox.c b/demos/gtk-demo/flowbox.c
index fd87463b89..e1c707a6d1 100644
--- a/demos/gtk-demo/flowbox.c
+++ b/demos/gtk-demo/flowbox.c
@@ -739,7 +739,7 @@ do_flowbox (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), scrolled);
for (i = 0; colors[i]; i++)
- gtk_container_add (GTK_CONTAINER (flowbox), color_swatch_new (colors[i]));
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), color_swatch_new (colors[i]), -1);
}
if (!gtk_widget_get_visible (window))
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index 0b5386a214..39c39afc55 100644
--- a/tests/testflowbox.c
+++ b/tests/testflowbox.c
@@ -54,7 +54,7 @@ populate_flowbox_simple (GtkFlowBox *flowbox)
gtk_frame_set_child (GTK_FRAME (frame), widget);
g_object_set_data_full (G_OBJECT (frame), "id", (gpointer)g_strdup (text), g_free);
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
g_free (text);
}
@@ -102,7 +102,7 @@ populate_flowbox_focus (GtkFlowBox *flowbox)
if (i % 5 == 0)
gtk_container_add (GTK_CONTAINER (box), gtk_switch_new ());
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
if (!sensitive)
gtk_widget_set_sensitive (gtk_widget_get_parent (frame), FALSE);
}
@@ -118,7 +118,7 @@ populate_flowbox_buttons (GtkFlowBox *flowbox)
{
widget = gtk_button_new_with_label ("Button");
gtk_widget_show (widget);
- gtk_container_add (GTK_CONTAINER (flowbox), widget);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), widget, -1);
widget = gtk_widget_get_parent (widget);
gtk_widget_set_can_focus (widget, FALSE);
}
@@ -153,7 +153,7 @@ populate_flowbox_wrappy (GtkFlowBox *flowbox)
gtk_label_set_width_chars (GTK_LABEL (widget), 10);
g_object_set_data_full (G_OBJECT (frame), "id", (gpointer)g_strdup (strings[i]), g_free);
- gtk_container_add (GTK_CONTAINER (flowbox), frame);
+ gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), frame, -1);
}
}
@@ -190,17 +190,10 @@ populate_flowbox_images (GtkFlowBox *flowbox)
static void
populate_items (GtkFlowBox *flowbox)
{
- GList *children, *l;
-
- /* Remove all children first */
- children = gtk_container_get_children (GTK_CONTAINER (flowbox));
- for (l = children; l; l = l->next)
- {
- GtkWidget *child = l->data;
+ GtkWidget *child;
- gtk_container_remove (GTK_CONTAINER (flowbox), child);
- }
- g_list_free (children);
+ while ((child = gtk_widget_get_first_child (GTK_WIDGET (flowbox))))
+ gtk_flow_box_remove (flowbox, child);
if (items_type == SIMPLE_ITEMS)
populate_flowbox_simple (flowbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]