WIP: Trying to copy the first example of the tuto (this commit lists what I'm unable to adapt)

This commit is contained in:
Jean Sirmai 2023-11-25 10:29:08 +01:00
parent 1f96af32fd
commit fdc87782c6
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 35 additions and 9 deletions

View File

@ -32,6 +32,16 @@
int main(int argc, char **argv)
{
GtkWidget *window;
GtkWidget *view;
gtk_init();
// window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// g_signal_connect(window, "delete_event", gtk_main_quit, NULL); /* dirty */
g_signal_connect(window, "delete_event", NULL, NULL); /* dirty */
// view = create_view_and_model();
// gtk_container_add(GTK_CONTAINER(window), view);
// gtk_widget_show_all(window);
// gtk_main();
tree_c_test();

View File

@ -135,6 +135,8 @@ static void gem_graph_client_application_class_init(
app_class->activate = gem_graph_client_application_activate;
}
GemGraphClientApplication *gem_graph_client_application_new(
const char *application_id,
GApplicationFlags flags)

View File

@ -162,23 +162,37 @@ tree_c_test(void)
}
else g_error("Oops, we should have a first row in the tree store!\n");
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
GtkWidget *view;
GtkTreeModel *model;
GtkWidget *window;
tree_c_printing_test();
}
static void tree_c_printing_test(void)
{
printf("tree_c_printing_test() \
---------------------------------------------------------\n\n\
(https://en.wikibooks.org/wiki/GTK (modulo) 2B_By_Example/Tree_View/Tree_Models)\n\
(https://en.wikibooks.org/wiki/GTK (modulo) 2B_By_Example/Tree_View/Columns_and_Renderer)\n\n\
cf. tuto : gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT); - (cf. line 69)\n\
creates a new list store with two columns.\n\n\
gtk_tree_store_new(1, G_TYPE_STRING); - (cf. line 108)\n\
creates a new tree store with one column.\n\n\
Now : how to display in our window (/panel) what was stored in these models ?.\n\
(see the commented code at the end)\n");
------------------------------------------------------------------\n\
(https://en.wikibooks.org/wiki/GTK (modulo) 2B_By_Example/Tree_View/Columns_and_Renderer)\n\
Trying to adapt the first example of this tuto to display a simple tree view in our window.\n\
Can't use :\n\
- gtk_init(&argc, &argv);\n\
- window = gtk_tree_view_new(GTK_WINDOW_TOPLEVEL);\n\
- g_signal_connect(window, 'delete_event', gtk_main_quit, NULL);\n\
- tree_c_test(); (or : create_view_and_model() or some equivalent tree description)\n\
- gtk_container_add(GTK_CONTAINER(window), view);\n\
- gtk_widget_show_all(window);\n\
- gtk_main();\n\
(see main.c lines 35-44)\n\
");
}
// https://en.wikibooks.org/wiki/GTK%2B_By_Example/Tree_View/Tree_Models
/*
https://stackoverflow.com/questions/51002454/how-to-list-all-the-rows-of-a-gtk-treeview