// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Class structure for #GDBusObjectSkeleton. type DBusObjectSkeletonClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xAuthorizeMethod uintptr Padding [8]uintptr } func (x *DBusObjectSkeletonClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideAuthorizeMethod sets the "authorize_method" callback function. // Signal class handler for the #GDBusObjectSkeleton::authorize-method signal. func (x *DBusObjectSkeletonClass) OverrideAuthorizeMethod(cb func(*DBusObjectSkeleton, *DBusInterfaceSkeleton, *DBusMethodInvocation) bool) { if cb == nil { x.xAuthorizeMethod = 0 } else { x.xAuthorizeMethod = purego.NewCallback(func(ObjectVarp uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool { return cb(DBusObjectSkeletonNewFromInternalPtr(ObjectVarp), DBusInterfaceSkeletonNewFromInternalPtr(InterfaceVarp), DBusMethodInvocationNewFromInternalPtr(InvocationVarp)) }) } } // GetAuthorizeMethod gets the "authorize_method" callback function. // Signal class handler for the #GDBusObjectSkeleton::authorize-method signal. func (x *DBusObjectSkeletonClass) GetAuthorizeMethod() func(*DBusObjectSkeleton, *DBusInterfaceSkeleton, *DBusMethodInvocation) bool { if x.xAuthorizeMethod == 0 { return nil } var rawCallback func(ObjectVarp uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xAuthorizeMethod) return func(ObjectVar *DBusObjectSkeleton, InterfaceVar *DBusInterfaceSkeleton, InvocationVar *DBusMethodInvocation) bool { return rawCallback(ObjectVar.GoPointer(), InterfaceVar.GoPointer(), InvocationVar.GoPointer()) } } type DBusObjectSkeletonPrivate struct { _ structs.HostLayout } func (x *DBusObjectSkeletonPrivate) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A `GDBusObjectSkeleton` instance is essentially a group of D-Bus // interfaces. The set of exported interfaces on the object may be // dynamic and change at runtime. // // This type is intended to be used with [iface@Gio.DBusObjectManager]. type DBusObjectSkeleton struct { gobject.Object } var xDBusObjectSkeletonGLibType func() types.GType func DBusObjectSkeletonGLibType() types.GType { return xDBusObjectSkeletonGLibType() } func DBusObjectSkeletonNewFromInternalPtr(ptr uintptr) *DBusObjectSkeleton { cls := &DBusObjectSkeleton{} cls.Ptr = ptr return cls } var xNewDBusObjectSkeleton func(string) uintptr // Creates a new #GDBusObjectSkeleton. func NewDBusObjectSkeleton(ObjectPathVar string) *DBusObjectSkeleton { var cls *DBusObjectSkeleton cret := xNewDBusObjectSkeleton(ObjectPathVar) if cret == 0 { return nil } cls = &DBusObjectSkeleton{} cls.Ptr = cret return cls } var xDBusObjectSkeletonAddInterface func(uintptr, uintptr) // Adds @interface_ to @object. // // If @object already contains a #GDBusInterfaceSkeleton with the same // interface name, it is removed before @interface_ is added. // // Note that @object takes its own reference on @interface_ and holds // it until removed. func (x *DBusObjectSkeleton) AddInterface(InterfaceVar *DBusInterfaceSkeleton) { xDBusObjectSkeletonAddInterface(x.GoPointer(), InterfaceVar.GoPointer()) } var xDBusObjectSkeletonFlush func(uintptr) // This method simply calls g_dbus_interface_skeleton_flush() on all // interfaces belonging to @object. See that method for when flushing // is useful. func (x *DBusObjectSkeleton) Flush() { xDBusObjectSkeletonFlush(x.GoPointer()) } var xDBusObjectSkeletonRemoveInterface func(uintptr, uintptr) // Removes @interface_ from @object. func (x *DBusObjectSkeleton) RemoveInterface(InterfaceVar *DBusInterfaceSkeleton) { xDBusObjectSkeletonRemoveInterface(x.GoPointer(), InterfaceVar.GoPointer()) } var xDBusObjectSkeletonRemoveInterfaceByName func(uintptr, string) // Removes the #GDBusInterface with @interface_name from @object. // // If no D-Bus interface of the given interface exists, this function // does nothing. func (x *DBusObjectSkeleton) RemoveInterfaceByName(InterfaceNameVar string) { xDBusObjectSkeletonRemoveInterfaceByName(x.GoPointer(), InterfaceNameVar) } var xDBusObjectSkeletonSetObjectPath func(uintptr, string) // Sets the object path for @object. func (x *DBusObjectSkeleton) SetObjectPath(ObjectPathVar string) { xDBusObjectSkeletonSetObjectPath(x.GoPointer(), ObjectPathVar) } func (c *DBusObjectSkeleton) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *DBusObjectSkeleton) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyGObjectPath sets the "g-object-path" property. // The object path where the object is exported. func (x *DBusObjectSkeleton) SetPropertyGObjectPath(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("g-object-path", &v) } // GetPropertyGObjectPath gets the "g-object-path" property. // The object path where the object is exported. func (x *DBusObjectSkeleton) GetPropertyGObjectPath() string { var v gobject.Value x.GetProperty("g-object-path", &v) return v.GetString() } // Emitted when a method is invoked by a remote caller and used to // determine if the method call is authorized. // // This signal is like #GDBusInterfaceSkeleton's // #GDBusInterfaceSkeleton::g-authorize-method signal, // except that it is for the enclosing object. // // The default class handler just returns %TRUE. func (x *DBusObjectSkeleton) ConnectAuthorizeMethod(cb *func(DBusObjectSkeleton, uintptr, uintptr) bool) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool { fa := DBusObjectSkeleton{} fa.Ptr = clsPtr cbFn := *cb return cbFn(fa, InterfaceVarp, InvocationVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Gets the D-Bus interface with name @interface_name associated with // @object, if any. func (x *DBusObjectSkeleton) GetInterface(InterfaceNameVar string) *DBusInterfaceBase { var cls *DBusInterfaceBase cret := XGDbusObjectGetInterface(x.GoPointer(), InterfaceNameVar) if cret == 0 { return nil } cls = &DBusInterfaceBase{} cls.Ptr = cret return cls } // Gets the D-Bus interfaces associated with @object. func (x *DBusObjectSkeleton) GetInterfaces() *glib.List { cret := XGDbusObjectGetInterfaces(x.GoPointer()) return cret } // Gets the object path for @object. func (x *DBusObjectSkeleton) GetObjectPath() string { cret := XGDbusObjectGetObjectPath(x.GoPointer()) return cret } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xDBusObjectSkeletonGLibType, libs, "g_dbus_object_skeleton_get_type") core.PuregoSafeRegister(&xNewDBusObjectSkeleton, libs, "g_dbus_object_skeleton_new") core.PuregoSafeRegister(&xDBusObjectSkeletonAddInterface, libs, "g_dbus_object_skeleton_add_interface") core.PuregoSafeRegister(&xDBusObjectSkeletonFlush, libs, "g_dbus_object_skeleton_flush") core.PuregoSafeRegister(&xDBusObjectSkeletonRemoveInterface, libs, "g_dbus_object_skeleton_remove_interface") core.PuregoSafeRegister(&xDBusObjectSkeletonRemoveInterfaceByName, libs, "g_dbus_object_skeleton_remove_interface_by_name") core.PuregoSafeRegister(&xDBusObjectSkeletonSetObjectPath, libs, "g_dbus_object_skeleton_set_object_path") }