Ejemplo n.º 1
0
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)
	}
}
Ejemplo n.º 2
0
func editRedo(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView) {
	defer MenuEditPost(menu, fts, jl)
	state, ok := jl.Redo()
	if ok {
		global.win.graphViews.Sync()
		path, err := gtk.TreePathNewFromString(state.(string))
		if err != nil {
			log.Println("editNew error: TreePathNewFromString failed:", err)
			return
		}
		ftv.TreeView().ExpandToPath(path)
		ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
	}
}
Ejemplo n.º 3
0
func editEdit(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView) {
	defer MenuEditPost(menu, fts, jl)
	dialog, err := EditDialogNew(fts)
	if err != nil {
		log.Println("editEdit error: ", err)
		return
	}
	job, ok := dialog.Run(fts)
	if ok {
		state, ok := jl.Apply(job)
		if ok {
			path, err := gtk.TreePathNewFromString(state.(string))
			if err != nil {
				log.Println("editEdit error: TreePathNewFromString failed:", err)
				return
			}
			ftv.TreeView().ExpandToPath(path)
			ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
		}
	}
}