-
Notifications
You must be signed in to change notification settings - Fork 1
/
gio.go
51 lines (43 loc) · 1.01 KB
/
gio.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gio
// #cgo pkg-config: gio-2.0 glib-2.0
// #include <gio/gio.h>
// #include "gio.go.h"
import "C"
import (
"errors"
"github.com/gotk3/gotk3/glib"
)
func init() {
tm := []glib.TypeMarshaler{
// Enums
{glib.Type(C.g_application_flags_get_type()), marshalApplicationFlags},
// Objects/Interfaces
{glib.Type(C.g_application_get_type()), marshalApplication},
{glib.Type(C.g_cancellable_get_type()), marshalCancellable},
{glib.Type(C.g_dbus_connection_get_type()), marshalDBusConnection},
{glib.Type(C.g_file_get_type()), marshalFile},
{glib.Type(C.g_notification_get_type()), marshalNotification},
{glib.Type(C.g_type_module_get_type()), marshalTypeModule},
// Boxed
}
glib.RegisterGValueMarshalers(tm)
}
/*
* Type conversions
*/
func gbool(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
func gobool(b C.gboolean) bool {
if b != 0 {
return true
}
return false
}
/*
* Unexported vars
*/
var nilPtrErr = errors.New("cgo returned unexpected nil pointer")