WIP: (1) à commenter. (2) remplacer le bouton par un arbre.

This commit is contained in:
Jean Sirmai 2023-11-29 20:24:38 +01:00
parent 7683d71d5e
commit 48ef1448eb
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 30 additions and 9 deletions

View File

@ -53,6 +53,16 @@ create_and_fill_model (void)
/* Append a top level row and leave it empty */
gtk_tree_store_append(treestore, &toplevel, NULL);
gtk_tree_store_set(treestore, &toplevel,
COL_FIRST_NAME, "RanTanPlan",
COL_LAST_NAME, "(dog)",
-1);
gtk_tree_store_append(treestore, &toplevel, NULL);
gtk_tree_store_set(treestore, &toplevel,
COL_FIRST_NAME, "Ma",
COL_LAST_NAME, "Dalton",
-1);
/* Append a second top level row, and fill it with some data */
gtk_tree_store_append(treestore, &toplevel, NULL);
@ -61,6 +71,18 @@ create_and_fill_model (void)
COL_LAST_NAME, "Dalton",
-1);
gtk_tree_store_append(treestore, &toplevel, NULL);
gtk_tree_store_set(treestore, &toplevel,
COL_FIRST_NAME, "Jack",
COL_LAST_NAME, "Dalton",
-1);
gtk_tree_store_append(treestore, &toplevel, NULL);
gtk_tree_store_set(treestore, &toplevel,
COL_FIRST_NAME, "William",
COL_LAST_NAME, "Dalton",
-1);
/* Append a child to the second top level row, and fill in some data */
gtk_tree_store_append(treestore, &child, &toplevel);
gtk_tree_store_set(treestore, &child,
@ -176,11 +198,8 @@ tree_c_test(void)
static void tree_c_printing_test(void)
{
printf("tree.c tree_c_printing_test() \
------------------------------------\n\
A button is now in the GtkBox *runlib_objects of windows.c (line 61)\n\
How to associate an action to it\n\
?\n\
");
-------------------------------\n\
A button is now in the GtkBox and an action is associated to it.\n\n");
}
/*

View File

@ -124,7 +124,6 @@ void ui_set_stack(const char *mode)
break;
case 'r':
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
// create_tree_label();
create_tree_button();
break;
case 'p':
@ -243,14 +242,17 @@ GtkWidget *create_tree_label(void)
return label;
}
#include <gtk/gtk.h>
static void
print_hello (GtkWidget *widget,
gpointer data)
{
printf("Yes. I'm the new button <-> I've been clicked !!!\n");
// return GDK_EVENT_STOP;
static int nb;
nb++;
printf("Button clicked (n = %d)\n", nb);
}
GtkWidget *create_tree_button(void)
@ -263,10 +265,10 @@ GtkWidget *create_tree_button(void)
gtk_widget_show(button);
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
//g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
tree_c_test();
return button;
}
/* https://docs.gtk.org/gtk4/getting_started.html */