|
|
@ -21,7 +21,7 @@ func Desktop() UI {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log.Println("Creating new Cocoa UI")
|
|
|
|
log.Println("Creating new Cocoa UI")
|
|
|
|
C.Initialize()
|
|
|
|
C.initialize()
|
|
|
|
desktopUI = new(cocoaUI)
|
|
|
|
desktopUI = new(cocoaUI)
|
|
|
|
return desktopUI
|
|
|
|
return desktopUI
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -35,10 +35,21 @@ func (ui *cocoaUI) Run(out chan events.UserEvent, in chan events.BackgroundEvent
|
|
|
|
log.Println("Running Desktop UI")
|
|
|
|
log.Println("Running Desktop UI")
|
|
|
|
ui.in = in
|
|
|
|
ui.in = in
|
|
|
|
ui.out = out
|
|
|
|
ui.out = out
|
|
|
|
C.Run()
|
|
|
|
go ui.forwardEvents()
|
|
|
|
|
|
|
|
C.run()
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (ui *cocoaUI) forwardEvents() {
|
|
|
|
|
|
|
|
for e := range ui.in {
|
|
|
|
|
|
|
|
switch e.(type) {
|
|
|
|
|
|
|
|
case events.SigIntEvent:
|
|
|
|
|
|
|
|
log.Println("Cocoa UI sees sig int, forwarding to NSApp")
|
|
|
|
|
|
|
|
C.shutdown()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//export selectDirectory
|
|
|
|
//export selectDirectory
|
|
|
|
func selectDirectory(cpath *C.char) {
|
|
|
|
func selectDirectory(cpath *C.char) {
|
|
|
|
path := C.GoString(cpath)
|
|
|
|
path := C.GoString(cpath)
|
|
|
|