summaryrefslogtreecommitdiff
path: root/gtk/gtkmaplistmodel.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-01-06 23:37:32 -0500
committerBenjamin Otte <otte@redhat.com>2019-01-14 02:14:11 +0100
commit25bca27bfe04cddc9b76f9396b44225fe5603f76 (patch)
tree026d2d6bb5865251e2024c21e3788af4b0ef3df4 /gtk/gtkmaplistmodel.c
parente269f43afc2c6b11e18cb528def814fed926fb3e (diff)
downloadgtk+-25bca27bfe04cddc9b76f9396b44225fe5603f76.tar.gz
Rename GtkCssRBTree to GtkRBTree
This is a generally usable red-black tree api, and it is not used in css at all.
Diffstat (limited to 'gtk/gtkmaplistmodel.c')
-rw-r--r--gtk/gtkmaplistmodel.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/gtk/gtkmaplistmodel.c b/gtk/gtkmaplistmodel.c
index 6f5e331d80..9be8aa7922 100644
--- a/gtk/gtkmaplistmodel.c
+++ b/gtk/gtkmaplistmodel.c
@@ -21,7 +21,7 @@
#include "gtkmaplistmodel.h"
-#include "gtkcssrbtreeprivate.h"
+#include "gtkrbtreeprivate.h"
#include "gtkintl.h"
#include "gtkprivate.h"
@@ -73,7 +73,7 @@ struct _GtkMapListModel
gpointer user_data;
GDestroyNotify user_destroy;
- GtkCssRbTree *items; /* NULL if map_func == NULL */
+ GtkRbTree *items; /* NULL if map_func == NULL */
};
struct _GtkMapListModelClass
@@ -84,21 +84,21 @@ struct _GtkMapListModelClass
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
static MapNode *
-gtk_map_list_model_get_nth (GtkCssRbTree *tree,
- guint position,
- guint *out_start_pos)
+gtk_map_list_model_get_nth (GtkRbTree *tree,
+ guint position,
+ guint *out_start_pos)
{
MapNode *node, *tmp;
guint start_pos = position;
- node = gtk_css_rb_tree_get_root (tree);
+ node = gtk_rb_tree_get_root (tree);
while (node)
{
- tmp = gtk_css_rb_tree_get_left (tree, node);
+ tmp = gtk_rb_tree_get_left (tree, node);
if (tmp)
{
- MapAugment *aug = gtk_css_rb_tree_get_augment (tree, tmp);
+ MapAugment *aug = gtk_rb_tree_get_augment (tree, tmp);
if (position < aug->n_items)
{
node = tmp;
@@ -114,7 +114,7 @@ gtk_map_list_model_get_nth (GtkCssRbTree *tree,
}
position -= node->n_items;
- node = gtk_css_rb_tree_get_right (tree, node);
+ node = gtk_rb_tree_get_right (tree, node);
}
if (out_start_pos)
@@ -165,18 +165,18 @@ gtk_map_list_model_get_item (GListModel *list,
if (offset != position)
{
- MapNode *before = gtk_css_rb_tree_insert_before (self->items, node);
+ MapNode *before = gtk_rb_tree_insert_before (self->items, node);
before->n_items = position - offset;
node->n_items -= before->n_items;
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
}
if (node->n_items > 1)
{
- MapNode *after = gtk_css_rb_tree_insert_after (self->items, node);
+ MapNode *after = gtk_rb_tree_insert_after (self->items, node);
after->n_items = node->n_items - 1;
node->n_items = 1;
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
}
node->item = self->map_func (g_list_model_get_item (self->model, position), self->user_data);
@@ -225,9 +225,9 @@ gtk_map_list_model_items_changed_cb (GListModel *model,
end = start + node->n_items;
if (start == position && end <= position + removed)
{
- MapNode *next = gtk_css_rb_tree_get_next (self->items, node);
+ MapNode *next = gtk_rb_tree_get_next (self->items, node);
removed -= node->n_items;
- gtk_css_rb_tree_remove (self->items, node);
+ gtk_rb_tree_remove (self->items, node);
node = next;
}
else
@@ -236,16 +236,16 @@ gtk_map_list_model_items_changed_cb (GListModel *model,
{
node->n_items -= removed;
removed = 0;
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
}
else if (start < position)
{
guint overlap = node->n_items - (position - start);
node->n_items -= overlap;
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
removed -= overlap;
start = position;
- node = gtk_css_rb_tree_get_next (self->items, node);
+ node = gtk_rb_tree_get_next (self->items, node);
}
}
}
@@ -253,12 +253,12 @@ gtk_map_list_model_items_changed_cb (GListModel *model,
if (added)
{
if (node == NULL)
- node = gtk_css_rb_tree_insert_before (self->items, NULL);
+ node = gtk_rb_tree_insert_before (self->items, NULL);
else if (node->item)
- node = gtk_css_rb_tree_insert_after (self->items, node);
+ node = gtk_rb_tree_insert_after (self->items, node);
node->n_items += added;
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
}
g_list_model_items_changed (G_LIST_MODEL (self), position, removed, added);
@@ -337,10 +337,10 @@ gtk_map_list_model_dispose (GObject *object)
self->map_func = NULL;
self->user_data = NULL;
self->user_destroy = NULL;
- g_clear_pointer (&self->items, gtk_css_rb_tree_unref);
+ g_clear_pointer (&self->items, gtk_rb_tree_unref);
G_OBJECT_CLASS (gtk_map_list_model_parent_class)->dispose (object);
-};
+}
static void
gtk_map_list_model_class_init (GtkMapListModelClass *class)
@@ -397,25 +397,25 @@ gtk_map_list_model_init (GtkMapListModel *self)
static void
-gtk_map_list_model_augment (GtkCssRbTree *map,
- gpointer _aug,
- gpointer _node,
- gpointer left,
- gpointer right)
+gtk_map_list_model_augment (GtkRbTree *map,
+ gpointer _aug,
+ gpointer _node,
+ gpointer left,
+ gpointer right)
{
- MapNode *node= _node;
+ MapNode *node = _node;
MapAugment *aug = _aug;
aug->n_items = node->n_items;
if (left)
{
- MapAugment *left_aug = gtk_css_rb_tree_get_augment (map, left);
+ MapAugment *left_aug = gtk_rb_tree_get_augment (map, left);
aug->n_items += left_aug->n_items;
}
if (right)
{
- MapAugment *right_aug = gtk_css_rb_tree_get_augment (map, right);
+ MapAugment *right_aug = gtk_rb_tree_get_augment (map, right);
aug->n_items += right_aug->n_items;
}
}
@@ -473,28 +473,28 @@ gtk_map_list_model_init_items (GtkMapListModel *self)
if (self->items)
{
- gtk_css_rb_tree_remove_all (self->items);
+ gtk_rb_tree_remove_all (self->items);
}
else
{
- self->items = gtk_css_rb_tree_new (MapNode,
- MapAugment,
- gtk_map_list_model_augment,
- gtk_map_list_model_clear_node,
- NULL);
+ self->items = gtk_rb_tree_new (MapNode,
+ MapAugment,
+ gtk_map_list_model_augment,
+ gtk_map_list_model_clear_node,
+ NULL);
}
n_items = g_list_model_get_n_items (self->model);
if (n_items)
{
- MapNode *node = gtk_css_rb_tree_insert_before (self->items, NULL);
+ MapNode *node = gtk_rb_tree_insert_before (self->items, NULL);
node->n_items = g_list_model_get_n_items (self->model);
- gtk_css_rb_tree_mark_dirty (self->items, node);
+ gtk_rb_tree_mark_dirty (self->items, node);
}
}
else
{
- g_clear_pointer (&self->items, gtk_css_rb_tree_unref);
+ g_clear_pointer (&self->items, gtk_rb_tree_unref);
}
}