diff options
Diffstat (limited to 'listbox_unix.go')
| -rw-r--r-- | listbox_unix.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/listbox_unix.go b/listbox_unix.go index 10f2680..cc6ca44 100644 --- a/listbox_unix.go +++ b/listbox_unix.go @@ -211,3 +211,15 @@ func gListboxDelete(widget *gtkWidget, index int) { } C.gtk_list_store_remove(ls, &iter) } + +// this is a separate function because Combobox uses it too +func gtkTreeModelListLen(model *C.GtkTreeModel) int { + // "As a special case, if iter is NULL, then the number of toplevel nodes is returned." + return int(C.gtk_tree_model_iter_n_children(model, (*C.GtkTreeIter)(nil))) +} + +func gListboxLen(widget *gtkWidget) int { + tv := getTreeViewFrom(widget) + model := C.gtk_tree_view_get_model(tv) + return gtkTreeModelListLen(model) +} |
