示例#1
0
// Append a row to the list store for the tree view
func addRow(listStore *gtk.ListStore, version, feature string) {
	// Get an iterator for a new row at the end of the list store
	iter := listStore.Append()

	// Set the contents of the list store row that the iterator represents
	err := listStore.Set(iter,
		[]int{COLUMN_VERSION, COLUMN_FEATURE},
		[]interface{}{version, feature})

	if err != nil {
		log.Fatal("Unable to add row:", err)
	}
}
示例#2
0
文件: others.go 项目: sqp/godock
// modelAddField adds one field to the model and can save reference of fields+iter.
//
func modelAddField(key *cftype.Key, model *gtk.ListStore, field datatype.Field, ro indexiter.ByString) *gtk.TreeIter {
	iter := model.Append()
	model.SetCols(iter, gtk.Cols{
		RowKey:  field.Key,
		RowName: field.Name,
		RowDesc: "none",
	})
	if field.Icon != "" {
		pix, e := common.PixbufNewFromFile(field.Icon, iconSizeCombo)
		if !key.Log().Err(e, "Load icon") {
			model.SetValue(iter, RowIcon, pix)
		}
	}

	if ro != nil {
		ro.Append(iter, field.Key)
	}
	return iter
}