only the first branch of the tree can be copletely deployed

This commit is contained in:
Jean Sirmai 2024-05-23 20:30:59 +02:00
parent 4cc6bda354
commit 8e06ad1be4
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 43 additions and 28 deletions

View File

@ -243,10 +243,10 @@ static inline void print_stack(int stack_id)
printf("buffer_lines_size = %ld\n", graphic_stack[stack_id].buffer_lines_size); printf("buffer_lines_size = %ld\n", graphic_stack[stack_id].buffer_lines_size);
printf("buffer_plans_size = %ld\n", graphic_stack[stack_id].buffer_plans_size); printf("buffer_plans_size = %ld\n", graphic_stack[stack_id].buffer_plans_size);
printf("buffer_vertex_0_arrow = %p\n", graphic_stack[stack_id].buffer_vertex_0_arrow); printf("buffer_vertex_0_arrow = %ld\n", graphic_stack[stack_id].buffer_vertex_0_arrow);
printf("buffer_colors_0_arrow = %p\n", graphic_stack[stack_id].buffer_colors_0_arrow); printf("buffer_colors_0_arrow = %ld\n", graphic_stack[stack_id].buffer_colors_0_arrow);
printf("buffer_lines_0_arrow = %p\n", graphic_stack[stack_id].buffer_lines_0_arrow); printf("buffer_lines_0_arrow = %ld\n", graphic_stack[stack_id].buffer_lines_0_arrow);
printf("buffer_plans_0_arrow = %p\n", graphic_stack[stack_id].buffer_plans_0_arrow); printf("buffer_plans_0_arrow = %ld\n", graphic_stack[stack_id].buffer_plans_0_arrow);
printf("********************\n"); printf("********************\n");
n++; n++;

View File

@ -133,7 +133,7 @@ void ui_model_loading(GObject *source_object,
GAsyncResult *result, GAsyncResult *result,
GemGraphClientWindow *self); GemGraphClientWindow *self);
void ui_debug_model_loading (GemGraphClientWindow *self, const char *file); void ui_debug_model_loading (GtkWindow *self, const char *file);
// //
// General events // General events
// //

View File

@ -74,7 +74,7 @@ static void gem_graph_client_application_activate(GApplication *app)
// Launch with sidebar off // Launch with sidebar off
ui_toggle_sidebar(); ui_toggle_sidebar();
ui_set_stack(HOME_MODE); ui_set_stack(HOME_MODE);
ui_debug_model_loading(window, "data/models/dimers random walk.xml"); ui_debug_model_loading (window, "data/models/dimers random walk.xml");
gtk_window_present(window); gtk_window_present(window);
} }

View File

@ -368,7 +368,7 @@ void ui_model_loading(GObject *source_object,
g_free(content); g_free(content);
} }
void ui_debug_model_loading (GemGraphClientWindow *self, const char *file) void ui_debug_model_loading (GtkWindow *self, const char *file)
{ {
char *content = NULL; char *content = NULL;
size_t length = 0; size_t length = 0;

View File

@ -116,7 +116,7 @@ GListModel* ui_tree_create_model_func(GObject *item, gpointer root)
struct TreeNode_t *cur = (struct TreeNode_t *)root; struct TreeNode_t *cur = (struct TreeNode_t *)root;
struct TreeNode_t *parent = NULL; struct TreeNode_t *parent = NULL;
gchar *string = gtk_string_object_get_string(GTK_STRING_OBJECT(item)); const gchar *string = gtk_string_object_get_string (GTK_STRING_OBJECT (item));
parent = root; parent = root;
while (cur) { while (cur) {
@ -138,33 +138,48 @@ GListModel* ui_tree_create_model_func(GObject *item, gpointer root)
return ui_tree_get_children_model(cur); return ui_tree_get_children_model(cur);
} }
static void create_experimental_tree (struct TreeNode_t *tree_root) // AD HOC XXX & no free()
{
struct TreeNode_t *a = create_tree_node("We, the users"); add_child_node(tree_root, a);
struct TreeNode_t *b = create_tree_node("in Order to"); add_child_node(tree_root, b);
struct TreeNode_t *c = create_tree_node("do establish"); add_child_node(tree_root, c);
struct TreeNode_t *aa = create_tree_node("aware of"); add_child_node(a, aa);
struct TreeNode_t *aaa = create_tree_node("our duties"); add_child_node(aa, aaa);
struct TreeNode_t *aab = create_tree_node("our rights"); add_child_node(aa, aab);
struct TreeNode_t *aaaa = create_tree_node("learn"); add_child_node(aaa, aaaa);
struct TreeNode_t *aaab = create_tree_node("help"); add_child_node(aaa, aaab);
struct TreeNode_t *aaba = create_tree_node("read"); add_child_node(aab, aaba);
struct TreeNode_t *aabb = create_tree_node("write"); add_child_node(aab, aabb);
struct TreeNode_t *aabc = create_tree_node("copy"); add_child_node(aab, aabc);
struct TreeNode_t *aabd = create_tree_node("edit"); add_child_node(aab, aabd);
struct TreeNode_t *ba = create_tree_node("promote"); add_child_node(b, ba);
struct TreeNode_t *bb = create_tree_node("individual"); add_child_node(b, bb);
struct TreeNode_t *bc = create_tree_node("and common"); add_child_node(b, bc);
struct TreeNode_t *bca = create_tree_node("education"); add_child_node(bc, bca);
struct TreeNode_t *bcb = create_tree_node("mutual"); add_child_node(bc, bcb);
struct TreeNode_t *bcc = create_tree_node("support"); add_child_node(bc, bcc);
struct TreeNode_t *bcd = create_tree_node("health"); add_child_node(bc, bcd);
struct TreeNode_t *bcda = create_tree_node("mental"); add_child_node(bcd, bcda);
struct TreeNode_t *bcdb = create_tree_node("physical"); add_child_node(bcd, bcdb);
struct TreeNode_t *ca = create_tree_node("free"); add_child_node(c, ca);
struct TreeNode_t *cb = create_tree_node("code"); add_child_node(c, cb);
struct TreeNode_t *cc = create_tree_node("access"); add_child_node(c, cc);
}
// Application activation callback // Application activation callback
void ui_create_tree (GtkWidget *target_widget) void ui_create_tree (GtkWidget *target_widget)
{ {
assert(target_widget);
GtkStringList *model; GtkStringList *model;
GtkTreeListModel *tree_model; GtkTreeListModel *tree_model;
GtkSignalListItemFactory *factory; GtkListItemFactory *factory;
GtkSingleSelection *selection_model; GtkSingleSelection *selection_model;
GtkWidget *list_view; GtkWidget *list_view;
GtkScrolledWindow *scrolled_window; GtkScrolledWindow *scrolled_window;
assert(target_widget); struct TreeNode_t *tree_root = create_tree_node("Declaration");
create_experimental_tree (tree_root);
// AD HOC XXX & no free()
struct TreeNode_t *tree_root = create_tree_node("Root");
struct TreeNode_t *A1 = create_tree_node("A1");
struct TreeNode_t *A2 = create_tree_node("A2");
struct TreeNode_t *A3 = create_tree_node("A3");
struct TreeNode_t *B1 = create_tree_node("B1");
struct TreeNode_t *B2 = create_tree_node("B2");
struct TreeNode_t *B3 = create_tree_node("B3");
struct TreeNode_t *C = create_tree_node("C");
add_child_node(tree_root, A1);
add_child_node(tree_root, A2);
add_child_node(tree_root, A3);
add_child_node(A1, B1);
add_child_node(B1, C);
model = gtk_string_list_new(NULL); model = gtk_string_list_new(NULL);
gtk_string_list_append(model, tree_root->text); gtk_string_list_append(model, tree_root->text);
@ -178,7 +193,7 @@ void ui_create_tree (GtkWidget *target_widget)
tree_model = gtk_tree_list_model_new( tree_model = gtk_tree_list_model_new(
G_LIST_MODEL(model), G_LIST_MODEL(model),
FALSE, // Passthrough - False in actual usage with dynamic children retrieval FALSE, // Passthrough - False in actual usage with dynamic children retrieval
FALSE, // autoexpand FALSE, // TRUE, // FALSE, // autoexpand
(GtkTreeListModelCreateModelFunc)ui_tree_create_model_func, (GtkTreeListModelCreateModelFunc)ui_tree_create_model_func,
tree_root, tree_root,
NULL //(GDestroyNotify)free_tree_node NULL //(GDestroyNotify)free_tree_node

View File

@ -163,7 +163,7 @@ void ui_set_stack(int mode)
gtk_menu_button_set_icon_name(window->main_button_mode, gtk_menu_button_set_icon_name(window->main_button_mode,
"system-run-symbolic"); "system-run-symbolic");
ui_setup_glarea(RUN_MODE, GTK_WIDGET(window->run_glarea_box)); ui_setup_glarea(RUN_MODE, GTK_WIDGET(window->run_glarea_box));
ui_create_tree(window->run_conditions_tree_box); ui_create_tree (GTK_WIDGET (window->run_conditions_tree_box));
break; break;
case PRESENTATION_MODE: case PRESENTATION_MODE:
gtk_stack_set_visible_child_full(window->main_stack, gtk_stack_set_visible_child_full(window->main_stack,