WIP: micro commit
This commit is contained in:
parent
d221074f2e
commit
104455593f
|
@ -33,8 +33,8 @@ void on_activate_window_creation (GtkApplication *app, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *that_window = gtk_application_window_new (gtk_application_new ("org.gtk.test", 0));
|
GtkWidget *that_window = gtk_application_window_new (gtk_application_new ("org.gtk.test", 0));
|
||||||
g_signal_connect (G_OBJECT (that_window), "destroy", G_CALLBACK(on_destroy), "exit(0) closes window\n");
|
g_signal_connect (G_OBJECT (that_window), "destroy", G_CALLBACK(on_destroy), "exit(0) closes window\n");
|
||||||
gtk_window_set_title (GTK_WINDOW(that_window), "Gloups ! Who am I ? Oooh...");
|
gtk_window_set_title (GTK_WINDOW(that_window), "Ignition !");
|
||||||
gtk_window_set_default_size (GTK_WINDOW(that_window), 300, 160);
|
gtk_window_set_default_size (GTK_WINDOW(that_window), 180, 140);
|
||||||
GtkWidget *my_scrolling_thing = gtk_scrolled_window_new ();
|
GtkWidget *my_scrolling_thing = gtk_scrolled_window_new ();
|
||||||
gtk_window_set_child (GTK_WINDOW (that_window), my_scrolling_thing);
|
gtk_window_set_child (GTK_WINDOW (that_window), my_scrolling_thing);
|
||||||
gtk_widget_show (that_window);
|
gtk_widget_show (that_window);
|
||||||
|
@ -68,7 +68,7 @@ static void on_selection_change (GtkSelectionModel* my_selection_model, guint p
|
||||||
g_list_model_get_n_items (my_selection_model),
|
g_list_model_get_n_items (my_selection_model),
|
||||||
g_list_model_get_item_type(my_selection_model),
|
g_list_model_get_item_type(my_selection_model),
|
||||||
position,
|
position,
|
||||||
gtk_string_object_get_string(g_list_model_get_item(my_selection_model, position)),
|
gtk_string_list_get_string (my_selection_model, position),
|
||||||
n_items );
|
n_items );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ GListModel *my_item_create_func (gpointer item, gpointer user_data)
|
||||||
{
|
{
|
||||||
printf("%s ", gtk_string_object_get_string(item));
|
printf("%s ", gtk_string_object_get_string(item));
|
||||||
gchar *my_child_array[] = {"1", "2", "3", NULL};
|
gchar *my_child_array[] = {"1", "2", "3", NULL};
|
||||||
|
|
||||||
if (gtk_string_object_get_string(item) == "zero") {
|
if (gtk_string_object_get_string(item) == "zero") {
|
||||||
GtkWidget *my_expander = gtk_expander_new (my_child_array);
|
GtkWidget *my_expander = gtk_expander_new (my_child_array);
|
||||||
gtk_expander_set_child (my_expander, NULL);
|
gtk_expander_set_child (my_expander, NULL);
|
||||||
|
@ -93,9 +94,8 @@ GListModel *my_item_create_func (gpointer item, gpointer user_data)
|
||||||
static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
||||||
{
|
{
|
||||||
const gchar *my_array[] = {"zero", "one", "two", "three", "four", NULL};
|
const gchar *my_array[] = {"zero", "one", "two", "three", "four", NULL};
|
||||||
|
|
||||||
GtkStringList *my_string_list = gtk_string_list_new ((const char * const *) my_array);
|
GtkStringList *my_string_list = gtk_string_list_new ((const char * const *) my_array);
|
||||||
|
gtk_string_list_append (my_string_list, "five");
|
||||||
GtkMultiSelection *my_selection_model = gtk_multi_selection_new (G_LIST_MODEL (my_string_list));
|
GtkMultiSelection *my_selection_model = gtk_multi_selection_new (G_LIST_MODEL (my_string_list));
|
||||||
|
|
||||||
/* if (gtk_single_selection_get_selected_item (my_selection_model)) */
|
/* if (gtk_single_selection_get_selected_item (my_selection_model)) */
|
||||||
|
@ -104,7 +104,7 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
||||||
GtkListItemFactory *my_list_item_factory = gtk_signal_list_item_factory_new ();
|
GtkListItemFactory *my_list_item_factory = gtk_signal_list_item_factory_new ();
|
||||||
g_signal_connect (my_list_item_factory, "setup", G_CALLBACK (on_setup_cb), NULL);
|
g_signal_connect (my_list_item_factory, "setup", G_CALLBACK (on_setup_cb), NULL);
|
||||||
g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_cb), NULL);
|
g_signal_connect (my_list_item_factory, "bind", G_CALLBACK (on_bind_cb), NULL);
|
||||||
if (0) { g_signal_connect (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);}
|
if (1) { g_signal_connect (my_selection_model, "selection-changed", G_CALLBACK (on_selection_change), NULL);}
|
||||||
|
|
||||||
|
|
||||||
// GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ?
|
// GListModel *(* GtkTreeListModelCreateModelFunc) (GObject* item, gpointer user_data) // remplacerait gtk_string_list_new() ?
|
||||||
|
@ -112,7 +112,8 @@ static void and_now_let_s_climb_that_tree (GtkWidget *in_that_box)
|
||||||
// https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html
|
// https://docs.gtk.org/gtk4/method.TreeListRow.set_expanded.html
|
||||||
|
|
||||||
GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (my_selection_model, 1, 1, my_item_create_func, NULL, NULL);
|
GtkTreeListModel *my_tree_list_model = gtk_tree_list_model_new (my_selection_model, 1, 1, my_item_create_func, NULL, NULL);
|
||||||
printf("in : GListModel *item_create_func (gpointer item,...) (line 80)\n");
|
int rank = 0; printf("in : GListModel *item_create_func (gpointer item,...) (line 80) (item n°%d is %s)\n",
|
||||||
|
rank, gtk_string_list_get_string (my_string_list, rank));
|
||||||
|
|
||||||
GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory);
|
GtkWidget *my_list_view = gtk_list_view_new (GTK_SELECTION_MODEL (my_selection_model), my_list_item_factory);
|
||||||
// GtkWidget *my_tree_view = gtk_tree_view_new ();
|
// GtkWidget *my_tree_view = gtk_tree_view_new ();
|
||||||
|
|
Loading…
Reference in New Issue