diff --git a/cold.d b/cold.d deleted file mode 100644 index 42ddb86..0000000 --- a/cold.d +++ /dev/null @@ -1 +0,0 @@ -cold.o: cold.c texts.h diff --git a/cold.o b/cold.o deleted file mode 100644 index 72d4e0c..0000000 Binary files a/cold.o and /dev/null differ diff --git a/contain.c b/contain.c index 88609a7..48d7111 100644 --- a/contain.c +++ b/contain.c @@ -5,7 +5,6 @@ #include "display.h" #include "contain.h" #include "texts.h" -#include "tree.h" GtkWidget *get_edit_rules_page_new(){ diff --git a/contain.d b/contain.d deleted file mode 100644 index 4bca4e9..0000000 --- a/contain.d +++ /dev/null @@ -1,3 +0,0 @@ -contain.o: contain.c hot.h warm.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - cold.h display.h contain.h texts.h tree.h diff --git a/contain.o b/contain.o deleted file mode 100644 index 1c53542..0000000 Binary files a/contain.o and /dev/null differ diff --git a/display.c b/display.c index a68c42d..16287cd 100644 --- a/display.c +++ b/display.c @@ -6,7 +6,6 @@ #include "display.h" #include "contain.h" #include "texts.h" -#include "tree.h" //------------------------------------------------------------------------------ @@ -265,7 +264,6 @@ GtkBox *get_experimental_box_new(){ GtkBox *get_rules_user_tree_new(){ GtkBox *tree_sketch_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); gtk_box_append (tree_sketch_box, GTK_WIDGET (get_experimental_box_new())); - ui_create_tree (GTK_WIDGET (tree_sketch_box)); return tree_sketch_box; } diff --git a/display.d b/display.d deleted file mode 100644 index 8677eb2..0000000 --- a/display.d +++ /dev/null @@ -1,3 +0,0 @@ -display.o: display.c hot.h warm.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - cold.h display.h contain.h texts.h tree.h diff --git a/display.o b/display.o deleted file mode 100644 index 0d06204..0000000 Binary files a/display.o and /dev/null differ diff --git a/hot.c b/hot.c index a0290f2..1345858 100644 --- a/hot.c +++ b/hot.c @@ -18,15 +18,10 @@ static struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;}; static struct TreeNode_t *create_tree_node (const gchar* text){ struct TreeNode_t *node = g_malloc0 (sizeof(struct TreeNode_t)); node->text = g_strdup(text); - node->child = NULL; // printf("create_tree_node %s\n", text); + node->child = NULL; // if (0) printf("create_tree_node %s\n", text); return node; } -/*static void on_experimental_expander_toggled(GtkExpander *expander, gpointer user_data){ - gtk_expander_set_expanded (expander, gtk_expander_get_expanded (expander)); - printf("> %s\n", gtk_expander_get_label (user_data)); -}*/ - static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){ if (parent->child) { struct TreeNode_t *cur = parent->child; @@ -54,30 +49,30 @@ static void on_experimental_tree_bind_factory (GtkSignalListItemFactory *factory g_signal_connect(expander, "activate", G_CALLBACK(on_experimental_tree_expander_toggled), row); gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row)*20); gboolean is_expanded = gtk_tree_list_row_get_expanded(row); - printf("[on_experimental_tree_bind_factory] row content is [%s] and expander is [%d]\n", text, is_expanded); - } else printf("[on_experimental_tree_bind_factory] row == NULL\n"); + if (0) printf("[on_experimental_tree_bind_factory] row content is [%s] and expander is [%d]\n", text, is_expanded); + } else if (0) printf("[on_experimental_tree_bind_factory] row == NULL\n"); } void on_experimental_tree_setup_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data){ GtkWidget* expander = gtk_expander_new (NULL); gtk_list_item_set_child (GTK_LIST_ITEM(object), expander); - printf("[on_experimental_tree_setup_factory] here is an expander\n"); + if (0) printf("[on_experimental_tree_setup_factory] here is an expander\n"); } static GListModel* get_experimental_tree_model_child (struct TreeNode_t *parent){ GtkStringList *list = NULL; if (parent) { - printf("[get_experimental_tree_model_child] here is %s content : ", parent->text); + if (0) printf("[get_experimental_tree_model_child] here is %s content : ", parent->text); struct TreeNode_t *child = parent->child; if (child) {list = gtk_string_list_new(NULL);} while(child) { gtk_string_list_append(list, child->text); - printf("%s ", child->text); + if (0) printf("%s ", child->text); child = child->next; } } - printf("\n"); + if (0) printf("\n"); return G_LIST_MODEL(list); } @@ -85,21 +80,19 @@ GListModel* create_experimental_tree_model (GObject *item, gpointer root){ struct TreeNode_t *cur = (struct TreeNode_t *)root; struct TreeNode_t *parent = root; const gchar *string = gtk_string_object_get_string (GTK_STRING_OBJECT(item)); - printf(">>> %s\n",string); while (cur) { if (strcmp(string, cur->text) == 0) break; cur = cur->next; if (cur == NULL) {cur = parent->child; parent = cur;} } - printf("[create_experimental_tree_model] looked for %s in %s item\n", cur->text, string); + if (0) printf("[create_experimental_tree_model] looked for %s in %s item\n", cur->text, string); return get_experimental_tree_model_child (cur); } void create_experimental_tree (GtkBox *experimental_box){ - GtkScrolledWindow *scrolled_window; struct TreeNode_t *tree_root = create_tree_node("hello"); struct TreeNode_t *it_s_me = create_tree_node("it's me"); add_child_node(tree_root, it_s_me); - struct TreeNode_t *remember = create_tree_node("remember"); add_child_node(it_s_me, remember); + struct TreeNode_t *remember = create_tree_node("do you remember ?"); add_child_node(it_s_me, remember); GtkStringList *model = gtk_string_list_new(NULL); gtk_string_list_append (model, tree_root->text); @@ -107,9 +100,6 @@ void create_experimental_tree (GtkBox *experimental_box){ g_signal_connect (factory, "setup", G_CALLBACK(on_experimental_tree_setup_factory), NULL); g_signal_connect (factory, "bind", G_CALLBACK(on_experimental_tree_bind_factory), NULL); -// GListModel *a_test = create_experimental_tree_model(G_OBJECT (model), tree_root); - printf("> %s > %s > %s\n", tree_root->text, it_s_me->text, remember->text); - GtkTreeListModel *tree_model = gtk_tree_list_model_new( G_LIST_MODEL (model), FALSE, // Passthrough - False in actual usage with dynamic children retrieval @@ -122,39 +112,13 @@ void create_experimental_tree (GtkBox *experimental_box){ GtkSingleSelection *selection_model = gtk_single_selection_new (G_LIST_MODEL (tree_model)); gtk_single_selection_set_autoselect (selection_model, FALSE); gtk_single_selection_set_can_unselect (selection_model, TRUE); - - GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model), - GTK_LIST_ITEM_FACTORY (factory)); - - scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); - gtk_scrolled_window_set_child(scrolled_window, list_view); - - gtk_scrolled_window_set_policy (scrolled_window, - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_vexpand(GTK_WIDGET(scrolled_window), TRUE); - - gtk_box_append(GTK_BOX(experimental_box), GTK_WIDGET(scrolled_window)); - gtk_widget_set_visible(GTK_WIDGET(scrolled_window), TRUE); + GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model), GTK_LIST_ITEM_FACTORY (factory)); + GtkScrolledWindow *experimental_scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); + gtk_scrolled_window_set_child(experimental_scrolled_window, list_view); + gtk_scrolled_window_set_policy (experimental_scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_widget_set_vexpand(GTK_WIDGET(experimental_scrolled_window), TRUE); + assert(experimental_box); + gtk_box_append(GTK_BOX(experimental_box), GTK_WIDGET(experimental_scrolled_window)); + gtk_widget_set_visible(GTK_WIDGET(experimental_scrolled_window), TRUE); gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE); - -// gtk_widget_set_visible(GTK_WIDGET(experimental_box), TRUE); -// gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE); } - -/* -[on_experimental_tree_setup_factory] here is an expander -[on_experimental_tree_bind_factory] row content is [hello] and expander is [0] - -[on_tree_setup_factory] here is an expander -[on_tree_bind_factory] here is Root content and expander is 0 - -[ui_tree_create_model_func] looked for Root in Root item -[ui_tree_get_children_model] here is Root content : ATP ADP AMP -[on_tree_setup_factory] here is an expander -[on_tree_bind_factory] here is ATP content and expander is 0 -[on_tree_setup_factory] here is an expander -[on_tree_bind_factory] here is ADP content and expander is 0 -[on_tree_setup_factory] here is an expander -[on_tree_bind_factory] here is AMP content and expander is 0 -*/ diff --git a/hot.d b/hot.d deleted file mode 100644 index 0a5b41c..0000000 --- a/hot.d +++ /dev/null @@ -1,3 +0,0 @@ -hot.o: hot.c warm.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - cold.h display.h contain.h texts.h diff --git a/hot.o b/hot.o deleted file mode 100644 index 5320991..0000000 Binary files a/hot.o and /dev/null differ diff --git a/main.d b/main.d deleted file mode 100644 index 969681a..0000000 --- a/main.d +++ /dev/null @@ -1,89 +0,0 @@ -main.o: main.c hot.h warm.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/galloca.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtypes.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/lib/glib-2.0/include/glibconfig.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmacros.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gversionmacros.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/glib-visibility.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/garray.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gasyncqueue.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gthread.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gatomic.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/glib-typeof.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gerror.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gquark.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gutils.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gbacktrace.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gbase64.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gbitlock.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gbookmarkfile.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gdatetime.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtimezone.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gbytes.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gcharset.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gchecksum.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gconvert.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gdataset.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gdate.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gdir.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/genviron.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gfileutils.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/ggettext.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/ghash.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/glist.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmem.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gnode.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/ghmac.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gchecksum.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/ghook.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/ghostutils.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/giochannel.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmain.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gpoll.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gslist.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gstring.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gunicode.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gstrfuncs.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gkeyfile.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmappedfile.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmarkup.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmessages.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gvariant.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gvarianttype.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/goption.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gpathbuf.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gpattern.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gprimes.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gqsort.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gqueue.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/grand.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/grcbox.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/grefcount.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/grefstring.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmem.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gmacros.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gregex.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gscanner.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gsequence.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gshell.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gslice.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gspawn.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gstringchunk.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gstrvbuilder.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtestutils.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gthreadpool.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtimer.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtrashstack.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gtree.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/guri.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/guuid.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/gversion.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/gallocator.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/gcache.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/gcompletion.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/gmain.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/grel.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/deprecated/gthread.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib/glib-autocleanups.h \ - cold.h display.h contain.h diff --git a/main.o b/main.o deleted file mode 100644 index 968e8d0..0000000 Binary files a/main.o and /dev/null differ diff --git a/myprogram b/myprogram deleted file mode 100755 index 41340d0..0000000 Binary files a/myprogram and /dev/null differ diff --git a/texts.d b/texts.d deleted file mode 100644 index 18de62c..0000000 --- a/texts.d +++ /dev/null @@ -1 +0,0 @@ -texts.o: texts.c diff --git a/texts.o b/texts.o deleted file mode 100644 index 4b12a90..0000000 Binary files a/texts.o and /dev/null differ diff --git a/tree.c b/tree.c deleted file mode 100644 index 89730da..0000000 --- a/tree.c +++ /dev/null @@ -1,252 +0,0 @@ -#include -#include - -#include "hot.h" -#include "warm.h" -#include "cold.h" -#include "display.h" -#include "contain.h" -#include "texts.h" - -// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery -// https://docs.gtk.org/gtk4/section-text-widget.html -// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management -// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL - - - -// Simplified TreeNode structure for demonstration purposes -// -------------------------------------------------------- - -/* - * Tree-related signals - */ - -void on_tree_expander_toggled(GtkExpander *expander, gpointer user_data) -{ - // This is a conceptual callback for when an expander is toggled - GtkTreeListRow *row = GTK_TREE_LIST_ROW(user_data); - gboolean is_expanded = gtk_tree_list_row_get_expanded(row); - gtk_tree_list_row_set_expanded(row, !is_expanded); -} - -void on_tree_setup_factory (GtkSignalListItemFactory *factory, - GObject* object, - gpointer user_data) -{ - GtkWidget* expander = gtk_expander_new (NULL); - gtk_list_item_set_child (GTK_LIST_ITEM(object), expander); - printf("[on_tree_setup_factory] here is an expander\n"); -} - -void on_tree_bind_factory (GtkSignalListItemFactory *factory, - GObject* object, - gpointer user_data) -{ -// GObject *item; - const gchar *text; - GtkTreeListRow *row; - GtkListItem *list_item; - GtkWidget *expander; - - list_item= GTK_LIST_ITEM(object); - row = gtk_list_item_get_item(list_item); - if (row != NULL) { - text = gtk_string_object_get_string(GTK_STRING_OBJECT(gtk_tree_list_row_get_item(row))); - expander = gtk_list_item_get_child(list_item); - gtk_expander_set_label(GTK_EXPANDER(expander), text); - - // Disconnect previous signal handlers to avoid stacking them - g_signal_handlers_disconnect_by_func(expander, G_CALLBACK(on_tree_expander_toggled), row); - - // Connect the signal handler - g_signal_connect(expander, "activate", G_CALLBACK(on_tree_expander_toggled), row); - - gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row)*20); - gboolean is_expanded = gtk_tree_list_row_get_expanded(row); - printf("[on_tree_bind_factory] here is %s content and expander is %d\n", - text, - is_expanded); - } else { - printf("[on_tree_bind_factory] here is NON content\n"); - } -} - -void on_tree_selection_changed (GtkSelectionModel* self, guint position, - guint n_items, gpointer user_data) -{ - printf("[on_tree_selection_changed]\n"); -} - -struct TreeNode_t -{ - gchar *text; - struct TreeNode_t *child; - struct TreeNode_t *next; -}; - -// Function to create a new TreeNode instance -static struct TreeNode_t *create_tree_node (const gchar* text) -{ - struct TreeNode_t *node = g_malloc0 (sizeof(struct TreeNode_t)); - node->text = g_strdup(text); - node->child = NULL; - return node; -} - -// Function to add a child node to a parent node -static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child) -{ - struct TreeNode_t *cur; - - if (parent->child) { - cur = parent->child; - while (cur && cur->next) { - cur = cur->next; - } - cur->next = child; - } else { - parent->child = child; - } -} - -// Recursive function to free a TreeNode and its children -// attention: « free_tree_node » défini mais pas utilisé <<< TODO -static void free_tree_node (struct TreeNode_t *node) -{ - struct TreeNode_t *cur; - struct TreeNode_t *tmp; - - if (!node) return; - - // free siblings - cur = node; - while (cur) { - tmp = cur->next; - g_free(cur); - cur = tmp; - } - - // recursive free - free_tree_node(node->child); - g_free(node->text); - g_free(node); -} - -// Function to simulate getting a GListModel of children for a given TreeNode -GListModel* ui_tree_get_children_model (struct TreeNode_t *parent) -{ - struct TreeNode_t *child; - - GtkStringList *list = NULL; - - if (parent) { - printf("[ui_tree_get_children_model] here is %s content : ", parent->text); - - child = parent->child; - - if (child) { - list = gtk_string_list_new(NULL); - } - while(child) { - gtk_string_list_append(list, child->text); - printf("%s ", child->text); - child = child->next; - } - } - printf("\n"); - - return G_LIST_MODEL(list); -} - -// GtkTreeListModelCreateModelFunc callback implementation -GListModel* ui_tree_create_model_func(GObject *item, gpointer root) -{ - struct TreeNode_t *cur = (struct TreeNode_t *)root; - struct TreeNode_t *parent = NULL; - - const gchar *string = gtk_string_object_get_string(GTK_STRING_OBJECT(item)); - - parent = root; - while (cur) { - if (strcmp(string, cur->text) == 0) { - break; - } - - cur = cur->next; - if (cur == NULL) { - cur = parent->child; - parent = cur; - } - } - - printf("[ui_tree_create_model_func] looked for %s in %s item\n", - cur->text, - string); - - return ui_tree_get_children_model(cur); -} - -// Application activation callback -void ui_create_tree (GtkWidget *target_widget) -{ - GtkStringList *model; - GtkTreeListModel *tree_model; - GtkSignalListItemFactory *factory; - GtkSingleSelection *selection_model; - GtkWidget *list_view; - GtkScrolledWindow *scrolled_window; - - assert(target_widget); - - struct TreeNode_t *tree_root = create_tree_node("Root"); // AD HOC XXX & no free() - struct TreeNode_t *ATP = create_tree_node("ATP"); add_child_node(tree_root, ATP); - struct TreeNode_t *ADP = create_tree_node("ADP"); add_child_node(tree_root, ADP); - struct TreeNode_t *AMP = create_tree_node("AMP"); add_child_node(tree_root, AMP); - struct TreeNode_t *adenine = create_tree_node("adénine"); add_child_node(ATP, adenine); - struct TreeNode_t *ribose = create_tree_node("ribose"); add_child_node(adenine, ribose); - struct TreeNode_t *PO4H3_1 = create_tree_node("phosphate 1"); add_child_node(ribose, PO4H3_1); - struct TreeNode_t *PO4H3_2 = create_tree_node("phosphate 2"); add_child_node(PO4H3_1, PO4H3_2); - struct TreeNode_t *PO4H3_3 = create_tree_node("phosphate 3"); add_child_node(PO4H3_2, PO4H3_3); - - model = gtk_string_list_new(NULL); - gtk_string_list_append(model, tree_root->text); - - // Create and setup the list view and item factory - factory = GTK_SIGNAL_LIST_ITEM_FACTORY (gtk_signal_list_item_factory_new ()); - g_signal_connect (factory, "setup", G_CALLBACK(on_tree_setup_factory), NULL); - g_signal_connect (factory, "bind", G_CALLBACK(on_tree_bind_factory), NULL); - - // Create a GtkTreeListModel - tree_model = gtk_tree_list_model_new( - G_LIST_MODEL(model), - FALSE, // Passthrough - False in actual usage with dynamic children retrieval - FALSE, // autoexpand - (GtkTreeListModelCreateModelFunc)ui_tree_create_model_func, - tree_root, - NULL //(GDestroyNotify)free_tree_node - ); - - selection_model = gtk_single_selection_new ( - G_LIST_MODEL (tree_model)); - - gtk_single_selection_set_autoselect (selection_model, FALSE); - gtk_single_selection_set_can_unselect (selection_model, TRUE); - /* g_signal_connect (selection_model, "selection-changed", */ - /* G_CALLBACK(on_tree_selection_changed), NULL); */ - - list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model), - GTK_LIST_ITEM_FACTORY (factory)); - - scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new()); - gtk_scrolled_window_set_child(scrolled_window, list_view); - - gtk_scrolled_window_set_policy (scrolled_window, - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_vexpand(GTK_WIDGET(scrolled_window), TRUE); - - gtk_box_append(GTK_BOX(target_widget), GTK_WIDGET(scrolled_window)); - gtk_widget_set_visible(GTK_WIDGET(scrolled_window), TRUE); - gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE); -} diff --git a/tree.d b/tree.d deleted file mode 100644 index a2c33ca..0000000 --- a/tree.d +++ /dev/null @@ -1,3 +0,0 @@ -tree.o: tree.c hot.h warm.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - cold.h display.h contain.h texts.h diff --git a/tree.h b/tree.h deleted file mode 100644 index 9fe09e2..0000000 --- a/tree.h +++ /dev/null @@ -1,10 +0,0 @@ -/******************************************************************************/ -/* */ -/* E coli by David S. Goodsell (2009) */ -/* --- */ -/* Let this freeze frame guide us towards the model */ -/* that alone can account for the phenomenon ! */ -/* */ -/******************************************************************************/ - -void ui_create_tree (GtkWidget *target_widget); diff --git a/tree.o b/tree.o deleted file mode 100644 index d82b4db..0000000 Binary files a/tree.o and /dev/null differ diff --git a/warm.d b/warm.d deleted file mode 100644 index ff34cde..0000000 --- a/warm.d +++ /dev/null @@ -1 +0,0 @@ -warm.o: warm.c cold.h display.h contain.h texts.h diff --git a/warm.o b/warm.o deleted file mode 100644 index 71e7f9f..0000000 Binary files a/warm.o and /dev/null differ