// 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/types" ) // Base object type for D-Bus objects. type DBusObjectIface struct { _ structs.HostLayout ParentIface uintptr xGetObjectPath uintptr xGetInterfaces uintptr xGetInterface uintptr xInterfaceAdded uintptr xInterfaceRemoved uintptr } func (x *DBusObjectIface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideGetObjectPath sets the "get_object_path" callback function. // Returns the object path. See g_dbus_object_get_object_path(). func (x *DBusObjectIface) OverrideGetObjectPath(cb func(DBusObject) string) { if cb == nil { x.xGetObjectPath = 0 } else { x.xGetObjectPath = purego.NewCallback(func(ObjectVarp uintptr) string { return cb(&DBusObjectBase{Ptr: ObjectVarp}) }) } } // GetGetObjectPath gets the "get_object_path" callback function. // Returns the object path. See g_dbus_object_get_object_path(). func (x *DBusObjectIface) GetGetObjectPath() func(DBusObject) string { if x.xGetObjectPath == 0 { return nil } var rawCallback func(ObjectVarp uintptr) string purego.RegisterFunc(&rawCallback, x.xGetObjectPath) return func(ObjectVar DBusObject) string { return rawCallback(ObjectVar.GoPointer()) } } // OverrideGetInterfaces sets the "get_interfaces" callback function. // Returns all interfaces. See g_dbus_object_get_interfaces(). func (x *DBusObjectIface) OverrideGetInterfaces(cb func(DBusObject) *glib.List) { if cb == nil { x.xGetInterfaces = 0 } else { x.xGetInterfaces = purego.NewCallback(func(ObjectVarp uintptr) *glib.List { return cb(&DBusObjectBase{Ptr: ObjectVarp}) }) } } // GetGetInterfaces gets the "get_interfaces" callback function. // Returns all interfaces. See g_dbus_object_get_interfaces(). func (x *DBusObjectIface) GetGetInterfaces() func(DBusObject) *glib.List { if x.xGetInterfaces == 0 { return nil } var rawCallback func(ObjectVarp uintptr) *glib.List purego.RegisterFunc(&rawCallback, x.xGetInterfaces) return func(ObjectVar DBusObject) *glib.List { return rawCallback(ObjectVar.GoPointer()) } } // OverrideGetInterface sets the "get_interface" callback function. // Returns an interface by name. See g_dbus_object_get_interface(). func (x *DBusObjectIface) OverrideGetInterface(cb func(DBusObject, string) *DBusInterfaceBase) { if cb == nil { x.xGetInterface = 0 } else { x.xGetInterface = purego.NewCallback(func(ObjectVarp uintptr, InterfaceNameVarp string) uintptr { ret := cb(&DBusObjectBase{Ptr: ObjectVarp}, InterfaceNameVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetInterface gets the "get_interface" callback function. // Returns an interface by name. See g_dbus_object_get_interface(). func (x *DBusObjectIface) GetGetInterface() func(DBusObject, string) *DBusInterfaceBase { if x.xGetInterface == 0 { return nil } var rawCallback func(ObjectVarp uintptr, InterfaceNameVarp string) uintptr purego.RegisterFunc(&rawCallback, x.xGetInterface) return func(ObjectVar DBusObject, InterfaceNameVar string) *DBusInterfaceBase { rawRet := rawCallback(ObjectVar.GoPointer(), InterfaceNameVar) if rawRet == 0 { return nil } ret := &DBusInterfaceBase{} ret.Ptr = rawRet return ret } } // OverrideInterfaceAdded sets the "interface_added" callback function. // Signal handler for the #GDBusObject::interface-added signal. func (x *DBusObjectIface) OverrideInterfaceAdded(cb func(DBusObject, DBusInterface)) { if cb == nil { x.xInterfaceAdded = 0 } else { x.xInterfaceAdded = purego.NewCallback(func(ObjectVarp uintptr, InterfaceVarp uintptr) { cb(&DBusObjectBase{Ptr: ObjectVarp}, &DBusInterfaceBase{Ptr: InterfaceVarp}) }) } } // GetInterfaceAdded gets the "interface_added" callback function. // Signal handler for the #GDBusObject::interface-added signal. func (x *DBusObjectIface) GetInterfaceAdded() func(DBusObject, DBusInterface) { if x.xInterfaceAdded == 0 { return nil } var rawCallback func(ObjectVarp uintptr, InterfaceVarp uintptr) purego.RegisterFunc(&rawCallback, x.xInterfaceAdded) return func(ObjectVar DBusObject, InterfaceVar DBusInterface) { rawCallback(ObjectVar.GoPointer(), InterfaceVar.GoPointer()) } } // OverrideInterfaceRemoved sets the "interface_removed" callback function. // Signal handler for the #GDBusObject::interface-removed signal. func (x *DBusObjectIface) OverrideInterfaceRemoved(cb func(DBusObject, DBusInterface)) { if cb == nil { x.xInterfaceRemoved = 0 } else { x.xInterfaceRemoved = purego.NewCallback(func(ObjectVarp uintptr, InterfaceVarp uintptr) { cb(&DBusObjectBase{Ptr: ObjectVarp}, &DBusInterfaceBase{Ptr: InterfaceVarp}) }) } } // GetInterfaceRemoved gets the "interface_removed" callback function. // Signal handler for the #GDBusObject::interface-removed signal. func (x *DBusObjectIface) GetInterfaceRemoved() func(DBusObject, DBusInterface) { if x.xInterfaceRemoved == 0 { return nil } var rawCallback func(ObjectVarp uintptr, InterfaceVarp uintptr) purego.RegisterFunc(&rawCallback, x.xInterfaceRemoved) return func(ObjectVar DBusObject, InterfaceVar DBusInterface) { rawCallback(ObjectVar.GoPointer(), InterfaceVar.GoPointer()) } } // The `GDBusObject` type is the base type for D-Bus objects on both // the service side (see [class@Gio.DBusObjectSkeleton]) and the client side // (see [class@Gio.DBusObjectProxy]). It is essentially just a container of // interfaces. type DBusObject interface { GoPointer() uintptr SetGoPointer(uintptr) GetInterface(InterfaceNameVar string) *DBusInterfaceBase GetInterfaces() *glib.List GetObjectPath() string } var xDBusObjectGLibType func() types.GType func DBusObjectGLibType() types.GType { return xDBusObjectGLibType() } type DBusObjectBase struct { Ptr uintptr } func (x *DBusObjectBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *DBusObjectBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Gets the D-Bus interface with name @interface_name associated with // @object, if any. func (x *DBusObjectBase) 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 *DBusObjectBase) GetInterfaces() *glib.List { cret := XGDbusObjectGetInterfaces(x.GoPointer()) return cret } // Gets the object path for @object. func (x *DBusObjectBase) GetObjectPath() string { cret := XGDbusObjectGetObjectPath(x.GoPointer()) return cret } var XGDbusObjectGetInterface func(uintptr, string) uintptr var XGDbusObjectGetInterfaces func(uintptr) *glib.List var XGDbusObjectGetObjectPath func(uintptr) string 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(&xDBusObjectGLibType, libs, "g_dbus_object_get_type") core.PuregoSafeRegister(&XGDbusObjectGetInterface, libs, "g_dbus_object_get_interface") core.PuregoSafeRegister(&XGDbusObjectGetInterfaces, libs, "g_dbus_object_get_interfaces") core.PuregoSafeRegister(&XGDbusObjectGetObjectPath, libs, "g_dbus_object_get_object_path") }