GtkListItemBase * (* create_widget) (GtkWidget *))
{
GtkListItemManager *self;
+ GtkListTile *header, *footer;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
gtk_list_item_manager_clear_node,
NULL);
+ header = gtk_rb_tree_insert_after (self->items, NULL);
+ header->type = GTK_LIST_TILE_HEADER;
+
+ footer = gtk_rb_tree_insert_before (self->items, NULL);
+ footer->type = GTK_LIST_TILE_FOOTER;
+
return self;
}
return;
tile = gtk_list_item_manager_get_nth (self, position, &offset);
+ if (tile == NULL)
+ tile = gtk_rb_tree_get_last (self->items);
if (offset)
tile = gtk_list_item_manager_ensure_split (self, tile, offset);
continue;
break;
+ case GTK_LIST_TILE_HEADER:
+ case GTK_LIST_TILE_FOOTER:
+ case GTK_LIST_TILE_UNMATCHED_HEADER:
+ case GTK_LIST_TILE_UNMATCHED_FOOTER:
case GTK_LIST_TILE_FILLER:
break;
GtkListTile *tile;
guint n_items = 0;
guint i;
+ enum {
+ NO_SECTION,
+ MATCHED_SECTION,
+ UNMATCHED_SECTION
+ } section_state = NO_SECTION;
for (tile = gtk_list_item_manager_get_first (items);
tile != NULL;
{
switch (tile->type)
{
+ case GTK_LIST_TILE_HEADER:
+ g_assert_cmpint (section_state, ==, NO_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = MATCHED_SECTION;
+ break;
+
+ case GTK_LIST_TILE_UNMATCHED_HEADER:
+ g_assert_cmpint (section_state, ==, NO_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = UNMATCHED_SECTION;
+ break;
+
+ case GTK_LIST_TILE_FOOTER:
+ g_assert_cmpint (section_state, ==, MATCHED_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = NO_SECTION;
+ break;
+
+ case GTK_LIST_TILE_UNMATCHED_FOOTER:
+ g_assert_cmpint (section_state, ==, UNMATCHED_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = NO_SECTION;
+ break;
+
case GTK_LIST_TILE_ITEM:
+ g_assert_cmpint (section_state, !=, NO_SECTION);
if (tile->widget)
{
GObject *item = g_list_model_get_item (model, n_items);
}
}
+ g_assert_cmpint (section_state, ==, NO_SECTION);
g_assert_cmpint (n_items, ==, g_list_model_get_n_items (model));
for (i = 0; i < n_trackers; i++)
{
switch (tile->type)
{
+ case GTK_LIST_TILE_HEADER:
+ g_assert_cmpint (section_state, ==, NO_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = MATCHED_SECTION;
+ break;
+
+ case GTK_LIST_TILE_UNMATCHED_HEADER:
+ g_assert_cmpint (section_state, ==, NO_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = UNMATCHED_SECTION;
+ break;
+
+ case GTK_LIST_TILE_FOOTER:
+ g_assert_cmpint (section_state, ==, MATCHED_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = NO_SECTION;
+ break;
+
+ case GTK_LIST_TILE_UNMATCHED_FOOTER:
+ g_assert_cmpint (section_state, ==, UNMATCHED_SECTION);
+ g_assert_cmpint (tile->n_items, ==, 0);
+ g_assert_false (tile->widget);
+ section_state = NO_SECTION;
+ break;
+
case GTK_LIST_TILE_ITEM:
+ g_assert_cmpint (section_state, !=, NO_SECTION);
if (tile->widget)
{
g_assert_cmpint (tile->n_items, ==, 1);
}
}
+ g_assert_cmpint (section_state, ==, NO_SECTION);
g_assert_cmpint (n_items, ==, g_list_model_get_n_items (model));
for (i = 0; i < n_trackers; i++)