gdebugcontroller.go RawHistoryFolder
1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// The virtual function table for #GDebugController.
16type DebugControllerInterface struct {
17 _ structs.HostLayout
18
19 GIface uintptr
20}
21
22func (x *DebugControllerInterface) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// `GDebugController` is an interface to expose control of debugging features and
27// debug output.
28//
29// It is implemented on Linux using [class@Gio.DebugControllerDBus], which
30// exposes a D-Bus interface to allow authenticated peers to control debug
31// features in this process.
32//
33// Whether debug output is enabled is exposed as
34// [property@Gio.DebugController:debug-enabled]. This controls
35// [func@GLib.log_set_debug_enabled] by default. Application code may
36// connect to the [signal@GObject.Object::notify] signal for it
37// to control other parts of its debug infrastructure as necessary.
38//
39// If your application or service is using the default GLib log writer function,
40// creating one of the built-in implementations of `GDebugController` should be
41// all that’s needed to dynamically enable or disable debug output.
42type DebugController interface {
43 GoPointer() uintptr
44 SetGoPointer(uintptr)
45 GetDebugEnabled() bool
46 SetDebugEnabled(DebugEnabledVar bool)
47}
48
49var xDebugControllerGLibType func() types.GType
50
51func DebugControllerGLibType() types.GType {
52 return xDebugControllerGLibType()
53}
54
55type DebugControllerBase struct {
56 Ptr uintptr
57}
58
59func (x *DebugControllerBase) GoPointer() uintptr {
60 if x == nil {
61 return 0
62 }
63 return x.Ptr
64}
65
66func (x *DebugControllerBase) SetGoPointer(ptr uintptr) {
67 x.Ptr = ptr
68}
69
70// Get the value of #GDebugController:debug-enabled.
71func (x *DebugControllerBase) GetDebugEnabled() bool {
72
73 cret := XGDebugControllerGetDebugEnabled(x.GoPointer())
74 return cret
75}
76
77// Set the value of #GDebugController:debug-enabled.
78func (x *DebugControllerBase) SetDebugEnabled(DebugEnabledVar bool) {
79
80 XGDebugControllerSetDebugEnabled(x.GoPointer(), DebugEnabledVar)
81
82}
83
84// SetPropertyDebugEnabled sets the "debug-enabled" property.
85// %TRUE if debug output should be exposed (for example by forwarding it to
86// the journal), %FALSE otherwise.
87func (x *DebugControllerBase) SetPropertyDebugEnabled(value bool) {
88 obj := gobject.Object{}
89 obj.Ptr = x.GoPointer()
90 var v gobject.Value
91 v.Init(gobject.TypeBooleanVal)
92 v.SetBoolean(value)
93 obj.SetProperty("debug-enabled", &v)
94}
95
96// GetPropertyDebugEnabled gets the "debug-enabled" property.
97// %TRUE if debug output should be exposed (for example by forwarding it to
98// the journal), %FALSE otherwise.
99func (x *DebugControllerBase) GetPropertyDebugEnabled() bool {
100 obj := gobject.Object{}
101 obj.Ptr = x.GoPointer()
102 var v gobject.Value
103 obj.GetProperty("debug-enabled", &v)
104 return v.GetBoolean()
105}
106
107var XGDebugControllerGetDebugEnabled func(uintptr) bool
108var XGDebugControllerSetDebugEnabled func(uintptr, bool)
109
110const (
111 // Extension point for debug control functionality.
112 // See [Extending GIO](overview.html#extending-gio).
113 DEBUG_CONTROLLER_EXTENSION_POINT_NAME string = "gio-debug-controller"
114)
115
116func init() {
117 core.SetPackageName("GIO", "gio-2.0")
118 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
119 var libs []uintptr
120 for _, libPath := range core.GetPaths("GIO") {
121 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
122 if err != nil {
123 panic(err)
124 }
125 libs = append(libs, lib)
126 }
127
128 core.PuregoSafeRegister(&xDebugControllerGLibType, libs, "g_debug_controller_get_type")
129
130 core.PuregoSafeRegister(&XGDebugControllerGetDebugEnabled, libs, "g_debug_controller_get_debug_enabled")
131 core.PuregoSafeRegister(&XGDebugControllerSetDebugEnabled, libs, "g_debug_controller_set_debug_enabled")
132
133}