你应该能够通过 GtkTreePath,可能有点 hack,但仍然在 API 内:
GtkTreePath *path;
GtkTreeIter iter;
/* With NULL as iter, we get the number of toplevel nodes. */
gint rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(model), NULL);
/* Now get a path from the index. */
path = gtk_tree_path_new_from_indices(rows - 1, -1);
/* Ask the model for an iter to the node identified by the path. */
gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
/* Drop the path, we're done with it, iter is final output. */
gtk_tree_path_free(path);
Run Code Online (Sandbox Code Playgroud)
注意:我在编写时还没有测试过上面的内容,但我很确定我在实际代码中做了一些非常相似的事情。
| 归档时间: |
|
| 查看次数: |
3866 次 |
| 最近记录: |