-
Notifications
You must be signed in to change notification settings - Fork 1
/
GCancellable.go
48 lines (39 loc) · 960 Bytes
/
GCancellable.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
//GCancellable
package gio
// #cgo pkg-config: gio-2.0 glib-2.0
// #include <gio/gio.h>
// #include "gio.go.h"
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/glib"
)
/*
* GCancellable
*/
// Cancellable is a representation of GIO's GCancellable.
type Cancellable struct {
*glib.Object
}
// native returns a pointer to the underlying GCancellable.
func (v *Cancellable) native() *C.GCancellable {
if v == nil || v.GObject == nil {
return nil
}
p := unsafe.Pointer(v.GObject)
return C.toGCancellable(p)
}
func marshalCancellable(p uintptr) (interface{}, error) {
c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))}
return wrapCancellable(obj), nil
}
func wrapCancellable(obj *glib.Object) *Cancellable {
return &Cancellable{obj}
}
func (v *Cancellable) toCancellable() *C.GCancellable {
if v == nil {
return nil
}
return C.toGCancellable(unsafe.Pointer(v.GObject))
}