gtk_single_selection_new < it works fine ! (see line 60 in the sand_box)
This commit is contained in:
parent
f44c7d1f1e
commit
aff067662d
|
@ -30,7 +30,6 @@
|
|||
|
||||
static void on_destroy (GtkWidget *widget, gpointer data) {if (data) g_print (data); exit(0);}
|
||||
|
||||
|
||||
static void setup_cb (GtkSignalListItemFactory *self, GtkListItem *listitem, gpointer user_data) {
|
||||
GtkWidget *my_label = gtk_label_new (NULL);
|
||||
gtk_list_item_set_child (listitem, my_label);
|
||||
|
@ -49,16 +48,16 @@ static void bind_cb (GtkSignalListItemFactory *self, GtkListItem *listitem, gpoi
|
|||
static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
||||
{
|
||||
const gchar *my_array[] = {"zero", "one", "two", "three", "four", "five",
|
||||
"six", "seven", "eight", "nine", "ten", "eleven", "twelve", NULL};
|
||||
// https://toshiocp.github.io/Gtk4-tutorial/sec29.html
|
||||
"six", "seven", "eight", "nine", "ten", "eleven", "twelve", NULL};
|
||||
// https://toshiocp.github.io/Gtk4-tutorial/sec29.html
|
||||
|
||||
GtkStringList *my_string_list = gtk_string_list_new ((const char * const *) my_array);
|
||||
|
||||
gint selected = 3;
|
||||
gint selected = 7;
|
||||
if (1) printf("The item n°%d of my array is the string \"%s\"\n",\
|
||||
selected, gtk_string_list_get_string (my_string_list, selected));
|
||||
|
||||
GtkNoSelection *my_selection = gtk_no_selection_new (G_LIST_MODEL (my_string_list));
|
||||
GtkNoSelection *my_selection = gtk_single_selection_new (G_LIST_MODEL (my_string_list));
|
||||
|
||||
GtkListItemFactory *my_factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (my_factory, "setup", G_CALLBACK (setup_cb), NULL);
|
||||
|
@ -89,4 +88,3 @@ void on_activate_window_creation (GtkApplication *app, gpointer data) {
|
|||
// guix shell -m manifest.scm && pkg-config --libs gtk4 make clean && clear && time make run
|
||||
// my local widgets examples are in user/jean/01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue