diff --git a/include/graphics.h b/include/graphics.h index f30f7b1..8d622ee 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -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_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_colors_0_arrow = %p\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_plans_0_arrow = %p\n", graphic_stack[stack_id].buffer_plans_0_arrow); + printf("buffer_vertex_0_arrow = %ld\n", graphic_stack[stack_id].buffer_vertex_0_arrow); + printf("buffer_colors_0_arrow = %ld\n", graphic_stack[stack_id].buffer_colors_0_arrow); + printf("buffer_lines_0_arrow = %ld\n", graphic_stack[stack_id].buffer_lines_0_arrow); + printf("buffer_plans_0_arrow = %ld\n", graphic_stack[stack_id].buffer_plans_0_arrow); printf("********************\n"); n++; diff --git a/include/ui.h b/include/ui.h index a05c20d..60da546 100644 --- a/include/ui.h +++ b/include/ui.h @@ -133,7 +133,7 @@ void ui_model_loading(GObject *source_object, GAsyncResult *result, GemGraphClientWindow *self); -void ui_debug_model_loading (GemGraphClientWindow *self, const char *file); +void ui_debug_model_loading (GtkWindow *self, const char *file); // // General events // diff --git a/src/ui/application.c b/src/ui/application.c index 4a6ac6a..615a707 100644 --- a/src/ui/application.c +++ b/src/ui/application.c @@ -74,7 +74,7 @@ static void gem_graph_client_application_activate(GApplication *app) // Launch with sidebar off ui_toggle_sidebar(); 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); } diff --git a/src/ui/events.c b/src/ui/events.c index 55040d1..7aa0252 100644 --- a/src/ui/events.c +++ b/src/ui/events.c @@ -368,7 +368,7 @@ void ui_model_loading(GObject *source_object, 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; size_t length = 0; diff --git a/src/ui/views.c b/src/ui/views.c index af46956..d6d649a 100644 --- a/src/ui/views.c +++ b/src/ui/views.c @@ -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 *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; while (cur) { @@ -138,33 +138,48 @@ GListModel* ui_tree_create_model_func(GObject *item, gpointer root) 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 void ui_create_tree (GtkWidget *target_widget) { + assert(target_widget); + GtkStringList *model; GtkTreeListModel *tree_model; - GtkSignalListItemFactory *factory; + GtkListItemFactory *factory; GtkSingleSelection *selection_model; GtkWidget *list_view; GtkScrolledWindow *scrolled_window; - assert(target_widget); - - // 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); + struct TreeNode_t *tree_root = create_tree_node("Declaration"); + create_experimental_tree (tree_root); model = gtk_string_list_new(NULL); 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( G_LIST_MODEL(model), FALSE, // Passthrough - False in actual usage with dynamic children retrieval - FALSE, // autoexpand + FALSE, // TRUE, // FALSE, // autoexpand (GtkTreeListModelCreateModelFunc)ui_tree_create_model_func, tree_root, NULL //(GDestroyNotify)free_tree_node diff --git a/src/ui/window.c b/src/ui/window.c index c709c94..942e1c9 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -163,7 +163,7 @@ void ui_set_stack(int mode) gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic"); 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; case PRESENTATION_MODE: gtk_stack_set_visible_child_full(window->main_stack,