func (s *FilesTreeStore) AddEntry(c tr.Cursor, sym tr.Symbol, text string, data tr.TreeElementIf, prop tr.Property) (err error) { var icon *gdk.Pixbuf if prop.IsReadOnly() { icon = readonlyPixbuf(sym) } else { icon = normalPixbuf(sym) } iter, err := s.treestore.GetIterFromString(c.Path) if err != nil { log.Fatal("FilesTreeStore.AddEntry: gtk.GetIterFromString failed: %s", err) } if err != nil { err = gtkErr("FilesTreeStore.addEntry", "GetPath", err) return } s.lookup[c.Path] = Element{prop, data} err = s.treestore.SetValue(iter, iconCol, icon) if err != nil { err = gtkErr("FilesTreeStore.addEntry", "SetValue(iconCol)", err) return } err = s.treestore.SetValue(iter, textCol, text) if err != nil { err = gtkErr("FilesTreeStore.addEntry", "SetValue(textCol)", err) return } return nil }
func MenuEditCurrent(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList) { menu.editUndo.SetSensitive(jl.CanUndo()) menu.editRedo.SetSensitive(jl.CanRedo()) var prop tr.Property cursor := fts.Current() if len(cursor.Path) != 0 { prop = fts.Property(cursor) menu.editNew.SetSensitive(prop.MayAddObject()) menu.editDelete.SetSensitive(prop.MayRemove()) menu.editEdit.SetSensitive(prop.MayEdit()) } else { menu.editNew.SetSensitive(false) menu.editDelete.SetSensitive(false) menu.editEdit.SetSensitive(false) } }