aboutsummaryrefslogtreecommitdiffstats
path: root/notifier_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'notifier_darwin.go')
-rw-r--r--notifier_darwin.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/notifier_darwin.go b/notifier_darwin.go
index 283c329..4287bd5 100644
--- a/notifier_darwin.go
+++ b/notifier_darwin.go
@@ -5,9 +5,9 @@ package notifier
/*
#cgo CFLAGS: -x objective-c
-#cgo LDFLAGS: -framework Cocoa
+#cgo LDFLAGS: -framework Cocoa -sectcreate __TEXT __info_plist Info.plist
#import <Cocoa/Cocoa.h>
-extern CFStringRef deliverNotification(CFStringRef title, CFStringRef subtitle, CFStringRef message, CFStringRef appIconURLString, CFArrayRef actions, CFStringRef groupID, CFStringRef bundleID);
+extern CFStringRef deliverNotification(CFStringRef title, CFStringRef subtitle, CFStringRef message, CFStringRef appIconURLString, CFArrayRef actions, CFStringRef groupID, CFStringRef bundleID, NSTimeInterval timeout);
*/
import "C"
import "fmt"
@@ -51,19 +51,10 @@ func (n darwinNotifier) DeliverNotification(notification Notification) error {
defer Release(C.CFTypeRef(appIconURLStringRef))
}
- actions := []C.CFTypeRef{}
- for _, action := range notification.Actions {
- actionRef, err := StringToCFString(action)
- if err != nil {
- return err
- }
- defer Release(C.CFTypeRef(actionRef))
- actions = append(actions, C.CFTypeRef(actionRef))
- }
- actionsRef := ArrayToCFArray(actions)
+ actionsRef := StringsToCFArray(notification.Actions)
defer Release(C.CFTypeRef(actionsRef))
- C.deliverNotification(titleRef, nil, messageRef, appIconURLStringRef, actionsRef, bundleIDRef, bundleIDRef)
+ C.deliverNotification(titleRef, nil, messageRef, appIconURLStringRef, actionsRef, bundleIDRef, nil, C.NSTimeInterval(notification.Timeout))
return nil
}