summaryrefslogtreecommitdiff
path: root/gtk/gtklistbox.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2018-06-20 12:55:14 +0200
committerTimm Bäder <mail@baedert.org>2018-06-20 20:47:17 +0200
commitf26359db13cb101120b00e627d4c4c0070a4b47e (patch)
treeec7c4f16243202d14d7a2da07d68b54ab5cc1095 /gtk/gtklistbox.c
parent945b844b7c886f1066d9819827190ad3232d8bac (diff)
downloadgtk+-f26359db13cb101120b00e627d4c4c0070a4b47e.tar.gz
listbox: Use widget insert API instead of fiddling with CSS nodes
Diffstat (limited to 'gtk/gtklistbox.c')
-rw-r--r--gtk/gtklistbox.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index b0506fa37c..96aff8de30 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2583,26 +2583,6 @@ gtk_list_box_prepend (GtkListBox *box,
gtk_list_box_insert (box, child, 0);
}
-static void
-gtk_list_box_insert_css_node (GtkListBox *box,
- GtkWidget *child,
- GSequenceIter *iter)
-{
- GSequenceIter *prev_iter;
- GtkCssNode *sibling;
-
- prev_iter = g_sequence_iter_prev (iter);
-
- if (prev_iter != iter)
- sibling = gtk_widget_get_css_node (g_sequence_get (prev_iter));
- else
- sibling = NULL;
-
- gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (box)),
- gtk_widget_get_css_node (child),
- sibling);
-}
-
/**
* gtk_list_box_insert:
* @box: a #GtkListBox
@@ -2623,6 +2603,7 @@ gtk_list_box_insert (GtkListBox *box,
{
GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
+ GSequenceIter *prev = NULL;
GSequenceIter *iter = NULL;
g_return_if_fail (GTK_IS_LIST_BOX (box));
@@ -2651,10 +2632,11 @@ gtk_list_box_insert (GtkListBox *box,
iter = g_sequence_insert_before (current_iter, row);
}
- gtk_list_box_insert_css_node (box, GTK_WIDGET (row), iter);
-
ROW_PRIV (row)->iter = iter;
- gtk_widget_set_parent (GTK_WIDGET (row), GTK_WIDGET (box));
+ prev = g_sequence_iter_prev (iter);
+ gtk_widget_insert_after (GTK_WIDGET (row), GTK_WIDGET (box),
+ prev != iter ? g_sequence_get (prev) : NULL);
+
gtk_widget_set_child_visible (GTK_WIDGET (row), TRUE);
ROW_PRIV (row)->visible = gtk_widget_get_visible (GTK_WIDGET (row));
if (ROW_PRIV (row)->visible)