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/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Class structure for #GDBusObjectSkeleton.
17type DBusObjectSkeletonClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 xAuthorizeMethod uintptr
23
24 Padding [8]uintptr
25}
26
27func (x *DBusObjectSkeletonClass) GoPointer() uintptr {
28 return uintptr(unsafe.Pointer(x))
29}
30
31// OverrideAuthorizeMethod sets the "authorize_method" callback function.
32// Signal class handler for the #GDBusObjectSkeleton::authorize-method signal.
33func (x *DBusObjectSkeletonClass) OverrideAuthorizeMethod(cb func(*DBusObjectSkeleton, *DBusInterfaceSkeleton, *DBusMethodInvocation) bool) {
34 if cb == nil {
35 x.xAuthorizeMethod = 0
36 } else {
37 x.xAuthorizeMethod = purego.NewCallback(func(ObjectVarp uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool {
38 return cb(DBusObjectSkeletonNewFromInternalPtr(ObjectVarp), DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp), DBusMethodInvocationNewFromInternalPtr(InvocationVarp))
39 })
40 }
41}
42
43// GetAuthorizeMethod gets the "authorize_method" callback function.
44// Signal class handler for the #GDBusObjectSkeleton::authorize-method signal.
45func (x *DBusObjectSkeletonClass) GetAuthorizeMethod() func(*DBusObjectSkeleton, *DBusInterfaceSkeleton, *DBusMethodInvocation) bool {
46 if x.xAuthorizeMethod == 0 {
47 return nil
48 }
49 var rawCallback func(ObjectVarp uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool
50 purego.RegisterFunc(&rawCallback, x.xAuthorizeMethod)
51 return func(ObjectVar *DBusObjectSkeleton, InterfaceVar *DBusInterfaceSkeleton, InvocationVar *DBusMethodInvocation) bool {
52 return rawCallback(ObjectVar.GoPointer(), InterfaceVar.GoPointer(), InvocationVar.GoPointer())
53 }
54}
55
56type DBusObjectSkeletonPrivate struct {
57 _ structs.HostLayout
58}
59
60func (x *DBusObjectSkeletonPrivate) GoPointer() uintptr {
61 return uintptr(unsafe.Pointer(x))
62}
63
64// A `GDBusObjectSkeleton` instance is essentially a group of D-Bus
65// interfaces. The set of exported interfaces on the object may be
66// dynamic and change at runtime.
67//
68// This type is intended to be used with [iface@Gio.DBusObjectManager].
69type DBusObjectSkeleton struct {
70 gobject.Object
71}
72
73var xDBusObjectSkeletonGLibType func() types.GType
74
75func DBusObjectSkeletonGLibType() types.GType {
76 return xDBusObjectSkeletonGLibType()
77}
78
79func DBusObjectSkeletonNewFromInternalPtr(ptr uintptr) *DBusObjectSkeleton {
80 cls := &DBusObjectSkeleton{}
81 cls.Ptr = ptr
82 return cls
83}
84
85var xNewDBusObjectSkeleton func(string) uintptr
86
87// Creates a new #GDBusObjectSkeleton.
88func NewDBusObjectSkeleton(ObjectPathVar string) *DBusObjectSkeleton {
89 var cls *DBusObjectSkeleton
90
91 cret := xNewDBusObjectSkeleton(ObjectPathVar)
92
93 if cret == 0 {
94 return nil
95 }
96 cls = &DBusObjectSkeleton{}
97 cls.Ptr = cret
98 return cls
99}
100
101var xDBusObjectSkeletonAddInterface func(uintptr, uintptr)
102
103// Adds @interface_ to @object.
104//
105// If @object already contains a #GDBusInterfaceSkeleton with the same
106// interface name, it is removed before @interface_ is added.
107//
108// Note that @object takes its own reference on @interface_ and holds
109// it until removed.
110func (x *DBusObjectSkeleton) AddInterface(InterfaceVar *DBusInterfaceSkeleton) {
111
112 xDBusObjectSkeletonAddInterface(x.GoPointer(), InterfaceVar.GoPointer())
113
114}
115
116var xDBusObjectSkeletonFlush func(uintptr)
117
118// This method simply calls g_dbus_interface_skeleton_flush() on all
119// interfaces belonging to @object. See that method for when flushing
120// is useful.
121func (x *DBusObjectSkeleton) Flush() {
122
123 xDBusObjectSkeletonFlush(x.GoPointer())
124
125}
126
127var xDBusObjectSkeletonRemoveInterface func(uintptr, uintptr)
128
129// Removes @interface_ from @object.
130func (x *DBusObjectSkeleton) RemoveInterface(InterfaceVar *DBusInterfaceSkeleton) {
131
132 xDBusObjectSkeletonRemoveInterface(x.GoPointer(), InterfaceVar.GoPointer())
133
134}
135
136var xDBusObjectSkeletonRemoveInterfaceByName func(uintptr, string)
137
138// Removes the #GDBusInterface with @interface_name from @object.
139//
140// If no D-Bus interface of the given interface exists, this function
141// does nothing.
142func (x *DBusObjectSkeleton) RemoveInterfaceByName(InterfaceNameVar string) {
143
144 xDBusObjectSkeletonRemoveInterfaceByName(x.GoPointer(), InterfaceNameVar)
145
146}
147
148var xDBusObjectSkeletonSetObjectPath func(uintptr, string)
149
150// Sets the object path for @object.
151func (x *DBusObjectSkeleton) SetObjectPath(ObjectPathVar string) {
152
153 xDBusObjectSkeletonSetObjectPath(x.GoPointer(), ObjectPathVar)
154
155}
156
157func (c *DBusObjectSkeleton) GoPointer() uintptr {
158 if c == nil {
159 return 0
160 }
161 return c.Ptr
162}
163
164func (c *DBusObjectSkeleton) SetGoPointer(ptr uintptr) {
165 c.Ptr = ptr
166}
167
168// SetPropertyGObjectPath sets the "g-object-path" property.
169// The object path where the object is exported.
170func (x *DBusObjectSkeleton) SetPropertyGObjectPath(value string) {
171 var v gobject.Value
172 v.Init(gobject.TypeStringVal)
173 v.SetString(&value)
174 x.SetProperty("g-object-path", &v)
175}
176
177// GetPropertyGObjectPath gets the "g-object-path" property.
178// The object path where the object is exported.
179func (x *DBusObjectSkeleton) GetPropertyGObjectPath() string {
180 var v gobject.Value
181 x.GetProperty("g-object-path", &v)
182 return v.GetString()
183}
184
185// Emitted when a method is invoked by a remote caller and used to
186// determine if the method call is authorized.
187//
188// This signal is like #GDBusInterfaceSkeleton's
189// #GDBusInterfaceSkeleton::g-authorize-method signal,
190// except that it is for the enclosing object.
191//
192// The default class handler just returns %TRUE.
193func (x *DBusObjectSkeleton) ConnectAuthorizeMethod(cb *func(DBusObjectSkeleton, uintptr, uintptr) bool) uint {
194 cbPtr := uintptr(unsafe.Pointer(cb))
195 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
196 handlerID := gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr)
197 glib.SaveHandlerMapping(handlerID, cbPtr)
198 return handlerID
199 }
200
201 fcb := func(clsPtr uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool {
202 fa := DBusObjectSkeleton{}
203 fa.Ptr = clsPtr
204 cbFn := *cb
205
206 return cbFn(fa, InterfaceVarp, InvocationVarp)
207
208 }
209 cbRefPtr := purego.NewCallback(fcb)
210 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
211 handlerID := gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr)
212 glib.SaveHandlerMapping(handlerID, cbPtr)
213 return handlerID
214}
215
216// Gets the D-Bus interface with name @interface_name associated with
217// @object, if any.
218func (x *DBusObjectSkeleton) GetInterface(InterfaceNameVar string) *DBusInterfaceBase {
219 var cls *DBusInterfaceBase
220
221 cret := XGDbusObjectGetInterface(x.GoPointer(), InterfaceNameVar)
222
223 if cret == 0 {
224 return nil
225 }
226 cls = &DBusInterfaceBase{}
227 cls.Ptr = cret
228 return cls
229}
230
231// Gets the D-Bus interfaces associated with @object.
232func (x *DBusObjectSkeleton) GetInterfaces() *glib.List {
233
234 cret := XGDbusObjectGetInterfaces(x.GoPointer())
235 return cret
236}
237
238// Gets the object path for @object.
239func (x *DBusObjectSkeleton) GetObjectPath() string {
240
241 cret := XGDbusObjectGetObjectPath(x.GoPointer())
242 return cret
243}
244
245func init() {
246 core.SetPackageName("GIO", "gio-2.0")
247 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
248 var libs []uintptr
249 for _, libPath := range core.GetPaths("GIO") {
250 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
251 if err != nil {
252 panic(err)
253 }
254 libs = append(libs, lib)
255 }
256
257 core.PuregoSafeRegister(&xDBusObjectSkeletonGLibType, libs, "g_dbus_object_skeleton_get_type")
258
259 core.PuregoSafeRegister(&xNewDBusObjectSkeleton, libs, "g_dbus_object_skeleton_new")
260
261 core.PuregoSafeRegister(&xDBusObjectSkeletonAddInterface, libs, "g_dbus_object_skeleton_add_interface")
262 core.PuregoSafeRegister(&xDBusObjectSkeletonFlush, libs, "g_dbus_object_skeleton_flush")
263 core.PuregoSafeRegister(&xDBusObjectSkeletonRemoveInterface, libs, "g_dbus_object_skeleton_remove_interface")
264 core.PuregoSafeRegister(&xDBusObjectSkeletonRemoveInterfaceByName, libs, "g_dbus_object_skeleton_remove_interface_by_name")
265 core.PuregoSafeRegister(&xDBusObjectSkeletonSetObjectPath, libs, "g_dbus_object_skeleton_set_object_path")
266
267}