// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Base type for D-Bus interfaces. type DBusInterfaceIface struct { _ structs.HostLayout ParentIface uintptr xGetInfo uintptr xGetObject uintptr xSetObject uintptr xDupObject uintptr } func (x *DBusInterfaceIface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideGetInfo sets the "get_info" callback function. // Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info(). func (x *DBusInterfaceIface) OverrideGetInfo(cb func(DBusInterface) *DBusInterfaceInfo) { if cb == nil { x.xGetInfo = 0 } else { x.xGetInfo = purego.NewCallback(func(InterfaceVarp uintptr) *DBusInterfaceInfo { return cb(&DBusInterfaceBase{Ptr: InterfaceVarp}) }) } } // GetGetInfo gets the "get_info" callback function. // Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info(). func (x *DBusInterfaceIface) GetGetInfo() func(DBusInterface) *DBusInterfaceInfo { if x.xGetInfo == 0 { return nil } var rawCallback func(InterfaceVarp uintptr) *DBusInterfaceInfo purego.RegisterFunc(&rawCallback, x.xGetInfo) return func(InterfaceVar DBusInterface) *DBusInterfaceInfo { return rawCallback(InterfaceVar.GoPointer()) } } // OverrideGetObject sets the "get_object" callback function. // Gets the enclosing #GDBusObject. See g_dbus_interface_get_object(). func (x *DBusInterfaceIface) OverrideGetObject(cb func(DBusInterface) *DBusObjectBase) { if cb == nil { x.xGetObject = 0 } else { x.xGetObject = purego.NewCallback(func(InterfaceVarp uintptr) uintptr { ret := cb(&DBusInterfaceBase{Ptr: InterfaceVarp}) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetObject gets the "get_object" callback function. // Gets the enclosing #GDBusObject. See g_dbus_interface_get_object(). func (x *DBusInterfaceIface) GetGetObject() func(DBusInterface) *DBusObjectBase { if x.xGetObject == 0 { return nil } var rawCallback func(InterfaceVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xGetObject) return func(InterfaceVar DBusInterface) *DBusObjectBase { rawRet := rawCallback(InterfaceVar.GoPointer()) if rawRet == 0 { return nil } ret := &DBusObjectBase{} ret.Ptr = rawRet return ret } } // OverrideSetObject sets the "set_object" callback function. // Sets the enclosing #GDBusObject. See g_dbus_interface_set_object(). func (x *DBusInterfaceIface) OverrideSetObject(cb func(DBusInterface, DBusObject)) { if cb == nil { x.xSetObject = 0 } else { x.xSetObject = purego.NewCallback(func(InterfaceVarp uintptr, ObjectVarp uintptr) { cb(&DBusInterfaceBase{Ptr: InterfaceVarp}, &DBusObjectBase{Ptr: ObjectVarp}) }) } } // GetSetObject gets the "set_object" callback function. // Sets the enclosing #GDBusObject. See g_dbus_interface_set_object(). func (x *DBusInterfaceIface) GetSetObject() func(DBusInterface, DBusObject) { if x.xSetObject == 0 { return nil } var rawCallback func(InterfaceVarp uintptr, ObjectVarp uintptr) purego.RegisterFunc(&rawCallback, x.xSetObject) return func(InterfaceVar DBusInterface, ObjectVar DBusObject) { rawCallback(InterfaceVar.GoPointer(), ObjectVar.GoPointer()) } } // OverrideDupObject sets the "dup_object" callback function. // Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32. func (x *DBusInterfaceIface) OverrideDupObject(cb func(DBusInterface) *DBusObjectBase) { if cb == nil { x.xDupObject = 0 } else { x.xDupObject = purego.NewCallback(func(InterfaceVarp uintptr) uintptr { ret := cb(&DBusInterfaceBase{Ptr: InterfaceVarp}) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetDupObject gets the "dup_object" callback function. // Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32. func (x *DBusInterfaceIface) GetDupObject() func(DBusInterface) *DBusObjectBase { if x.xDupObject == 0 { return nil } var rawCallback func(InterfaceVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xDupObject) return func(InterfaceVar DBusInterface) *DBusObjectBase { rawRet := rawCallback(InterfaceVar.GoPointer()) if rawRet == 0 { return nil } ret := &DBusObjectBase{} ret.Ptr = rawRet return ret } } // Base type for D-Bus interfaces. // // The `GDBusInterface` type is the base type for D-Bus interfaces both // on the service side (see [class@Gio.DBusInterfaceSkeleton]) and client side // (see [class@Gio.DBusProxy]). type DBusInterface interface { GoPointer() uintptr SetGoPointer(uintptr) DupObject() *DBusObjectBase GetInfo() *DBusInterfaceInfo GetObject() *DBusObjectBase SetObject(ObjectVar DBusObject) } var xDBusInterfaceGLibType func() types.GType func DBusInterfaceGLibType() types.GType { return xDBusInterfaceGLibType() } type DBusInterfaceBase struct { Ptr uintptr } func (x *DBusInterfaceBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *DBusInterfaceBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Gets the #GDBusObject that @interface_ belongs to, if any. func (x *DBusInterfaceBase) DupObject() *DBusObjectBase { var cls *DBusObjectBase cret := XGDbusInterfaceDupObject(x.GoPointer()) if cret == 0 { return nil } cls = &DBusObjectBase{} cls.Ptr = cret return cls } // Gets D-Bus introspection information for the D-Bus interface // implemented by @interface_. func (x *DBusInterfaceBase) GetInfo() *DBusInterfaceInfo { cret := XGDbusInterfaceGetInfo(x.GoPointer()) return cret } // Gets the #GDBusObject that @interface_ belongs to, if any. // // It is not safe to use the returned object if @interface_ or // the returned object is being used from other threads. See // g_dbus_interface_dup_object() for a thread-safe alternative. func (x *DBusInterfaceBase) GetObject() *DBusObjectBase { var cls *DBusObjectBase cret := XGDbusInterfaceGetObject(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &DBusObjectBase{} cls.Ptr = cret return cls } // Sets the #GDBusObject for @interface_ to @object. // // Note that @interface_ will hold a weak reference to @object. func (x *DBusInterfaceBase) SetObject(ObjectVar DBusObject) { XGDbusInterfaceSetObject(x.GoPointer(), ObjectVar.GoPointer()) } var XGDbusInterfaceDupObject func(uintptr) uintptr var XGDbusInterfaceGetInfo func(uintptr) *DBusInterfaceInfo var XGDbusInterfaceGetObject func(uintptr) uintptr var XGDbusInterfaceSetObject func(uintptr, uintptr) 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(&xDBusInterfaceGLibType, libs, "g_dbus_interface_get_type") core.PuregoSafeRegister(&XGDbusInterfaceDupObject, libs, "g_dbus_interface_dup_object") core.PuregoSafeRegister(&XGDbusInterfaceGetInfo, libs, "g_dbus_interface_get_info") core.PuregoSafeRegister(&XGDbusInterfaceGetObject, libs, "g_dbus_interface_get_object") core.PuregoSafeRegister(&XGDbusInterfaceSetObject, libs, "g_dbus_interface_set_object") }