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