WIP: simplifications removing COLUMN_1

This commit is contained in:
Jean Sirmai 2023-12-15 11:12:24 +01:00
parent db3043c274
commit f6affc1ebf
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 13 additions and 14 deletions

View File

@ -42,7 +42,6 @@ typedef struct _TreeItem TreeItem;
struct _TreeItem struct _TreeItem
{ {
const char *label; const char *label;
// gboolean AA;
TreeItem *children; TreeItem *children;
}; };
@ -50,30 +49,30 @@ 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 item_name_0[] =
{ {
{ "A", NULL }, { "C", NULL },
{ "B", NULL }, { "D", NULL },
{ NULL } { NULL }
}; };
static TreeItem item_name_1[] = static TreeItem item_name_1[] =
{ {
{ "A", NULL }, { "E", NULL },
{ "B", NULL }, { "F", NULL },
{ "C", NULL }, { "G", NULL },
{ NULL } { NULL }
}; };
static TreeItem root[] = static TreeItem root[] =
{ {
{ "IT-0", item_name_0 }, { "A", item_name_0 },
{ "IT-1", item_name_1 }, { "B", item_name_1 },
{ NULL } { NULL }
}; };
@ -98,7 +97,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, FALSE,
-1); -1);
/* add children */ /* add children */
@ -109,7 +108,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, // AA,
-1); -1);
item_1++; item_1++;
@ -130,9 +129,9 @@ add_columns (GtkTreeView *treeview)
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1,
"Col 0", renderer, "text", COLUMN_0, NULL); "Col 0", renderer, "text", COLUMN_0, NULL);
renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); /* renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); */
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, /* gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, */
"Col 1", renderer, "text", COLUMN_1, NULL); /* "Col 1", renderer, "text", COLUMN_1, NULL); */
} }
GtkWidget * GtkWidget *