WIP: simplifications (TreeItem notation) 57-60

This commit is contained in:
Jean Sirmai 2023-12-15 11:31:09 +01:00
parent f6affc1ebf
commit 8891d5adfe
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 8 additions and 25 deletions

View File

@ -49,32 +49,15 @@ struct _TreeItem
enum enum
{ {
COLUMN_0, COLUMN_0,
// COLUMN_1, COLUMN_1,
NUM_COLUMNS NUM_COLUMNS
}; };
/* tree data */ /* tree data */
static TreeItem item_name_0[] = static TreeItem C[] = {{ "H", NULL }, { NULL }};
{ static TreeItem A[] = {{ "C", C }, { "D", NULL }, { NULL }};
{ "C", NULL }, static TreeItem B[] = {{ "E", NULL }, { "F", NULL }, { "G", NULL }, { NULL }};
{ "D", NULL }, static TreeItem R[] = {{ "A", A }, { "B", B }, { NULL }};
{ NULL }
};
static TreeItem item_name_1[] =
{
{ "E", NULL },
{ "F", NULL },
{ "G", NULL },
{ NULL }
};
static TreeItem root[] =
{
{ "A", item_name_0 },
{ "B", item_name_1 },
{ NULL }
};
static GtkTreeModel * static GtkTreeModel *
@ -82,7 +65,7 @@ create_model (void)
{ {
GtkTreeStore *model; GtkTreeStore *model;
GtkTreeIter iter; GtkTreeIter iter;
TreeItem *item_0 = root; TreeItem *item_0 = R;
/* create tree store */ /* create tree store */
model = gtk_tree_store_new (NUM_COLUMNS, model = gtk_tree_store_new (NUM_COLUMNS,
@ -97,7 +80,7 @@ create_model (void)
gtk_tree_store_append (model, &iter, NULL); gtk_tree_store_append (model, &iter, NULL);
gtk_tree_store_set (model, &iter, gtk_tree_store_set (model, &iter,
COLUMN_0, item_0->label, COLUMN_0, item_0->label,
// COLUMN_1, FALSE, COLUMN_1, item_1->label,
-1); -1);
/* add children */ /* add children */
@ -108,7 +91,7 @@ create_model (void)
gtk_tree_store_append (model, &child_iter, &iter); gtk_tree_store_append (model, &child_iter, &iter);
gtk_tree_store_set (model, &child_iter, gtk_tree_store_set (model, &child_iter,
COLUMN_0, item_1->label, COLUMN_0, item_1->label,
// COLUMN_1, item_1->label, // AA, COLUMN_1, item_1->label,
-1); -1);
item_1++; item_1++;