Example #1
0
func gListboxAppend(widget *C.GtkWidget, what string) {
	var iter C.GtkTreeIter

	tv := getTreeViewFrom(widget)
	ls := (*C.GtkListStore)(unsafe.Pointer(C.gtk_tree_view_get_model(tv)))
	C.gtk_list_store_append(ls, &iter)
	cwhat := C.CString(what)
	defer C.free(unsafe.Pointer(cwhat))
	C.gtkListStoreSet(ls, &iter, cwhat)
}
Example #2
0
func updateStore(result [][]string) {
	var iter C.GtkTreeIter
	var value C.GValue
	C.init_string_value(&value)
	for _, entry := range result {
		C.gtk_list_store_append(Store, &iter)
		C.g_value_set_static_string(&value, cstr(entry[0]))
		C.gtk_list_store_set_value(Store, &iter, 0, &value)
		C.g_value_set_static_string(&value, cstr(entry[1]))
		C.gtk_list_store_set_value(Store, &iter, 1, &value)
	}
}