arbre GTK4 après nettoyage < prêt à être étudié

This commit is contained in:
Jean Sirmai 2024-05-14 22:03:49 +02:00
parent 41c8a9091f
commit 6eea250f71
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 13 additions and 10 deletions

View File

@ -15,6 +15,7 @@
#define W_IMAGE_LOCAL W / 16
#define H_IMAGE_LOCAL H / 16
GtkWidget *get_selected_rules_vpaned_new();
void activate (GtkApplication *app, gpointer user_data);

22
hot.c
View File

@ -43,7 +43,7 @@ void on_tree_bind_factory (GtkSignalListItemFactory *factory,
GObject* object,
gpointer user_data)
{
GObject *item;
// GObject *item;
const gchar *text;
GtkTreeListRow *row;
GtkListItem *list_item;
@ -111,6 +111,7 @@ static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *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;
@ -164,7 +165,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) {
@ -222,7 +223,7 @@ static void ui_create_tree (GtkWidget *target_widget)
gtk_string_list_append(model, tree_root->text);
// Create and setup the list view and item factory
factory = gtk_signal_list_item_factory_new ();
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);
@ -244,9 +245,10 @@ static void ui_create_tree (GtkWidget *target_widget)
/* g_signal_connect (selection_model, "selection-changed", */
/* G_CALLBACK(on_tree_selection_changed), NULL); */
list_view = gtk_list_view_new (selection_model, factory);
list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection_model),
GTK_LIST_ITEM_FACTORY (factory));
scrolled_window = gtk_scrolled_window_new();
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,
@ -255,8 +257,8 @@ static void ui_create_tree (GtkWidget *target_widget)
gtk_widget_set_vexpand(GTK_WIDGET(scrolled_window), TRUE);
gtk_box_append(GTK_BOX(target_widget), GTK_WIDGET(scrolled_window));
gtk_widget_show(GTK_WIDGET(scrolled_window));
gtk_widget_show(GTK_WIDGET(list_view));
gtk_widget_set_visible(GTK_WIDGET(scrolled_window), TRUE);
gtk_widget_set_visible(GTK_WIDGET(list_view), TRUE);
}
GtkBox *get_rules_user_tree_new(){
@ -264,7 +266,7 @@ GtkBox *get_rules_user_tree_new(){
// gtk_box_append (tree_sketch, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
// gtk_box_append (tree_sketch, GTK_WIDGET (get_user_tree()));
// gtk_box_append (tree_sketch, GTK_WIDGET(gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
ui_create_tree(tree_sketch);
ui_create_tree(GTK_WIDGET (tree_sketch));
return tree_sketch;
}
@ -290,8 +292,8 @@ GtkBox *get_rules_comparator_new(){
GtkWidget *get_rules_tree_hpaned_new(){
GtkPaned *H_tree_vs_comparison = GTK_PANED (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL));
GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
// GtkWidget *arbre_des_règles = gtk_frame_new ("Arbre");
// GtkWidget *comparaison_des_règles_sélectionnées = gtk_frame_new ("Sélection");
gtk_paned_set_start_child (H_tree_vs_comparison, GTK_WIDGET (get_rules_user_tree_new()));
gtk_paned_set_end_child (H_tree_vs_comparison, GTK_WIDGET (get_rules_comparator_new()));

BIN
hot.o

Binary file not shown.

BIN
main.o

Binary file not shown.

BIN
myprogram

Binary file not shown.