Show properties of the selected item TODO: use non-deprecated functions
This commit is contained in:
parent
8182d64b69
commit
6b27db357e
|
@ -56,7 +56,7 @@ static GtkWidget *my_tree_view; // = NULL;
|
|||
static GListStore *my_list_model = NULL;
|
||||
|
||||
static void
|
||||
add_item (GtkWidget *button, gpointer data)
|
||||
add_item () //(GtkWidget *button, gpointer data)
|
||||
{
|
||||
TreeItem foo;
|
||||
GtkTreeView *treeview = my_tree_view; // (GtkTreeView *)data;
|
||||
|
@ -64,12 +64,23 @@ add_item (GtkWidget *button, gpointer data)
|
|||
GtkTreePath *path;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeIter current, iter;
|
||||
|
||||
gtk_tree_view_get_cursor (treeview, &path, NULL);
|
||||
//model = gtk_tree_view_get_model (treeview);
|
||||
if (path)
|
||||
{
|
||||
gtk_tree_model_get_iter (my_list_model, ¤t, path);
|
||||
printf("In 'tree.c' (line 73) add_item() path = %s depth = %d\n",
|
||||
gtk_tree_path_to_string (path),
|
||||
gtk_tree_path_get_depth (path)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_item (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
printf("From 'tree.c' (line 130), remove item() > no item selected (or can't get it ?)\n");
|
||||
printf("In 'tree.c' (line 80) remove item() > no item selected (or can't get it ?)\n");
|
||||
|
||||
GtkTreeView *treeview = my_tree_view; // (GtkTreeView *)data;
|
||||
GtkTreeModel *model = my_list_model; // gtk_tree_view_get_model (treeview);
|
||||
|
@ -157,27 +168,21 @@ GtkWidget *create_my_tree_model(GtkBox *runlib_objects)
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
print_hello (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static int nb;
|
||||
nb++;
|
||||
printf("From 'tree.c', > %s added and button clicked (n = %d)\n", data, nb);
|
||||
}
|
||||
|
||||
GtkWidget *create_my_button_test(GtkBox *runlib_objects)
|
||||
{
|
||||
GtkWidget *button;
|
||||
const char *text = "Remove the Selected Item";
|
||||
const char *text = "Show properties of the selected item";
|
||||
|
||||
button = gtk_button_new_with_label(text);
|
||||
gtk_box_append(runlib_objects, button);
|
||||
gtk_widget_show(button);
|
||||
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), "some data");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (add_item), NULL);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// guix shell -m manifest.scm make clean && clear && time make run
|
||||
// https://docs.gtk.org/gtk4/section-list-widget.html
|
||||
|
|
Loading…
Reference in New Issue