diff --git a/demos/gtk-demo/tree_store.c b/demos/gtk-demo/tree_store.c index 4ae9e2a..52b6034 100644 --- a/demos/gtk-demo/tree_store.c +++ b/demos/gtk-demo/tree_store.c @@ -91,8 +91,6 @@ static void iterating_a_model_in_a_depth_first_fashion (GtkTreeModel *model) { // gboolean (*GtkTreeModelForeachFunc) (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); GtkTreeIter iter, iter_parent; - gboolean valid = 0; -// GtkTreePath *chemin; char *str_data; int row_count = 0; @@ -104,7 +102,7 @@ static void iterating_a_model_in_a_depth_first_fashion (GtkTreeModel *model) gtk_tree_model_iter_children (model, &iter, &iter_parent); // Sets iter to point to the first child of parent. //gtk_tree_model_iter_next (model, &iter); gtk_tree_model_get (model, &iter, STRING_COLUMN, &str_data, -1); - g_print ("next row %d: (%s) < False (should be 'A' - line 104)\n", row_count, str_data); + g_print ("next row %d: (%s) < False (should be 'A' <-- line 104)\n", row_count, str_data); /* while (valid) first row 0: (ROOT) next row 0: (D)*/ /* { */ @@ -122,7 +120,7 @@ static void iterating_a_model_in_a_depth_first_fashion (GtkTreeModel *model) } static void /* https://developer-old.gnome.org/gtk4/stable/GtkTreeModel.html#GtkTreePath-struct and #gtk-tree-row-reference-new */ -gtk_tree_model_get_data_from_path (GtkTreeModel *my_tree_model, +gtk_tree_model_get_data_from_iter (GtkTreeModel *my_tree_model, GtkCellEditable *cell_editable, GtkTreeIter *my_iter, GdkEvent *event, @@ -132,9 +130,8 @@ gtk_tree_model_get_data_from_path (GtkTreeModel *my_tree_model, gtk_tree_model_get_iter (my_tree_model, &my_iter, my_path); gtk_tree_model_get (my_tree_model, &my_iter, STRING_COLUMN, &str_data, -1); - g_print ("row from path %s = (%s)\n",\ - gtk_tree_model_get_string_from_iter(my_tree_model, &my_iter), - str_data); + g_print ("row from iter at [ %s ] = '%s'\n",\ + gtk_tree_model_get_string_from_iter(my_tree_model, &my_iter), str_data); gtk_tree_path_free (my_path); } @@ -241,8 +238,8 @@ do_tree_store (GtkWidget *do_widget) iterating_a_model_in_a_depth_first_fashion (my_tree_model); // GtkTreePath *my_path = gtk_tree_path_new_from_string ("0:0:1:0:1"); // acquiring_a_GtkTreeIter (my_tree_model, my_path); - // GtkTreeIter *my_iter; - gtk_tree_model_get_data_from_path (my_tree_model, NULL, NULL, NULL, gtk_tree_path_new_from_string ("0:0:0:2")); + GtkTreeIter *my_iter; + gtk_tree_model_get_data_from_iter (my_tree_model, NULL, my_iter, NULL, gtk_tree_path_new_from_string ("0:0:0:1:0:1")); /* create tree view */ treeview = gtk_tree_view_new_with_model (my_tree_model);