<commit_before>#include <gtk/gtk.h>

typedef struct {
    gchar *title;
    gchar *author;
    gboolean checked;
} Book;

static Book BOOKS[] = {
    {"The Human Condition", "<NAME>", TRUE},
    {"Les trois mousquetaires", "<NAME>", FALSE},
    {"De la democratie en Amerique", "<NAME>, Alexis", TRUE},
    {"1984", "<NAME>", FALSE},
    {"The Shock Doctrine", "<NAME>", TRUE},
    {"No Logo", "<NAME>", TRUE},
    {"Le comte de <NAME>", "<NAME>", FALSE},
    {"Ravages", "<NAME>", FALSE},
    {"Souvenirs", "<NAME>, Alexis", FALSE},
    NULL
};

enum
{
    TITLE_COLUMN,
    AUTHOR_COLUMN,
    CHECKED_COLUMN,
    N_COLUMNS
};

static GtkListStore*
create_book_list_store()
{
    GtkListStore *store;
    GtkTreeIter iter;
    int i;
    
    store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
        G_TYPE_BOOLEAN);

    Book *book = &BOOKS[0];
    while (book->title != NULL) {
        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
            TITLE_COLUMN, book->title,
            AUTHOR_COLUMN, book->author,
            CHECKED_COLUMN, book->checked,
            -1);
        book++;
    }

    return store;
}

static GtkTreeViewColumn*
create_column(gint column_id, gchar *title, gboolean is_checkbox)
{
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    gchar *data_attrname;

    if (is_checkbox) {
        renderer = gtk_cell_renderer_toggle_new();
        data_attrname = "active";
    }<commit_msg>Improved array iteration in book store creation (example 08-list-store).<commit_after>#include <gtk/gtk.h>

typedef struct {
    gchar *title;
    gchar *author;
    gboolean checked;
} Book;

static Book BOOKS[] = {
    {"The Human Condition", "<NAME>", TRUE},
    {"Les trois mousquetaires", "<NAME>", FALSE},
    {"De la democratie en Amerique", "<NAME>, Alexis", TRUE},
    {"1984", "<NAME>", FALSE},
    {"The Shock Doctrine", "<NAME>", TRUE},
    {"No Logo", "<NAME>", TRUE},
    {"Le comte de <NAME>", "<NAME>", FALSE},
    {"Ravages", "<NAME>", FALSE},
    {"Souvenirs", "<NAME>, Alexis", FALSE},
    NULL
};

enum
{
    TITLE_COLUMN,
    AUTHOR_COLUMN,
    CHECKED_COLUMN,
    N_COLUMNS
};

static GtkListStore*
create_book_list_store()
{
    GtkListStore *store;
    GtkTreeIter iter;
    
    store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
        G_TYPE_BOOLEAN);

    Book *book = BOOKS;
    while (book->title != NULL) {
        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
            TITLE_COLUMN, book->title,
            AUTHOR_COLUMN, book->author,
            CHECKED_COLUMN, book->checked,
            -1);
        book++;
    }

    return store;
}

static GtkTreeViewColumn*
create_column(gint column_id, gchar *title, gboolean is_checkbox)
{
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;
    gchar *data_attrname;

    if (is_checkbox) {
        renderer = gtk_cell_renderer_toggle_new();
        data_attrname = "active";
    }
{'fraction_non_alphanumeric': 0.143, 'fraction_numerical': 0.004333333333333333, 'mean_word_length': 3.0120320855614975, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5961895', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1058, 'n_words': 240}