func editPaste(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView, clp *gtk.Clipboard) { defer MenuEditPost(menu, fts, jl) if !clp.WaitIsTextAvailable() { log.Println("editPaste: Nothing on clipboard") return } text, err := clp.WaitForText() if err != nil { log.Println("editPaste: Failed to get data from clipboard") return } job, err := ParseText(text, fts) if err != nil { log.Printf("editPaste: error parsing data from clipboard: %s\n", err) return } state, ok := jl.Apply(job) if ok { global.win.graphViews.Sync() path, err := gtk.TreePathNewFromString(state.(string)) if err != nil { log.Println("editPaste error: TreePathNewFromString failed:", err) return } ftv.TreeView().ExpandToPath(path) ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false) } }
func editCopy(fts *models.FilesTreeStore, clp *gtk.Clipboard) { var buf []byte obj, err := fts.GetObjectById(fts.GetCurrentId()) if err != nil { log.Printf("editCopy error: %s\n", err) return } buf, err = obj.(gr.XmlCreator).CreateXml() if err != nil { log.Printf("editCopy error: %s\n", err) return } clp.SetText(string(buf)) }