WIP: simplifications removing the gboolean in struct _TreeItem

This commit is contained in:
Jean Sirmai 2023-12-15 11:02:53 +01:00
parent 8cc77af4f5
commit db3043c274
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 9 additions and 17 deletions

View File

@ -42,8 +42,7 @@ typedef struct _TreeItem TreeItem;
struct _TreeItem struct _TreeItem
{ {
const char *label; const char *label;
gboolean AA; // gboolean AA;
// gboolean CC;
TreeItem *children; TreeItem *children;
}; };
@ -52,31 +51,29 @@ enum
{ {
COLUMN_0, COLUMN_0,
COLUMN_1, COLUMN_1,
// VISIBLE_COLUMN,
NUM_COLUMNS NUM_COLUMNS
}; };
/* tree data */ /* tree data */
static TreeItem item_name_0[] = static TreeItem item_name_0[] =
{ {
{ "A", TRUE, NULL }, { "A", NULL },
{ "B", FALSE, NULL }, { "B", NULL },
{ NULL } { NULL }
}; };
static TreeItem item_name_1[] = static TreeItem item_name_1[] =
{ {
{ "A", FALSE, NULL }, { "A", NULL },
{ "B", TRUE, NULL }, { "B", NULL },
{ "C", FALSE, NULL }, { "C", NULL },
{ NULL } { NULL }
}; };
static TreeItem root[] = static TreeItem root[] =
{ {
{ "IT-0", FALSE, item_name_0 }, { "IT-0", item_name_0 },
{ "IT-1", FALSE, item_name_1 }, { "IT-1", item_name_1 },
{ NULL } { NULL }
}; };
@ -91,9 +88,6 @@ create_model (void)
/* create tree store */ /* create tree store */
model = gtk_tree_store_new (NUM_COLUMNS, model = gtk_tree_store_new (NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN); G_TYPE_BOOLEAN);
/* add data to the tree store */ /* add data to the tree store */
@ -105,7 +99,6 @@ create_model (void)
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, FALSE,
// VISIBLE_COLUMN, FALSE,
-1); -1);
/* add children */ /* add children */
@ -116,8 +109,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->AA, COLUMN_1, item_1->label, // AA,
// VISIBLE_COLUMN, TRUE,
-1); -1);
item_1++; item_1++;