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 #GDBusInterfaceSkeleton.
17type DBusInterfaceSkeletonClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21
22 xGetInfo uintptr
23
24 xGetVtable uintptr
25
26 xGetProperties uintptr
27
28 xFlush uintptr
29
30 VfuncPadding [8]uintptr
31
32 xGAuthorizeMethod uintptr
33
34 SignalPadding [8]uintptr
35}
36
37func (x *DBusInterfaceSkeletonClass) GoPointer() uintptr {
38 return uintptr(unsafe.Pointer(x))
39}
40
41// OverrideGetInfo sets the "get_info" callback function.
42// Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.
43func (x *DBusInterfaceSkeletonClass) OverrideGetInfo(cb func(*DBusInterfaceSkeleton) *DBusInterfaceInfo) {
44 if cb == nil {
45 x.xGetInfo = 0
46 } else {
47 x.xGetInfo = purego.NewCallback(func(InterfaceVarp uintptr) *DBusInterfaceInfo {
48 return cb(DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp))
49 })
50 }
51}
52
53// GetGetInfo gets the "get_info" callback function.
54// Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details.
55func (x *DBusInterfaceSkeletonClass) GetGetInfo() func(*DBusInterfaceSkeleton) *DBusInterfaceInfo {
56 if x.xGetInfo == 0 {
57 return nil
58 }
59 var rawCallback func(InterfaceVarp uintptr) *DBusInterfaceInfo
60 purego.RegisterFunc(&rawCallback, x.xGetInfo)
61 return func(InterfaceVar *DBusInterfaceSkeleton) *DBusInterfaceInfo {
62 return rawCallback(InterfaceVar.GoPointer())
63 }
64}
65
66// OverrideGetVtable sets the "get_vtable" callback function.
67// Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.
68func (x *DBusInterfaceSkeletonClass) OverrideGetVtable(cb func(*DBusInterfaceSkeleton) *DBusInterfaceVTable) {
69 if cb == nil {
70 x.xGetVtable = 0
71 } else {
72 x.xGetVtable = purego.NewCallback(func(InterfaceVarp uintptr) *DBusInterfaceVTable {
73 return cb(DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp))
74 })
75 }
76}
77
78// GetGetVtable gets the "get_vtable" callback function.
79// Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details.
80func (x *DBusInterfaceSkeletonClass) GetGetVtable() func(*DBusInterfaceSkeleton) *DBusInterfaceVTable {
81 if x.xGetVtable == 0 {
82 return nil
83 }
84 var rawCallback func(InterfaceVarp uintptr) *DBusInterfaceVTable
85 purego.RegisterFunc(&rawCallback, x.xGetVtable)
86 return func(InterfaceVar *DBusInterfaceSkeleton) *DBusInterfaceVTable {
87 return rawCallback(InterfaceVar.GoPointer())
88 }
89}
90
91// OverrideGetProperties sets the "get_properties" callback function.
92// Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties().
93func (x *DBusInterfaceSkeletonClass) OverrideGetProperties(cb func(*DBusInterfaceSkeleton) *glib.Variant) {
94 if cb == nil {
95 x.xGetProperties = 0
96 } else {
97 x.xGetProperties = purego.NewCallback(func(InterfaceVarp uintptr) *glib.Variant {
98 return cb(DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp))
99 })
100 }
101}
102
103// GetGetProperties gets the "get_properties" callback function.
104// Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties().
105func (x *DBusInterfaceSkeletonClass) GetGetProperties() func(*DBusInterfaceSkeleton) *glib.Variant {
106 if x.xGetProperties == 0 {
107 return nil
108 }
109 var rawCallback func(InterfaceVarp uintptr) *glib.Variant
110 purego.RegisterFunc(&rawCallback, x.xGetProperties)
111 return func(InterfaceVar *DBusInterfaceSkeleton) *glib.Variant {
112 return rawCallback(InterfaceVar.GoPointer())
113 }
114}
115
116// OverrideFlush sets the "flush" callback function.
117// Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().
118func (x *DBusInterfaceSkeletonClass) OverrideFlush(cb func(*DBusInterfaceSkeleton)) {
119 if cb == nil {
120 x.xFlush = 0
121 } else {
122 x.xFlush = purego.NewCallback(func(InterfaceVarp uintptr) {
123 cb(DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp))
124 })
125 }
126}
127
128// GetFlush gets the "flush" callback function.
129// Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush().
130func (x *DBusInterfaceSkeletonClass) GetFlush() func(*DBusInterfaceSkeleton) {
131 if x.xFlush == 0 {
132 return nil
133 }
134 var rawCallback func(InterfaceVarp uintptr)
135 purego.RegisterFunc(&rawCallback, x.xFlush)
136 return func(InterfaceVar *DBusInterfaceSkeleton) {
137 rawCallback(InterfaceVar.GoPointer())
138 }
139}
140
141// OverrideGAuthorizeMethod sets the "g_authorize_method" callback function.
142// Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal.
143func (x *DBusInterfaceSkeletonClass) OverrideGAuthorizeMethod(cb func(*DBusInterfaceSkeleton, *DBusMethodInvocation) bool) {
144 if cb == nil {
145 x.xGAuthorizeMethod = 0
146 } else {
147 x.xGAuthorizeMethod = purego.NewCallback(func(InterfaceVarp uintptr, InvocationVarp uintptr) bool {
148 return cb(DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp), DBusMethodInvocationNewFromInternalPtr(InvocationVarp))
149 })
150 }
151}
152
153// GetGAuthorizeMethod gets the "g_authorize_method" callback function.
154// Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal.
155func (x *DBusInterfaceSkeletonClass) GetGAuthorizeMethod() func(*DBusInterfaceSkeleton, *DBusMethodInvocation) bool {
156 if x.xGAuthorizeMethod == 0 {
157 return nil
158 }
159 var rawCallback func(InterfaceVarp uintptr, InvocationVarp uintptr) bool
160 purego.RegisterFunc(&rawCallback, x.xGAuthorizeMethod)
161 return func(InterfaceVar *DBusInterfaceSkeleton, InvocationVar *DBusMethodInvocation) bool {
162 return rawCallback(InterfaceVar.GoPointer(), InvocationVar.GoPointer())
163 }
164}
165
166type DBusInterfaceSkeletonPrivate struct {
167 _ structs.HostLayout
168}
169
170func (x *DBusInterfaceSkeletonPrivate) GoPointer() uintptr {
171 return uintptr(unsafe.Pointer(x))
172}
173
174// Abstract base class for D-Bus interfaces on the service side.
175type DBusInterfaceSkeleton struct {
176 gobject.Object
177}
178
179var xDBusInterfaceSkeletonGLibType func() types.GType
180
181func DBusInterfaceSkeletonGLibType() types.GType {
182 return xDBusInterfaceSkeletonGLibType()
183}
184
185func DBusInterfaceSkeletonNewFromInternalPtr(ptr uintptr) *DBusInterfaceSkeleton {
186 cls := &DBusInterfaceSkeleton{}
187 cls.Ptr = ptr
188 return cls
189}
190
191var xDBusInterfaceSkeletonExport func(uintptr, uintptr, string, **glib.Error) bool
192
193// Exports @interface_ at @object_path on @connection.
194//
195// This can be called multiple times to export the same @interface_
196// onto multiple connections however the @object_path provided must be
197// the same for all connections.
198//
199// Use g_dbus_interface_skeleton_unexport() to unexport the object.
200func (x *DBusInterfaceSkeleton) Export(ConnectionVar *DBusConnection, ObjectPathVar string) (bool, error) {
201 var cerr *glib.Error
202
203 cret := xDBusInterfaceSkeletonExport(x.GoPointer(), ConnectionVar.GoPointer(), ObjectPathVar, &cerr)
204 if cerr == nil {
205 return cret, nil
206 }
207 return cret, cerr
208
209}
210
211var xDBusInterfaceSkeletonFlush func(uintptr)
212
213// If @interface_ has outstanding changes, request for these changes to be
214// emitted immediately.
215//
216// For example, an exported D-Bus interface may queue up property
217// changes and emit the
218// `org.freedesktop.DBus.Properties.PropertiesChanged`
219// signal later (e.g. in an idle handler). This technique is useful
220// for collapsing multiple property changes into one.
221func (x *DBusInterfaceSkeleton) Flush() {
222
223 xDBusInterfaceSkeletonFlush(x.GoPointer())
224
225}
226
227var xDBusInterfaceSkeletonGetConnection func(uintptr) uintptr
228
229// Gets the first connection that @interface_ is exported on, if any.
230func (x *DBusInterfaceSkeleton) GetConnection() *DBusConnection {
231 var cls *DBusConnection
232
233 cret := xDBusInterfaceSkeletonGetConnection(x.GoPointer())
234
235 if cret == 0 {
236 return nil
237 }
238 gobject.IncreaseRef(cret)
239 cls = &DBusConnection{}
240 cls.Ptr = cret
241 return cls
242}
243
244var xDBusInterfaceSkeletonGetConnections func(uintptr) *glib.List
245
246// Gets a list of the connections that @interface_ is exported on.
247func (x *DBusInterfaceSkeleton) GetConnections() *glib.List {
248
249 cret := xDBusInterfaceSkeletonGetConnections(x.GoPointer())
250 return cret
251}
252
253var xDBusInterfaceSkeletonGetFlags func(uintptr) DBusInterfaceSkeletonFlags
254
255// Gets the #GDBusInterfaceSkeletonFlags that describes what the behavior
256// of @interface_
257func (x *DBusInterfaceSkeleton) GetFlags() DBusInterfaceSkeletonFlags {
258
259 cret := xDBusInterfaceSkeletonGetFlags(x.GoPointer())
260 return cret
261}
262
263var xDBusInterfaceSkeletonGetInfo func(uintptr) *DBusInterfaceInfo
264
265// Gets D-Bus introspection information for the D-Bus interface
266// implemented by @interface_.
267func (x *DBusInterfaceSkeleton) GetInfo() *DBusInterfaceInfo {
268
269 cret := xDBusInterfaceSkeletonGetInfo(x.GoPointer())
270 return cret
271}
272
273var xDBusInterfaceSkeletonGetObjectPath func(uintptr) string
274
275// Gets the object path that @interface_ is exported on, if any.
276func (x *DBusInterfaceSkeleton) GetObjectPath() string {
277
278 cret := xDBusInterfaceSkeletonGetObjectPath(x.GoPointer())
279 return cret
280}
281
282var xDBusInterfaceSkeletonGetProperties func(uintptr) *glib.Variant
283
284// Gets all D-Bus properties for @interface_.
285func (x *DBusInterfaceSkeleton) GetProperties() *glib.Variant {
286
287 cret := xDBusInterfaceSkeletonGetProperties(x.GoPointer())
288 return cret
289}
290
291var xDBusInterfaceSkeletonGetVtable func(uintptr) *DBusInterfaceVTable
292
293// Gets the interface vtable for the D-Bus interface implemented by
294// @interface_. The returned function pointers should expect @interface_
295// itself to be passed as @user_data.
296func (x *DBusInterfaceSkeleton) GetVtable() *DBusInterfaceVTable {
297
298 cret := xDBusInterfaceSkeletonGetVtable(x.GoPointer())
299 return cret
300}
301
302var xDBusInterfaceSkeletonHasConnection func(uintptr, uintptr) bool
303
304// Checks if @interface_ is exported on @connection.
305func (x *DBusInterfaceSkeleton) HasConnection(ConnectionVar *DBusConnection) bool {
306
307 cret := xDBusInterfaceSkeletonHasConnection(x.GoPointer(), ConnectionVar.GoPointer())
308 return cret
309}
310
311var xDBusInterfaceSkeletonSetFlags func(uintptr, DBusInterfaceSkeletonFlags)
312
313// Sets flags describing what the behavior of @skeleton should be.
314func (x *DBusInterfaceSkeleton) SetFlags(FlagsVar DBusInterfaceSkeletonFlags) {
315
316 xDBusInterfaceSkeletonSetFlags(x.GoPointer(), FlagsVar)
317
318}
319
320var xDBusInterfaceSkeletonUnexport func(uintptr)
321
322// Stops exporting @interface_ on all connections it is exported on.
323//
324// To unexport @interface_ from only a single connection, use
325// g_dbus_interface_skeleton_unexport_from_connection()
326func (x *DBusInterfaceSkeleton) Unexport() {
327
328 xDBusInterfaceSkeletonUnexport(x.GoPointer())
329
330}
331
332var xDBusInterfaceSkeletonUnexportFromConnection func(uintptr, uintptr)
333
334// Stops exporting @interface_ on @connection.
335//
336// To stop exporting on all connections the interface is exported on,
337// use g_dbus_interface_skeleton_unexport().
338func (x *DBusInterfaceSkeleton) UnexportFromConnection(ConnectionVar *DBusConnection) {
339
340 xDBusInterfaceSkeletonUnexportFromConnection(x.GoPointer(), ConnectionVar.GoPointer())
341
342}
343
344func (c *DBusInterfaceSkeleton) GoPointer() uintptr {
345 if c == nil {
346 return 0
347 }
348 return c.Ptr
349}
350
351func (c *DBusInterfaceSkeleton) SetGoPointer(ptr uintptr) {
352 c.Ptr = ptr
353}
354
355// Emitted when a method is invoked by a remote caller and used to
356// determine if the method call is authorized.
357//
358// Note that this signal is emitted in a thread dedicated to
359// handling the method call so handlers are allowed to perform
360// blocking IO. This means that it is appropriate to call e.g.
361// [polkit_authority_check_authorization_sync()](http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#polkit-authority-check-authorization-sync)
362// with the
363// [POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION](http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#POLKIT-CHECK-AUTHORIZATION-FLAGS-ALLOW-USER-INTERACTION:CAPS)
364// flag set.
365//
366// If %FALSE is returned then no further handlers are run and the
367// signal handler must take a reference to @invocation and finish
368// handling the call (e.g. return an error via
369// g_dbus_method_invocation_return_error()).
370//
371// Otherwise, if %TRUE is returned, signal emission continues. If no
372// handlers return %FALSE, then the method is dispatched. If
373// @interface has an enclosing #GDBusObjectSkeleton, then the
374// #GDBusObjectSkeleton::authorize-method signal handlers run before
375// the handlers for this signal.
376//
377// The default class handler just returns %TRUE.
378//
379// Please note that the common case is optimized: if no signals
380// handlers are connected and the default class handler isn't
381// overridden (for both @interface and the enclosing
382// #GDBusObjectSkeleton, if any) and #GDBusInterfaceSkeleton:g-flags does
383// not have the
384// %G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD
385// flags set, no dedicated thread is ever used and the call will be
386// handled in the same thread as the object that @interface belongs
387// to was exported in.
388func (x *DBusInterfaceSkeleton) ConnectGAuthorizeMethod(cb *func(DBusInterfaceSkeleton, uintptr) bool) uint {
389 cbPtr := uintptr(unsafe.Pointer(cb))
390 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
391 handlerID := gobject.SignalConnect(x.GoPointer(), "g-authorize-method", cbRefPtr)
392 glib.SaveHandlerMapping(handlerID, cbPtr)
393 return handlerID
394 }
395
396 fcb := func(clsPtr uintptr, InvocationVarp uintptr) bool {
397 fa := DBusInterfaceSkeleton{}
398 fa.Ptr = clsPtr
399 cbFn := *cb
400
401 return cbFn(fa, InvocationVarp)
402
403 }
404 cbRefPtr := purego.NewCallback(fcb)
405 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
406 handlerID := gobject.SignalConnect(x.GoPointer(), "g-authorize-method", cbRefPtr)
407 glib.SaveHandlerMapping(handlerID, cbPtr)
408 return handlerID
409}
410
411// Gets the #GDBusObject that @interface_ belongs to, if any.
412func (x *DBusInterfaceSkeleton) DupObject() *DBusObjectBase {
413 var cls *DBusObjectBase
414
415 cret := XGDbusInterfaceDupObject(x.GoPointer())
416
417 if cret == 0 {
418 return nil
419 }
420 cls = &DBusObjectBase{}
421 cls.Ptr = cret
422 return cls
423}
424
425// Gets the #GDBusObject that @interface_ belongs to, if any.
426//
427// It is not safe to use the returned object if @interface_ or
428// the returned object is being used from other threads. See
429// g_dbus_interface_dup_object() for a thread-safe alternative.
430func (x *DBusInterfaceSkeleton) GetObject() *DBusObjectBase {
431 var cls *DBusObjectBase
432
433 cret := XGDbusInterfaceGetObject(x.GoPointer())
434
435 if cret == 0 {
436 return nil
437 }
438 gobject.IncreaseRef(cret)
439 cls = &DBusObjectBase{}
440 cls.Ptr = cret
441 return cls
442}
443
444// Sets the #GDBusObject for @interface_ to @object.
445//
446// Note that @interface_ will hold a weak reference to @object.
447func (x *DBusInterfaceSkeleton) SetObject(ObjectVar DBusObject) {
448
449 XGDbusInterfaceSetObject(x.GoPointer(), ObjectVar.GoPointer())
450
451}
452
453func init() {
454 core.SetPackageName("GIO", "gio-2.0")
455 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
456 var libs []uintptr
457 for _, libPath := range core.GetPaths("GIO") {
458 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
459 if err != nil {
460 panic(err)
461 }
462 libs = append(libs, lib)
463 }
464
465 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGLibType, libs, "g_dbus_interface_skeleton_get_type")
466
467 core.PuregoSafeRegister(&xDBusInterfaceSkeletonExport, libs, "g_dbus_interface_skeleton_export")
468 core.PuregoSafeRegister(&xDBusInterfaceSkeletonFlush, libs, "g_dbus_interface_skeleton_flush")
469 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetConnection, libs, "g_dbus_interface_skeleton_get_connection")
470 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetConnections, libs, "g_dbus_interface_skeleton_get_connections")
471 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetFlags, libs, "g_dbus_interface_skeleton_get_flags")
472 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetInfo, libs, "g_dbus_interface_skeleton_get_info")
473 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetObjectPath, libs, "g_dbus_interface_skeleton_get_object_path")
474 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetProperties, libs, "g_dbus_interface_skeleton_get_properties")
475 core.PuregoSafeRegister(&xDBusInterfaceSkeletonGetVtable, libs, "g_dbus_interface_skeleton_get_vtable")
476 core.PuregoSafeRegister(&xDBusInterfaceSkeletonHasConnection, libs, "g_dbus_interface_skeleton_has_connection")
477 core.PuregoSafeRegister(&xDBusInterfaceSkeletonSetFlags, libs, "g_dbus_interface_skeleton_set_flags")
478 core.PuregoSafeRegister(&xDBusInterfaceSkeletonUnexport, libs, "g_dbus_interface_skeleton_unexport")
479 core.PuregoSafeRegister(&xDBusInterfaceSkeletonUnexportFromConnection, libs, "g_dbus_interface_skeleton_unexport_from_connection")
480
481}