From 8cc77af4f5c633c2ba3e9d8eeb02307092f429ad Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 15 Dec 2023 10:54:05 +0100 Subject: [PATCH] WIP: simplifications removing the so called 'VISIBLE_COLUMN' --- demos/gtk-demo/tree_store.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index 16506b7..f79656b 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -43,7 +43,7 @@ struct _TreeItem { const char *label; gboolean AA; - gboolean CC; +// gboolean CC; TreeItem *children; }; @@ -53,41 +53,30 @@ enum COLUMN_0, COLUMN_1, - VISIBLE_COLUMN, -// WORLD_COLUMN, +// VISIBLE_COLUMN, NUM_COLUMNS }; /* tree data */ static TreeItem item_name_0[] = { - { "A", TRUE, TRUE, NULL }, - { "B", FALSE, TRUE, NULL }, - { "C", FALSE, TRUE, NULL }, + { "A", TRUE, NULL }, + { "B", FALSE, NULL }, { NULL } }; static TreeItem item_name_1[] = { - { "A", FALSE, TRUE, NULL }, - { "B", TRUE, FALSE, NULL }, - { "C", FALSE, TRUE, NULL }, - { "D", FALSE, TRUE, NULL }, - { NULL } -}; - -static TreeItem item_name_2[] = -{ - { "A", FALSE, FALSE, NULL }, - { "B", FALSE, TRUE, NULL }, + { "A", FALSE, NULL }, + { "B", TRUE, NULL }, + { "C", FALSE, NULL }, { NULL } }; static TreeItem root[] = { - { "IT-0", FALSE, FALSE, item_name_0 }, - { "IT-1", FALSE, FALSE, item_name_1 }, - { "IT-2", FALSE, FALSE, item_name_2 }, + { "IT-0", FALSE, item_name_0 }, + { "IT-1", FALSE, item_name_1 }, { NULL } }; @@ -116,8 +105,7 @@ create_model (void) gtk_tree_store_set (model, &iter, COLUMN_0, item_0->label, COLUMN_1, FALSE, - VISIBLE_COLUMN, FALSE, - // WORLD_COLUMN, FALSE, + // VISIBLE_COLUMN, FALSE, -1); /* add children */ @@ -129,8 +117,7 @@ create_model (void) gtk_tree_store_set (model, &child_iter, COLUMN_0, item_1->label, COLUMN_1, item_1->AA, - VISIBLE_COLUMN, TRUE, - // WORLD_COLUMN, item_1->CC, + // VISIBLE_COLUMN, TRUE, -1); item_1++; @@ -208,7 +195,7 @@ do_tree_store (GtkWidget *do_widget) /* expand all rows after the treeview widget has been realized */ g_signal_connect (treeview, "realize", G_CALLBACK (gtk_tree_view_expand_all), NULL); - gtk_window_set_default_size (GTK_WINDOW (window), 200, 350); + gtk_window_set_default_size (GTK_WINDOW (window), 200, 250); } if (!gtk_widget_get_visible (window))