Glib is from a bunch of worthless fucks
This commit is contained in:
parent
e2d7d98ec3
commit
5b7d241c62
|
@ -16,16 +16,18 @@ const notifyHeader = "<libnotify/notify.h>"
|
|||
type
|
||||
Notification {.importc: "NotifyNotification".} = ptr object
|
||||
discard
|
||||
GError {.importc.} = ptr object
|
||||
GError {.importc, header: "glib/gerror.h".} = object
|
||||
message: cstring
|
||||
|
||||
proc g_free(mem: pointer) {.importc.}
|
||||
proc g_error_free(err: ptr GError) {.importc, header: "glib/gerror.h".}
|
||||
|
||||
proc init(appName: cstring): bool {.notify.}
|
||||
proc uninit() {.notify.}
|
||||
|
||||
proc get_server_info(name, vendor, version, specVersion: ptr cstring): bool {.notify.}
|
||||
|
||||
proc notification_new(summary, body, icon: cstring = nil): Notification {.notify.}
|
||||
proc show(n: Notification; err: ptr GError): bool {.notification.}
|
||||
|
||||
proc set_app_name(n: Notification; s: string) {.notification.}
|
||||
proc set_category(n: Notification; s: string) {.notification.}
|
||||
|
@ -42,6 +44,15 @@ const appName = "libnotify_actor"
|
|||
if not init(appName):
|
||||
quit "failed to initialize libnotify"
|
||||
|
||||
proc show(n: Notification; err: ptr (ptr GError)): bool {.notification.}
|
||||
var err: ptr GError
|
||||
if not show(n, addr err):
|
||||
doAssert not err.isNil, "GLIB shit itself without setting an error"
|
||||
doAssert not err.message.isNil, "GLIB shit itself without setting an error message"
|
||||
stderr.writeLine "show failed: ", err.message
|
||||
if not err.isNil:
|
||||
g_error_free(err)
|
||||
|
||||
proc assertServerInfo(turn: var Turn; ds: Ref) =
|
||||
var name, vendor, version, specVersion: cstring
|
||||
if get_server_info(addr name, addr vendor, addr version, addr specVersion):
|
||||
|
|
Loading…
Reference in New Issue