func addColumns(treeView *gtk3.TreeView) { model := treeView.GetModel() var renderer gtk3.CellRendererLike // column for fixed toggles renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Connect("toggled", fixedToggled, model) column := gtk3.NewTreeViewColumnWithAttributes("Fixed?", renderer, gtk3.A{{"active", ColumnFixed}}) // Set this column to a fixed sizing (50 pixels) column.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) column.SetFixedWidth(50) treeView.AppendColumn(column) // Column for bug numbers renderer = gtk3.NewCellRendererText() column = gtk3.NewTreeViewColumnWithAttributes("Bug number", renderer, gtk3.A{{"text", ColumnNumber}}) column.SetSortColumnId(ColumnNumber) treeView.AppendColumn(column) // Column for severities renderer = gtk3.NewCellRendererText() column = gtk3.NewTreeViewColumnWithAttributes("Severity", renderer, gtk3.A{{"text", ColumnSeverity}}) column.SetSortColumnId(ColumnSeverity) treeView.AppendColumn(column) // Column for description renderer = gtk3.NewCellRendererText() column = gtk3.NewTreeViewColumnWithAttributes("Description", renderer, gtk3.A{{"text", ColumnDescription}}) column.SetSortColumnId(ColumnDescription) treeView.AppendColumn(column) // Column for spinner renderer = gtk3.NewCellRendererSpinner() column = gtk3.NewTreeViewColumnWithAttributes("Spinning", renderer, gtk3.A{{"pulse", ColumnPulse}, {"active", ColumnActive}}) column.SetSortColumnId(ColumnPulse) treeView.AppendColumn(column) // Column for symbolic icon renderer = gtk3.NewCellRendererPixbuf() renderer.CRenderer().Set(gtk3.P{"follow-state": true}) column = gtk3.NewTreeViewColumnWithAttributes("Symbolic icon", renderer, gtk3.A{{"icon-name", ColumnIcon}, {"sensitive", ColumnSensitive}}) column.SetSortColumnId(ColumnIcon) treeView.AppendColumn(column) }
func addColumns(treeview *gtk3.TreeView) { var renderer gtk3.CellRendererLike model := treeview.GetModel().(*gtk3.TreeStore) // Column for holiday names renderer = gtk3.NewCellRendererText() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) col := gtk3.NewTreeViewColumnWithAttributes("Holiday", renderer, gtk3.A{{"text", HolidayNameCol}}) treeview.AppendColumn(col) col.SetClickable(true) // Alex column renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) renderer.CRenderer().Connect("toggled", itemToggled, model, AlexCol) col = gtk3.NewTreeViewColumnWithAttributes("Alex", renderer, gtk3.A{{"active", AlexCol}, {"visible", VisibleCol}, {"activatable", WorldCol}}) treeview.AppendColumn(col) col.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) col.SetFixedWidth(60) col.SetClickable(true) // Havoc column renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) renderer.CRenderer().Connect("toggled", itemToggled, model, HavocCol) col = gtk3.NewTreeViewColumnWithAttributes("Havoc", renderer, gtk3.A{{"active", HavocCol}, {"visible", VisibleCol}}) treeview.AppendColumn(col) col.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) col.SetFixedWidth(60) col.SetClickable(true) // Tim column renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) renderer.CRenderer().Connect("toggled", itemToggled, model, TimCol) col = gtk3.NewTreeViewColumnWithAttributes("Tim", renderer, gtk3.A{{"active", TimCol}, {"visible", VisibleCol}, {"activatable", WorldCol}}) treeview.AppendColumn(col) col.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) col.SetFixedWidth(60) col.SetClickable(true) // Owen column renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) renderer.CRenderer().Connect("toggled", itemToggled, model, OwenCol) col = gtk3.NewTreeViewColumnWithAttributes("Owen", renderer, gtk3.A{{"active", OwenCol}, {"visible", VisibleCol}}) treeview.AppendColumn(col) col.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) col.SetFixedWidth(60) col.SetClickable(true) // Dave column renderer = gtk3.NewCellRendererToggle() renderer.CRenderer().Set(gtk3.P{"xalign": 0.0}) renderer.CRenderer().Connect("toggled", itemToggled, model, DaveCol) col = gtk3.NewTreeViewColumnWithAttributes("Dave", renderer, gtk3.A{{"active", DaveCol}, {"visible", VisibleCol}}) treeview.AppendColumn(col) col.SetSizing(gtk3.GtkTreeViewColumnSizing.FIXED) col.SetFixedWidth(60) col.SetClickable(true) }