diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-08 16:42:57 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-08 16:42:57 -0500 |
| commit | 3aa59d4ab9d1217fa47c4b1b265fd435547ed62f (patch) | |
| tree | bdffbdb57872231213018a6e1df732bcc0687067 /listbox_unix.go | |
| parent | d9b0bd3c700f7c559757834f7463410cfafd6c1e (diff) | |
Added Combobox/Listbox.Len() and its GTK+ implementation.
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) +} |
