示例#1
0
func FilesTreeStoreNew() (ret *FilesTreeStore, err error) {
	ts, err := gtk.TreeStoreNew(glib.TYPE_OBJECT, glib.TYPE_STRING)
	if err != nil {
		err = gtkErr("FilesTreeStoreNew", "TreeStoreNew", err)
		ret = nil
		return
	}
	ret = &FilesTreeStore{ts, make(map[string]Element), nil}
	err = nil
	return
}
示例#2
0
// Creates a tree view and the tree store that holds its data
func setupTreeView() (*gtk.TreeView, *gtk.TreeStore) {
	treeView, err := gtk.TreeViewNew()
	if err != nil {
		log.Fatal("Unable to create tree view:", err)
	}

	treeView.AppendColumn(createImageColumn("Icon", COLUMN_ICON))
	treeView.AppendColumn(createTextColumn("Version", COLUMN_TEXT))

	// Creating a tree store. This is what holds the data that will be shown on our tree view.
	treeStore, err := gtk.TreeStoreNew(glib.TYPE_OBJECT, glib.TYPE_STRING)
	if err != nil {
		log.Fatal("Unable to create tree store:", err)
	}
	treeView.SetModel(treeStore)

	return treeView, treeStore
}