WIP: (1) à commenter. (2) remplacer le bouton par un arbre.
This commit is contained in:
parent
7683d71d5e
commit
48ef1448eb
|
@ -53,6 +53,16 @@ create_and_fill_model (void)
|
||||||
|
|
||||||
/* Append a top level row and leave it empty */
|
/* Append a top level row and leave it empty */
|
||||||
gtk_tree_store_append(treestore, &toplevel, NULL);
|
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 */
|
/* Append a second top level row, and fill it with some data */
|
||||||
gtk_tree_store_append(treestore, &toplevel, NULL);
|
gtk_tree_store_append(treestore, &toplevel, NULL);
|
||||||
|
@ -61,6 +71,18 @@ create_and_fill_model (void)
|
||||||
COL_LAST_NAME, "Dalton",
|
COL_LAST_NAME, "Dalton",
|
||||||
-1);
|
-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 */
|
/* Append a child to the second top level row, and fill in some data */
|
||||||
gtk_tree_store_append(treestore, &child, &toplevel);
|
gtk_tree_store_append(treestore, &child, &toplevel);
|
||||||
gtk_tree_store_set(treestore, &child,
|
gtk_tree_store_set(treestore, &child,
|
||||||
|
@ -176,11 +198,8 @@ tree_c_test(void)
|
||||||
static void tree_c_printing_test(void)
|
static void tree_c_printing_test(void)
|
||||||
{
|
{
|
||||||
printf("tree.c tree_c_printing_test() \
|
printf("tree.c tree_c_printing_test() \
|
||||||
------------------------------------\n\
|
-------------------------------\n\
|
||||||
A button is now in the GtkBox *runlib_objects of windows.c (line 61)\n\
|
A button is now in the GtkBox and an action is associated to it.\n\n");
|
||||||
How to associate an action to it\n\
|
|
||||||
?\n\
|
|
||||||
");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -124,7 +124,6 @@ void ui_set_stack(const char *mode)
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
||||||
// create_tree_label();
|
|
||||||
create_tree_button();
|
create_tree_button();
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
|
@ -243,14 +242,17 @@ GtkWidget *create_tree_label(void)
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_hello (GtkWidget *widget,
|
print_hello (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
printf("Yes. I'm the new button <-> I've been clicked !!!\n");
|
static int nb;
|
||||||
// return GDK_EVENT_STOP;
|
nb++;
|
||||||
|
printf("Button clicked (n = %d)\n", nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *create_tree_button(void)
|
GtkWidget *create_tree_button(void)
|
||||||
|
@ -263,10 +265,10 @@ GtkWidget *create_tree_button(void)
|
||||||
gtk_widget_show(button);
|
gtk_widget_show(button);
|
||||||
|
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
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();
|
tree_c_test();
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* https://docs.gtk.org/gtk4/getting_started.html */
|
||||||
|
|
Loading…
Reference in New Issue