// 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" ) type VolumeMonitorClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xVolumeAdded uintptr xVolumeRemoved uintptr xVolumeChanged uintptr xMountAdded uintptr xMountRemoved uintptr xMountPreUnmount uintptr xMountChanged uintptr xDriveConnected uintptr xDriveDisconnected uintptr xDriveChanged uintptr xIsSupported uintptr xGetConnectedDrives uintptr xGetVolumes uintptr xGetMounts uintptr xGetVolumeForUuid uintptr xGetMountForUuid uintptr xAdoptOrphanMount uintptr xDriveEjectButton uintptr xDriveStopButton uintptr xGReserved1 uintptr xGReserved2 uintptr xGReserved3 uintptr xGReserved4 uintptr xGReserved5 uintptr xGReserved6 uintptr } func (x *VolumeMonitorClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideVolumeAdded sets the "volume_added" callback function. func (x *VolumeMonitorClass) OverrideVolumeAdded(cb func(*VolumeMonitor, Volume)) { if cb == nil { x.xVolumeAdded = 0 } else { x.xVolumeAdded = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp}) }) } } // GetVolumeAdded gets the "volume_added" callback function. func (x *VolumeMonitorClass) GetVolumeAdded() func(*VolumeMonitor, Volume) { if x.xVolumeAdded == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) purego.RegisterFunc(&rawCallback, x.xVolumeAdded) return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) { rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer()) } } // OverrideVolumeRemoved sets the "volume_removed" callback function. func (x *VolumeMonitorClass) OverrideVolumeRemoved(cb func(*VolumeMonitor, Volume)) { if cb == nil { x.xVolumeRemoved = 0 } else { x.xVolumeRemoved = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp}) }) } } // GetVolumeRemoved gets the "volume_removed" callback function. func (x *VolumeMonitorClass) GetVolumeRemoved() func(*VolumeMonitor, Volume) { if x.xVolumeRemoved == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) purego.RegisterFunc(&rawCallback, x.xVolumeRemoved) return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) { rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer()) } } // OverrideVolumeChanged sets the "volume_changed" callback function. func (x *VolumeMonitorClass) OverrideVolumeChanged(cb func(*VolumeMonitor, Volume)) { if cb == nil { x.xVolumeChanged = 0 } else { x.xVolumeChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &VolumeBase{Ptr: VolumeVarp}) }) } } // GetVolumeChanged gets the "volume_changed" callback function. func (x *VolumeMonitorClass) GetVolumeChanged() func(*VolumeMonitor, Volume) { if x.xVolumeChanged == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, VolumeVarp uintptr) purego.RegisterFunc(&rawCallback, x.xVolumeChanged) return func(VolumeMonitorVar *VolumeMonitor, VolumeVar Volume) { rawCallback(VolumeMonitorVar.GoPointer(), VolumeVar.GoPointer()) } } // OverrideMountAdded sets the "mount_added" callback function. func (x *VolumeMonitorClass) OverrideMountAdded(cb func(*VolumeMonitor, Mount)) { if cb == nil { x.xMountAdded = 0 } else { x.xMountAdded = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp}) }) } } // GetMountAdded gets the "mount_added" callback function. func (x *VolumeMonitorClass) GetMountAdded() func(*VolumeMonitor, Mount) { if x.xMountAdded == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr) purego.RegisterFunc(&rawCallback, x.xMountAdded) return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) { rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer()) } } // OverrideMountRemoved sets the "mount_removed" callback function. func (x *VolumeMonitorClass) OverrideMountRemoved(cb func(*VolumeMonitor, Mount)) { if cb == nil { x.xMountRemoved = 0 } else { x.xMountRemoved = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp}) }) } } // GetMountRemoved gets the "mount_removed" callback function. func (x *VolumeMonitorClass) GetMountRemoved() func(*VolumeMonitor, Mount) { if x.xMountRemoved == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr) purego.RegisterFunc(&rawCallback, x.xMountRemoved) return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) { rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer()) } } // OverrideMountPreUnmount sets the "mount_pre_unmount" callback function. func (x *VolumeMonitorClass) OverrideMountPreUnmount(cb func(*VolumeMonitor, Mount)) { if cb == nil { x.xMountPreUnmount = 0 } else { x.xMountPreUnmount = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp}) }) } } // GetMountPreUnmount gets the "mount_pre_unmount" callback function. func (x *VolumeMonitorClass) GetMountPreUnmount() func(*VolumeMonitor, Mount) { if x.xMountPreUnmount == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr) purego.RegisterFunc(&rawCallback, x.xMountPreUnmount) return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) { rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer()) } } // OverrideMountChanged sets the "mount_changed" callback function. func (x *VolumeMonitorClass) OverrideMountChanged(cb func(*VolumeMonitor, Mount)) { if cb == nil { x.xMountChanged = 0 } else { x.xMountChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, MountVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &MountBase{Ptr: MountVarp}) }) } } // GetMountChanged gets the "mount_changed" callback function. func (x *VolumeMonitorClass) GetMountChanged() func(*VolumeMonitor, Mount) { if x.xMountChanged == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, MountVarp uintptr) purego.RegisterFunc(&rawCallback, x.xMountChanged) return func(VolumeMonitorVar *VolumeMonitor, MountVar Mount) { rawCallback(VolumeMonitorVar.GoPointer(), MountVar.GoPointer()) } } // OverrideDriveConnected sets the "drive_connected" callback function. func (x *VolumeMonitorClass) OverrideDriveConnected(cb func(*VolumeMonitor, Drive)) { if cb == nil { x.xDriveConnected = 0 } else { x.xDriveConnected = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp}) }) } } // GetDriveConnected gets the "drive_connected" callback function. func (x *VolumeMonitorClass) GetDriveConnected() func(*VolumeMonitor, Drive) { if x.xDriveConnected == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr) purego.RegisterFunc(&rawCallback, x.xDriveConnected) return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) { rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer()) } } // OverrideDriveDisconnected sets the "drive_disconnected" callback function. func (x *VolumeMonitorClass) OverrideDriveDisconnected(cb func(*VolumeMonitor, Drive)) { if cb == nil { x.xDriveDisconnected = 0 } else { x.xDriveDisconnected = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp}) }) } } // GetDriveDisconnected gets the "drive_disconnected" callback function. func (x *VolumeMonitorClass) GetDriveDisconnected() func(*VolumeMonitor, Drive) { if x.xDriveDisconnected == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr) purego.RegisterFunc(&rawCallback, x.xDriveDisconnected) return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) { rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer()) } } // OverrideDriveChanged sets the "drive_changed" callback function. func (x *VolumeMonitorClass) OverrideDriveChanged(cb func(*VolumeMonitor, Drive)) { if cb == nil { x.xDriveChanged = 0 } else { x.xDriveChanged = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp}) }) } } // GetDriveChanged gets the "drive_changed" callback function. func (x *VolumeMonitorClass) GetDriveChanged() func(*VolumeMonitor, Drive) { if x.xDriveChanged == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr) purego.RegisterFunc(&rawCallback, x.xDriveChanged) return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) { rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer()) } } // OverrideIsSupported sets the "is_supported" callback function. func (x *VolumeMonitorClass) OverrideIsSupported(cb func() bool) { if cb == nil { x.xIsSupported = 0 } else { x.xIsSupported = purego.NewCallback(func() bool { return cb() }) } } // GetIsSupported gets the "is_supported" callback function. func (x *VolumeMonitorClass) GetIsSupported() func() bool { if x.xIsSupported == 0 { return nil } var rawCallback func() bool purego.RegisterFunc(&rawCallback, x.xIsSupported) return func() bool { return rawCallback() } } // OverrideGetConnectedDrives sets the "get_connected_drives" callback function. func (x *VolumeMonitorClass) OverrideGetConnectedDrives(cb func(*VolumeMonitor) *glib.List) { if cb == nil { x.xGetConnectedDrives = 0 } else { x.xGetConnectedDrives = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List { return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp)) }) } } // GetGetConnectedDrives gets the "get_connected_drives" callback function. func (x *VolumeMonitorClass) GetGetConnectedDrives() func(*VolumeMonitor) *glib.List { if x.xGetConnectedDrives == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr) *glib.List purego.RegisterFunc(&rawCallback, x.xGetConnectedDrives) return func(VolumeMonitorVar *VolumeMonitor) *glib.List { return rawCallback(VolumeMonitorVar.GoPointer()) } } // OverrideGetVolumes sets the "get_volumes" callback function. func (x *VolumeMonitorClass) OverrideGetVolumes(cb func(*VolumeMonitor) *glib.List) { if cb == nil { x.xGetVolumes = 0 } else { x.xGetVolumes = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List { return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp)) }) } } // GetGetVolumes gets the "get_volumes" callback function. func (x *VolumeMonitorClass) GetGetVolumes() func(*VolumeMonitor) *glib.List { if x.xGetVolumes == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr) *glib.List purego.RegisterFunc(&rawCallback, x.xGetVolumes) return func(VolumeMonitorVar *VolumeMonitor) *glib.List { return rawCallback(VolumeMonitorVar.GoPointer()) } } // OverrideGetMounts sets the "get_mounts" callback function. func (x *VolumeMonitorClass) OverrideGetMounts(cb func(*VolumeMonitor) *glib.List) { if cb == nil { x.xGetMounts = 0 } else { x.xGetMounts = purego.NewCallback(func(VolumeMonitorVarp uintptr) *glib.List { return cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp)) }) } } // GetGetMounts gets the "get_mounts" callback function. func (x *VolumeMonitorClass) GetGetMounts() func(*VolumeMonitor) *glib.List { if x.xGetMounts == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr) *glib.List purego.RegisterFunc(&rawCallback, x.xGetMounts) return func(VolumeMonitorVar *VolumeMonitor) *glib.List { return rawCallback(VolumeMonitorVar.GoPointer()) } } // OverrideGetVolumeForUuid sets the "get_volume_for_uuid" callback function. func (x *VolumeMonitorClass) OverrideGetVolumeForUuid(cb func(*VolumeMonitor, string) *VolumeBase) { if cb == nil { x.xGetVolumeForUuid = 0 } else { x.xGetVolumeForUuid = purego.NewCallback(func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr { ret := cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), UuidVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetVolumeForUuid gets the "get_volume_for_uuid" callback function. func (x *VolumeMonitorClass) GetGetVolumeForUuid() func(*VolumeMonitor, string) *VolumeBase { if x.xGetVolumeForUuid == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr purego.RegisterFunc(&rawCallback, x.xGetVolumeForUuid) return func(VolumeMonitorVar *VolumeMonitor, UuidVar string) *VolumeBase { rawRet := rawCallback(VolumeMonitorVar.GoPointer(), UuidVar) if rawRet == 0 { return nil } ret := &VolumeBase{} ret.Ptr = rawRet return ret } } // OverrideGetMountForUuid sets the "get_mount_for_uuid" callback function. func (x *VolumeMonitorClass) OverrideGetMountForUuid(cb func(*VolumeMonitor, string) *MountBase) { if cb == nil { x.xGetMountForUuid = 0 } else { x.xGetMountForUuid = purego.NewCallback(func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr { ret := cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), UuidVarp) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetMountForUuid gets the "get_mount_for_uuid" callback function. func (x *VolumeMonitorClass) GetGetMountForUuid() func(*VolumeMonitor, string) *MountBase { if x.xGetMountForUuid == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, UuidVarp string) uintptr purego.RegisterFunc(&rawCallback, x.xGetMountForUuid) return func(VolumeMonitorVar *VolumeMonitor, UuidVar string) *MountBase { rawRet := rawCallback(VolumeMonitorVar.GoPointer(), UuidVar) if rawRet == 0 { return nil } ret := &MountBase{} ret.Ptr = rawRet return ret } } // OverrideAdoptOrphanMount sets the "adopt_orphan_mount" callback function. func (x *VolumeMonitorClass) OverrideAdoptOrphanMount(cb func(Mount, *VolumeMonitor) *VolumeBase) { if cb == nil { x.xAdoptOrphanMount = 0 } else { x.xAdoptOrphanMount = purego.NewCallback(func(MountVarp uintptr, VolumeMonitorVarp uintptr) uintptr { ret := cb(&MountBase{Ptr: MountVarp}, VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp)) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetAdoptOrphanMount gets the "adopt_orphan_mount" callback function. func (x *VolumeMonitorClass) GetAdoptOrphanMount() func(Mount, *VolumeMonitor) *VolumeBase { if x.xAdoptOrphanMount == 0 { return nil } var rawCallback func(MountVarp uintptr, VolumeMonitorVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xAdoptOrphanMount) return func(MountVar Mount, VolumeMonitorVar *VolumeMonitor) *VolumeBase { rawRet := rawCallback(MountVar.GoPointer(), VolumeMonitorVar.GoPointer()) if rawRet == 0 { return nil } ret := &VolumeBase{} ret.Ptr = rawRet return ret } } // OverrideDriveEjectButton sets the "drive_eject_button" callback function. func (x *VolumeMonitorClass) OverrideDriveEjectButton(cb func(*VolumeMonitor, Drive)) { if cb == nil { x.xDriveEjectButton = 0 } else { x.xDriveEjectButton = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp}) }) } } // GetDriveEjectButton gets the "drive_eject_button" callback function. func (x *VolumeMonitorClass) GetDriveEjectButton() func(*VolumeMonitor, Drive) { if x.xDriveEjectButton == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr) purego.RegisterFunc(&rawCallback, x.xDriveEjectButton) return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) { rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer()) } } // OverrideDriveStopButton sets the "drive_stop_button" callback function. func (x *VolumeMonitorClass) OverrideDriveStopButton(cb func(*VolumeMonitor, Drive)) { if cb == nil { x.xDriveStopButton = 0 } else { x.xDriveStopButton = purego.NewCallback(func(VolumeMonitorVarp uintptr, DriveVarp uintptr) { cb(VolumeMonitorNewFromInternalPtr(VolumeMonitorVarp), &DriveBase{Ptr: DriveVarp}) }) } } // GetDriveStopButton gets the "drive_stop_button" callback function. func (x *VolumeMonitorClass) GetDriveStopButton() func(*VolumeMonitor, Drive) { if x.xDriveStopButton == 0 { return nil } var rawCallback func(VolumeMonitorVarp uintptr, DriveVarp uintptr) purego.RegisterFunc(&rawCallback, x.xDriveStopButton) return func(VolumeMonitorVar *VolumeMonitor, DriveVar Drive) { rawCallback(VolumeMonitorVar.GoPointer(), DriveVar.GoPointer()) } } // OverrideGReserved1 sets the "_g_reserved1" callback function. func (x *VolumeMonitorClass) OverrideGReserved1(cb func()) { if cb == nil { x.xGReserved1 = 0 } else { x.xGReserved1 = purego.NewCallback(func() { cb() }) } } // GetGReserved1 gets the "_g_reserved1" callback function. func (x *VolumeMonitorClass) GetGReserved1() func() { if x.xGReserved1 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved1) return func() { rawCallback() } } // OverrideGReserved2 sets the "_g_reserved2" callback function. func (x *VolumeMonitorClass) OverrideGReserved2(cb func()) { if cb == nil { x.xGReserved2 = 0 } else { x.xGReserved2 = purego.NewCallback(func() { cb() }) } } // GetGReserved2 gets the "_g_reserved2" callback function. func (x *VolumeMonitorClass) GetGReserved2() func() { if x.xGReserved2 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved2) return func() { rawCallback() } } // OverrideGReserved3 sets the "_g_reserved3" callback function. func (x *VolumeMonitorClass) OverrideGReserved3(cb func()) { if cb == nil { x.xGReserved3 = 0 } else { x.xGReserved3 = purego.NewCallback(func() { cb() }) } } // GetGReserved3 gets the "_g_reserved3" callback function. func (x *VolumeMonitorClass) GetGReserved3() func() { if x.xGReserved3 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved3) return func() { rawCallback() } } // OverrideGReserved4 sets the "_g_reserved4" callback function. func (x *VolumeMonitorClass) OverrideGReserved4(cb func()) { if cb == nil { x.xGReserved4 = 0 } else { x.xGReserved4 = purego.NewCallback(func() { cb() }) } } // GetGReserved4 gets the "_g_reserved4" callback function. func (x *VolumeMonitorClass) GetGReserved4() func() { if x.xGReserved4 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved4) return func() { rawCallback() } } // OverrideGReserved5 sets the "_g_reserved5" callback function. func (x *VolumeMonitorClass) OverrideGReserved5(cb func()) { if cb == nil { x.xGReserved5 = 0 } else { x.xGReserved5 = purego.NewCallback(func() { cb() }) } } // GetGReserved5 gets the "_g_reserved5" callback function. func (x *VolumeMonitorClass) GetGReserved5() func() { if x.xGReserved5 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved5) return func() { rawCallback() } } // OverrideGReserved6 sets the "_g_reserved6" callback function. func (x *VolumeMonitorClass) OverrideGReserved6(cb func()) { if cb == nil { x.xGReserved6 = 0 } else { x.xGReserved6 = purego.NewCallback(func() { cb() }) } } // GetGReserved6 gets the "_g_reserved6" callback function. func (x *VolumeMonitorClass) GetGReserved6() func() { if x.xGReserved6 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved6) return func() { rawCallback() } } const ( // Extension point for volume monitor functionality. // See [Extending GIO](overview.html#extending-gio). VOLUME_MONITOR_EXTENSION_POINT_NAME string = "gio-volume-monitor" ) // `GVolumeMonitor` is for listing the user interesting devices and volumes // on the computer. In other words, what a file selector or file manager // would show in a sidebar. // // `GVolumeMonitor` is not // thread-default-context aware (see // [method@GLib.MainContext.push_thread_default]), and so should not be used // other than from the main thread, with no thread-default-context active. // // In order to receive updates about volumes and mounts monitored through GVFS, // a main loop must be running. type VolumeMonitor struct { gobject.Object } var xVolumeMonitorGLibType func() types.GType func VolumeMonitorGLibType() types.GType { return xVolumeMonitorGLibType() } func VolumeMonitorNewFromInternalPtr(ptr uintptr) *VolumeMonitor { cls := &VolumeMonitor{} cls.Ptr = ptr return cls } var xVolumeMonitorGetConnectedDrives func(uintptr) *glib.List // Gets a list of drives connected to the system. // // The returned list should be freed with g_list_free(), after // its elements have been unreffed with g_object_unref(). func (x *VolumeMonitor) GetConnectedDrives() *glib.List { cret := xVolumeMonitorGetConnectedDrives(x.GoPointer()) return cret } var xVolumeMonitorGetMountForUuid func(uintptr, string) uintptr // Finds a #GMount object by its UUID (see g_mount_get_uuid()) func (x *VolumeMonitor) GetMountForUuid(UuidVar string) *MountBase { var cls *MountBase cret := xVolumeMonitorGetMountForUuid(x.GoPointer(), UuidVar) if cret == 0 { return nil } cls = &MountBase{} cls.Ptr = cret return cls } var xVolumeMonitorGetMounts func(uintptr) *glib.List // Gets a list of the mounts on the system. // // The returned list should be freed with g_list_free(), after // its elements have been unreffed with g_object_unref(). func (x *VolumeMonitor) GetMounts() *glib.List { cret := xVolumeMonitorGetMounts(x.GoPointer()) return cret } var xVolumeMonitorGetVolumeForUuid func(uintptr, string) uintptr // Finds a #GVolume object by its UUID (see g_volume_get_uuid()) func (x *VolumeMonitor) GetVolumeForUuid(UuidVar string) *VolumeBase { var cls *VolumeBase cret := xVolumeMonitorGetVolumeForUuid(x.GoPointer(), UuidVar) if cret == 0 { return nil } cls = &VolumeBase{} cls.Ptr = cret return cls } var xVolumeMonitorGetVolumes func(uintptr) *glib.List // Gets a list of the volumes on the system. // // The returned list should be freed with g_list_free(), after // its elements have been unreffed with g_object_unref(). func (x *VolumeMonitor) GetVolumes() *glib.List { cret := xVolumeMonitorGetVolumes(x.GoPointer()) return cret } func (c *VolumeMonitor) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *VolumeMonitor) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // Emitted when a drive changes. func (x *VolumeMonitor) ConnectDriveChanged(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, DriveVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, DriveVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a drive is connected to the system. func (x *VolumeMonitor) ConnectDriveConnected(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, DriveVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, DriveVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a drive is disconnected from the system. func (x *VolumeMonitor) ConnectDriveDisconnected(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, DriveVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, DriveVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when the eject button is pressed on @drive. func (x *VolumeMonitor) ConnectDriveEjectButton(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, DriveVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, DriveVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when the stop button is pressed on @drive. func (x *VolumeMonitor) ConnectDriveStopButton(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, DriveVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, DriveVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mount is added. func (x *VolumeMonitor) ConnectMountAdded(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MountVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, MountVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mount changes. func (x *VolumeMonitor) ConnectMountChanged(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MountVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, MountVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // May be emitted when a mount is about to be removed. // // This signal depends on the backend and is only emitted if // GIO was used to unmount. func (x *VolumeMonitor) ConnectMountPreUnmount(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MountVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, MountVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mount is removed. func (x *VolumeMonitor) ConnectMountRemoved(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MountVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, MountVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mountable volume is added to the system. func (x *VolumeMonitor) ConnectVolumeAdded(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, VolumeVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, VolumeVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when mountable volume is changed. func (x *VolumeMonitor) ConnectVolumeChanged(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, VolumeVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, VolumeVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mountable volume is removed from the system. func (x *VolumeMonitor) ConnectVolumeRemoved(cb *func(VolumeMonitor, uintptr)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, VolumeVarp uintptr) { fa := VolumeMonitor{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, VolumeVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } var xVolumeMonitorAdoptOrphanMount func(uintptr) uintptr // This function should be called by any #GVolumeMonitor // implementation when a new #GMount object is created that is not // associated with a #GVolume object. It must be called just before // emitting the @mount_added signal. // // If the return value is not %NULL, the caller must associate the // returned #GVolume object with the #GMount. This involves returning // it in its g_mount_get_volume() implementation. The caller must // also listen for the "removed" signal on the returned object // and give up its reference when handling that signal // // Similarly, if implementing g_volume_monitor_adopt_orphan_mount(), // the implementor must take a reference to @mount and return it in // its g_volume_get_mount() implemented. Also, the implementor must // listen for the "unmounted" signal on @mount and give up its // reference upon handling that signal. // // There are two main use cases for this function. // // One is when implementing a user space file system driver that reads // blocks of a block device that is already represented by the native // volume monitor (for example a CD Audio file system driver). Such // a driver will generate its own #GMount object that needs to be // associated with the #GVolume object that represents the volume. // // The other is for implementing a #GVolumeMonitor whose sole purpose // is to return #GVolume objects representing entries in the users // "favorite servers" list or similar. func VolumeMonitorAdoptOrphanMount(MountVar Mount) *VolumeBase { var cls *VolumeBase cret := xVolumeMonitorAdoptOrphanMount(MountVar.GoPointer()) if cret == 0 { return nil } cls = &VolumeBase{} cls.Ptr = cret return cls } var xVolumeMonitorGet func() uintptr // Gets the volume monitor used by gio. func VolumeMonitorGet() *VolumeMonitor { var cls *VolumeMonitor cret := xVolumeMonitorGet() if cret == 0 { return nil } cls = &VolumeMonitor{} cls.Ptr = cret return cls } 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(&xVolumeMonitorGLibType, libs, "g_volume_monitor_get_type") core.PuregoSafeRegister(&xVolumeMonitorGetConnectedDrives, libs, "g_volume_monitor_get_connected_drives") core.PuregoSafeRegister(&xVolumeMonitorGetMountForUuid, libs, "g_volume_monitor_get_mount_for_uuid") core.PuregoSafeRegister(&xVolumeMonitorGetMounts, libs, "g_volume_monitor_get_mounts") core.PuregoSafeRegister(&xVolumeMonitorGetVolumeForUuid, libs, "g_volume_monitor_get_volume_for_uuid") core.PuregoSafeRegister(&xVolumeMonitorGetVolumes, libs, "g_volume_monitor_get_volumes") core.PuregoSafeRegister(&xVolumeMonitorAdoptOrphanMount, libs, "g_volume_monitor_adopt_orphan_mount") core.PuregoSafeRegister(&xVolumeMonitorGet, libs, "g_volume_monitor_get") }