// 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 MountOperationClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass xAskPassword uintptr xAskQuestion uintptr xReply uintptr xAborted uintptr xShowProcesses uintptr xShowUnmountProgress uintptr xGReserved1 uintptr xGReserved2 uintptr xGReserved3 uintptr xGReserved4 uintptr xGReserved5 uintptr xGReserved6 uintptr xGReserved7 uintptr xGReserved8 uintptr xGReserved9 uintptr } func (x *MountOperationClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideAskPassword sets the "ask_password" callback function. func (x *MountOperationClass) OverrideAskPassword(cb func(*MountOperation, string, string, string, AskPasswordFlags)) { if cb == nil { x.xAskPassword = 0 } else { x.xAskPassword = purego.NewCallback(func(OpVarp uintptr, MessageVarp string, DefaultUserVarp string, DefaultDomainVarp string, FlagsVarp AskPasswordFlags) { cb(MountOperationNewFromInternalPtr(OpVarp), MessageVarp, DefaultUserVarp, DefaultDomainVarp, FlagsVarp) }) } } // GetAskPassword gets the "ask_password" callback function. func (x *MountOperationClass) GetAskPassword() func(*MountOperation, string, string, string, AskPasswordFlags) { if x.xAskPassword == 0 { return nil } var rawCallback func(OpVarp uintptr, MessageVarp string, DefaultUserVarp string, DefaultDomainVarp string, FlagsVarp AskPasswordFlags) purego.RegisterFunc(&rawCallback, x.xAskPassword) return func(OpVar *MountOperation, MessageVar string, DefaultUserVar string, DefaultDomainVar string, FlagsVar AskPasswordFlags) { rawCallback(OpVar.GoPointer(), MessageVar, DefaultUserVar, DefaultDomainVar, FlagsVar) } } // OverrideAskQuestion sets the "ask_question" callback function. func (x *MountOperationClass) OverrideAskQuestion(cb func(*MountOperation, string, []string)) { if cb == nil { x.xAskQuestion = 0 } else { x.xAskQuestion = purego.NewCallback(func(OpVarp uintptr, MessageVarp string, ChoicesVarp []string) { cb(MountOperationNewFromInternalPtr(OpVarp), MessageVarp, ChoicesVarp) }) } } // GetAskQuestion gets the "ask_question" callback function. func (x *MountOperationClass) GetAskQuestion() func(*MountOperation, string, []string) { if x.xAskQuestion == 0 { return nil } var rawCallback func(OpVarp uintptr, MessageVarp string, ChoicesVarp []string) purego.RegisterFunc(&rawCallback, x.xAskQuestion) return func(OpVar *MountOperation, MessageVar string, ChoicesVar []string) { rawCallback(OpVar.GoPointer(), MessageVar, ChoicesVar) } } // OverrideReply sets the "reply" callback function. func (x *MountOperationClass) OverrideReply(cb func(*MountOperation, MountOperationResult)) { if cb == nil { x.xReply = 0 } else { x.xReply = purego.NewCallback(func(OpVarp uintptr, ResultVarp MountOperationResult) { cb(MountOperationNewFromInternalPtr(OpVarp), ResultVarp) }) } } // GetReply gets the "reply" callback function. func (x *MountOperationClass) GetReply() func(*MountOperation, MountOperationResult) { if x.xReply == 0 { return nil } var rawCallback func(OpVarp uintptr, ResultVarp MountOperationResult) purego.RegisterFunc(&rawCallback, x.xReply) return func(OpVar *MountOperation, ResultVar MountOperationResult) { rawCallback(OpVar.GoPointer(), ResultVar) } } // OverrideAborted sets the "aborted" callback function. func (x *MountOperationClass) OverrideAborted(cb func(*MountOperation)) { if cb == nil { x.xAborted = 0 } else { x.xAborted = purego.NewCallback(func(OpVarp uintptr) { cb(MountOperationNewFromInternalPtr(OpVarp)) }) } } // GetAborted gets the "aborted" callback function. func (x *MountOperationClass) GetAborted() func(*MountOperation) { if x.xAborted == 0 { return nil } var rawCallback func(OpVarp uintptr) purego.RegisterFunc(&rawCallback, x.xAborted) return func(OpVar *MountOperation) { rawCallback(OpVar.GoPointer()) } } // OverrideShowProcesses sets the "show_processes" callback function. func (x *MountOperationClass) OverrideShowProcesses(cb func(*MountOperation, string, []glib.Pid, []string)) { if cb == nil { x.xShowProcesses = 0 } else { x.xShowProcesses = purego.NewCallback(func(OpVarp uintptr, MessageVarp string, ProcessesVarp []glib.Pid, ChoicesVarp []string) { cb(MountOperationNewFromInternalPtr(OpVarp), MessageVarp, ProcessesVarp, ChoicesVarp) }) } } // GetShowProcesses gets the "show_processes" callback function. func (x *MountOperationClass) GetShowProcesses() func(*MountOperation, string, []glib.Pid, []string) { if x.xShowProcesses == 0 { return nil } var rawCallback func(OpVarp uintptr, MessageVarp string, ProcessesVarp []glib.Pid, ChoicesVarp []string) purego.RegisterFunc(&rawCallback, x.xShowProcesses) return func(OpVar *MountOperation, MessageVar string, ProcessesVar []glib.Pid, ChoicesVar []string) { rawCallback(OpVar.GoPointer(), MessageVar, ProcessesVar, ChoicesVar) } } // OverrideShowUnmountProgress sets the "show_unmount_progress" callback function. func (x *MountOperationClass) OverrideShowUnmountProgress(cb func(*MountOperation, string, int64, int64)) { if cb == nil { x.xShowUnmountProgress = 0 } else { x.xShowUnmountProgress = purego.NewCallback(func(OpVarp uintptr, MessageVarp string, TimeLeftVarp int64, BytesLeftVarp int64) { cb(MountOperationNewFromInternalPtr(OpVarp), MessageVarp, TimeLeftVarp, BytesLeftVarp) }) } } // GetShowUnmountProgress gets the "show_unmount_progress" callback function. func (x *MountOperationClass) GetShowUnmountProgress() func(*MountOperation, string, int64, int64) { if x.xShowUnmountProgress == 0 { return nil } var rawCallback func(OpVarp uintptr, MessageVarp string, TimeLeftVarp int64, BytesLeftVarp int64) purego.RegisterFunc(&rawCallback, x.xShowUnmountProgress) return func(OpVar *MountOperation, MessageVar string, TimeLeftVar int64, BytesLeftVar int64) { rawCallback(OpVar.GoPointer(), MessageVar, TimeLeftVar, BytesLeftVar) } } // OverrideGReserved1 sets the "_g_reserved1" callback function. func (x *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) 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 *MountOperationClass) GetGReserved6() func() { if x.xGReserved6 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved6) return func() { rawCallback() } } // OverrideGReserved7 sets the "_g_reserved7" callback function. func (x *MountOperationClass) OverrideGReserved7(cb func()) { if cb == nil { x.xGReserved7 = 0 } else { x.xGReserved7 = purego.NewCallback(func() { cb() }) } } // GetGReserved7 gets the "_g_reserved7" callback function. func (x *MountOperationClass) GetGReserved7() func() { if x.xGReserved7 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved7) return func() { rawCallback() } } // OverrideGReserved8 sets the "_g_reserved8" callback function. func (x *MountOperationClass) OverrideGReserved8(cb func()) { if cb == nil { x.xGReserved8 = 0 } else { x.xGReserved8 = purego.NewCallback(func() { cb() }) } } // GetGReserved8 gets the "_g_reserved8" callback function. func (x *MountOperationClass) GetGReserved8() func() { if x.xGReserved8 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved8) return func() { rawCallback() } } // OverrideGReserved9 sets the "_g_reserved9" callback function. func (x *MountOperationClass) OverrideGReserved9(cb func()) { if cb == nil { x.xGReserved9 = 0 } else { x.xGReserved9 = purego.NewCallback(func() { cb() }) } } // GetGReserved9 gets the "_g_reserved9" callback function. func (x *MountOperationClass) GetGReserved9() func() { if x.xGReserved9 == 0 { return nil } var rawCallback func() purego.RegisterFunc(&rawCallback, x.xGReserved9) return func() { rawCallback() } } type MountOperationPrivate struct { _ structs.HostLayout } func (x *MountOperationPrivate) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // `GMountOperation` provides a mechanism for interacting with the user. // It can be used for authenticating mountable operations, such as loop // mounting files, hard drive partitions or server locations. It can // also be used to ask the user questions or show a list of applications // preventing unmount or eject operations from completing. // // Note that `GMountOperation` is used for more than just [iface@Gio.Mount] // objects – for example it is also used in [method@Gio.Drive.start] and // [method@Gio.Drive.stop]. // // Users should instantiate a subclass of this that implements all the // various callbacks to show the required dialogs, such as // [`GtkMountOperation`](https://docs.gtk.org/gtk4/class.MountOperation.html). // If no user interaction is desired (for example when automounting // filesystems at login time), usually `NULL` can be passed, see each method // taking a `GMountOperation` for details. // // Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with TrueCrypt and VeraCrypt’. // [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) is a discontinued system for // encrypting file containers, partitions or whole disks, typically used with Windows. // [VeraCrypt](https://www.veracrypt.fr/) is a maintained fork of TrueCrypt with various // improvements and auditing fixes. type MountOperation struct { gobject.Object } var xMountOperationGLibType func() types.GType func MountOperationGLibType() types.GType { return xMountOperationGLibType() } func MountOperationNewFromInternalPtr(ptr uintptr) *MountOperation { cls := &MountOperation{} cls.Ptr = ptr return cls } var xNewMountOperation func() uintptr // Creates a new mount operation. func NewMountOperation() *MountOperation { var cls *MountOperation cret := xNewMountOperation() if cret == 0 { return nil } cls = &MountOperation{} cls.Ptr = cret return cls } var xMountOperationGetAnonymous func(uintptr) bool // Check to see whether the mount operation is being used // for an anonymous user. func (x *MountOperation) GetAnonymous() bool { cret := xMountOperationGetAnonymous(x.GoPointer()) return cret } var xMountOperationGetChoice func(uintptr) int // Gets a choice from the mount operation. func (x *MountOperation) GetChoice() int { cret := xMountOperationGetChoice(x.GoPointer()) return cret } var xMountOperationGetDomain func(uintptr) string // Gets the domain of the mount operation. func (x *MountOperation) GetDomain() string { cret := xMountOperationGetDomain(x.GoPointer()) return cret } var xMountOperationGetIsTcryptHiddenVolume func(uintptr) bool // Check to see whether the mount operation is being used // for a TCRYPT hidden volume. func (x *MountOperation) GetIsTcryptHiddenVolume() bool { cret := xMountOperationGetIsTcryptHiddenVolume(x.GoPointer()) return cret } var xMountOperationGetIsTcryptSystemVolume func(uintptr) bool // Check to see whether the mount operation is being used // for a TCRYPT system volume. func (x *MountOperation) GetIsTcryptSystemVolume() bool { cret := xMountOperationGetIsTcryptSystemVolume(x.GoPointer()) return cret } var xMountOperationGetPassword func(uintptr) string // Gets a password from the mount operation. func (x *MountOperation) GetPassword() string { cret := xMountOperationGetPassword(x.GoPointer()) return cret } var xMountOperationGetPasswordSave func(uintptr) PasswordSave // Gets the state of saving passwords for the mount operation. func (x *MountOperation) GetPasswordSave() PasswordSave { cret := xMountOperationGetPasswordSave(x.GoPointer()) return cret } var xMountOperationGetPim func(uintptr) uint // Gets a PIM from the mount operation. func (x *MountOperation) GetPim() uint { cret := xMountOperationGetPim(x.GoPointer()) return cret } var xMountOperationGetUsername func(uintptr) string // Get the user name from the mount operation. func (x *MountOperation) GetUsername() string { cret := xMountOperationGetUsername(x.GoPointer()) return cret } var xMountOperationReply func(uintptr, MountOperationResult) // Emits the #GMountOperation::reply signal. func (x *MountOperation) Reply(ResultVar MountOperationResult) { xMountOperationReply(x.GoPointer(), ResultVar) } var xMountOperationSetAnonymous func(uintptr, bool) // Sets the mount operation to use an anonymous user if @anonymous is %TRUE. func (x *MountOperation) SetAnonymous(AnonymousVar bool) { xMountOperationSetAnonymous(x.GoPointer(), AnonymousVar) } var xMountOperationSetChoice func(uintptr, int) // Sets a default choice for the mount operation. func (x *MountOperation) SetChoice(ChoiceVar int) { xMountOperationSetChoice(x.GoPointer(), ChoiceVar) } var xMountOperationSetDomain func(uintptr, uintptr) // Sets the mount operation's domain. func (x *MountOperation) SetDomain(DomainVar *string) { DomainVarPtr := core.GStrdupNullable(DomainVar) defer core.GFreeNullable(DomainVarPtr) xMountOperationSetDomain(x.GoPointer(), DomainVarPtr) } var xMountOperationSetIsTcryptHiddenVolume func(uintptr, bool) // Sets the mount operation to use a hidden volume if @hidden_volume is %TRUE. func (x *MountOperation) SetIsTcryptHiddenVolume(HiddenVolumeVar bool) { xMountOperationSetIsTcryptHiddenVolume(x.GoPointer(), HiddenVolumeVar) } var xMountOperationSetIsTcryptSystemVolume func(uintptr, bool) // Sets the mount operation to use a system volume if @system_volume is %TRUE. func (x *MountOperation) SetIsTcryptSystemVolume(SystemVolumeVar bool) { xMountOperationSetIsTcryptSystemVolume(x.GoPointer(), SystemVolumeVar) } var xMountOperationSetPassword func(uintptr, uintptr) // Sets the mount operation's password to @password. func (x *MountOperation) SetPassword(PasswordVar *string) { PasswordVarPtr := core.GStrdupNullable(PasswordVar) defer core.GFreeNullable(PasswordVarPtr) xMountOperationSetPassword(x.GoPointer(), PasswordVarPtr) } var xMountOperationSetPasswordSave func(uintptr, PasswordSave) // Sets the state of saving passwords for the mount operation. func (x *MountOperation) SetPasswordSave(SaveVar PasswordSave) { xMountOperationSetPasswordSave(x.GoPointer(), SaveVar) } var xMountOperationSetPim func(uintptr, uint) // Sets the mount operation's PIM to @pim. func (x *MountOperation) SetPim(PimVar uint) { xMountOperationSetPim(x.GoPointer(), PimVar) } var xMountOperationSetUsername func(uintptr, uintptr) // Sets the user name within @op to @username. func (x *MountOperation) SetUsername(UsernameVar *string) { UsernameVarPtr := core.GStrdupNullable(UsernameVar) defer core.GFreeNullable(UsernameVarPtr) xMountOperationSetUsername(x.GoPointer(), UsernameVarPtr) } func (c *MountOperation) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *MountOperation) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyAnonymous sets the "anonymous" property. // Whether to use an anonymous user when authenticating. func (x *MountOperation) SetPropertyAnonymous(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("anonymous", &v) } // GetPropertyAnonymous gets the "anonymous" property. // Whether to use an anonymous user when authenticating. func (x *MountOperation) GetPropertyAnonymous() bool { var v gobject.Value x.GetProperty("anonymous", &v) return v.GetBoolean() } // SetPropertyChoice sets the "choice" property. // The index of the user's choice when a question is asked during the // mount operation. See the #GMountOperation::ask-question signal. func (x *MountOperation) SetPropertyChoice(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("choice", &v) } // GetPropertyChoice gets the "choice" property. // The index of the user's choice when a question is asked during the // mount operation. See the #GMountOperation::ask-question signal. func (x *MountOperation) GetPropertyChoice() int { var v gobject.Value x.GetProperty("choice", &v) return v.GetInt() } // SetPropertyDomain sets the "domain" property. // The domain to use for the mount operation. func (x *MountOperation) SetPropertyDomain(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("domain", &v) } // GetPropertyDomain gets the "domain" property. // The domain to use for the mount operation. func (x *MountOperation) GetPropertyDomain() string { var v gobject.Value x.GetProperty("domain", &v) return v.GetString() } // SetPropertyIsTcryptHiddenVolume sets the "is-tcrypt-hidden-volume" property. // Whether the device to be unlocked is a TCRYPT hidden volume. // See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden%20Volume.html). func (x *MountOperation) SetPropertyIsTcryptHiddenVolume(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("is-tcrypt-hidden-volume", &v) } // GetPropertyIsTcryptHiddenVolume gets the "is-tcrypt-hidden-volume" property. // Whether the device to be unlocked is a TCRYPT hidden volume. // See [the VeraCrypt documentation](https://www.veracrypt.fr/en/Hidden%20Volume.html). func (x *MountOperation) GetPropertyIsTcryptHiddenVolume() bool { var v gobject.Value x.GetProperty("is-tcrypt-hidden-volume", &v) return v.GetBoolean() } // SetPropertyIsTcryptSystemVolume sets the "is-tcrypt-system-volume" property. // Whether the device to be unlocked is a TCRYPT system volume. // In this context, a system volume is a volume with a bootloader // and operating system installed. This is only supported for Windows // operating systems. For further documentation, see // [the VeraCrypt documentation](https://www.veracrypt.fr/en/System%20Encryption.html). func (x *MountOperation) SetPropertyIsTcryptSystemVolume(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("is-tcrypt-system-volume", &v) } // GetPropertyIsTcryptSystemVolume gets the "is-tcrypt-system-volume" property. // Whether the device to be unlocked is a TCRYPT system volume. // In this context, a system volume is a volume with a bootloader // and operating system installed. This is only supported for Windows // operating systems. For further documentation, see // [the VeraCrypt documentation](https://www.veracrypt.fr/en/System%20Encryption.html). func (x *MountOperation) GetPropertyIsTcryptSystemVolume() bool { var v gobject.Value x.GetProperty("is-tcrypt-system-volume", &v) return v.GetBoolean() } // SetPropertyPassword sets the "password" property. // The password that is used for authentication when carrying out // the mount operation. func (x *MountOperation) SetPropertyPassword(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("password", &v) } // GetPropertyPassword gets the "password" property. // The password that is used for authentication when carrying out // the mount operation. func (x *MountOperation) GetPropertyPassword() string { var v gobject.Value x.GetProperty("password", &v) return v.GetString() } // SetPropertyPim sets the "pim" property. // The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See // [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html). func (x *MountOperation) SetPropertyPim(value uint) { var v gobject.Value v.Init(gobject.TypeUintVal) v.SetUint(value) x.SetProperty("pim", &v) } // GetPropertyPim gets the "pim" property. // The VeraCrypt PIM value, when unlocking a VeraCrypt volume. See // [the VeraCrypt documentation](https://www.veracrypt.fr/en/Personal%20Iterations%20Multiplier%20(PIM).html). func (x *MountOperation) GetPropertyPim() uint { var v gobject.Value x.GetProperty("pim", &v) return v.GetUint() } // SetPropertyUsername sets the "username" property. // The user name that is used for authentication when carrying out // the mount operation. func (x *MountOperation) SetPropertyUsername(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("username", &v) } // GetPropertyUsername gets the "username" property. // The user name that is used for authentication when carrying out // the mount operation. func (x *MountOperation) GetPropertyUsername() string { var v gobject.Value x.GetProperty("username", &v) return v.GetString() } // Emitted by the backend when e.g. a device becomes unavailable // while a mount operation is in progress. // // Implementations of GMountOperation should handle this signal // by dismissing open password dialogs. func (x *MountOperation) ConnectAborted(cb *func(MountOperation)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "aborted", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "aborted", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when a mount operation asks the user for a password. // // If the message contains a line break, the first line should be // presented as a heading. For example, it may be used as the // primary text in a #GtkMessageDialog. func (x *MountOperation) ConnectAskPassword(cb *func(MountOperation, string, string, string, AskPasswordFlags)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "ask-password", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MessageVarp uintptr, DefaultUserVarp uintptr, DefaultDomainVarp uintptr, FlagsVarp AskPasswordFlags) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, core.GoString(MessageVarp), core.GoString(DefaultUserVarp), core.GoString(DefaultDomainVarp), FlagsVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "ask-password", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when asking the user a question and gives a list of // choices for the user to choose from. // // If the message contains a line break, the first line should be // presented as a heading. For example, it may be used as the // primary text in a #GtkMessageDialog. func (x *MountOperation) ConnectAskQuestion(cb *func(MountOperation, string, []string)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "ask-question", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MessageVarp uintptr, ChoicesVarp []string) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, core.GoString(MessageVarp), ChoicesVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "ask-question", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when the user has replied to the mount operation. func (x *MountOperation) ConnectReply(cb *func(MountOperation, MountOperationResult)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "reply", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, ResultVarp MountOperationResult) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, ResultVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "reply", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when one or more processes are blocking an operation // e.g. unmounting/ejecting a #GMount or stopping a #GDrive. // // Note that this signal may be emitted several times to update the // list of blocking processes as processes close files. The // application should only respond with g_mount_operation_reply() to // the latest signal (setting #GMountOperation:choice to the choice // the user made). // // If the message contains a line break, the first line should be // presented as a heading. For example, it may be used as the // primary text in a #GtkMessageDialog. func (x *MountOperation) ConnectShowProcesses(cb *func(MountOperation, string, []glib.Pid, []string)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "show-processes", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MessageVarp uintptr, ProcessesVarp []glib.Pid, ChoicesVarp []string) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, core.GoString(MessageVarp), ProcessesVarp, ChoicesVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "show-processes", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when an unmount operation has been busy for more than some time // (typically 1.5 seconds). // // When unmounting or ejecting a volume, the kernel might need to flush // pending data in its buffers to the volume stable storage, and this operation // can take a considerable amount of time. This signal may be emitted several // times as long as the unmount operation is outstanding, and then one // last time when the operation is completed, with @bytes_left set to zero. // // Implementations of GMountOperation should handle this signal by // showing an UI notification, and then dismiss it, or show another notification // of completion, when @bytes_left reaches zero. // // If the message contains a line break, the first line should be // presented as a heading. For example, it may be used as the // primary text in a #GtkMessageDialog. func (x *MountOperation) ConnectShowUnmountProgress(cb *func(MountOperation, string, int64, int64)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "show-unmount-progress", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, MessageVarp uintptr, TimeLeftVarp int64, BytesLeftVarp int64) { fa := MountOperation{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, core.GoString(MessageVarp), TimeLeftVarp, BytesLeftVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "show-unmount-progress", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } 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(&xMountOperationGLibType, libs, "g_mount_operation_get_type") core.PuregoSafeRegister(&xNewMountOperation, libs, "g_mount_operation_new") core.PuregoSafeRegister(&xMountOperationGetAnonymous, libs, "g_mount_operation_get_anonymous") core.PuregoSafeRegister(&xMountOperationGetChoice, libs, "g_mount_operation_get_choice") core.PuregoSafeRegister(&xMountOperationGetDomain, libs, "g_mount_operation_get_domain") core.PuregoSafeRegister(&xMountOperationGetIsTcryptHiddenVolume, libs, "g_mount_operation_get_is_tcrypt_hidden_volume") core.PuregoSafeRegister(&xMountOperationGetIsTcryptSystemVolume, libs, "g_mount_operation_get_is_tcrypt_system_volume") core.PuregoSafeRegister(&xMountOperationGetPassword, libs, "g_mount_operation_get_password") core.PuregoSafeRegister(&xMountOperationGetPasswordSave, libs, "g_mount_operation_get_password_save") core.PuregoSafeRegister(&xMountOperationGetPim, libs, "g_mount_operation_get_pim") core.PuregoSafeRegister(&xMountOperationGetUsername, libs, "g_mount_operation_get_username") core.PuregoSafeRegister(&xMountOperationReply, libs, "g_mount_operation_reply") core.PuregoSafeRegister(&xMountOperationSetAnonymous, libs, "g_mount_operation_set_anonymous") core.PuregoSafeRegister(&xMountOperationSetChoice, libs, "g_mount_operation_set_choice") core.PuregoSafeRegister(&xMountOperationSetDomain, libs, "g_mount_operation_set_domain") core.PuregoSafeRegister(&xMountOperationSetIsTcryptHiddenVolume, libs, "g_mount_operation_set_is_tcrypt_hidden_volume") core.PuregoSafeRegister(&xMountOperationSetIsTcryptSystemVolume, libs, "g_mount_operation_set_is_tcrypt_system_volume") core.PuregoSafeRegister(&xMountOperationSetPassword, libs, "g_mount_operation_set_password") core.PuregoSafeRegister(&xMountOperationSetPasswordSave, libs, "g_mount_operation_set_password_save") core.PuregoSafeRegister(&xMountOperationSetPim, libs, "g_mount_operation_set_pim") core.PuregoSafeRegister(&xMountOperationSetUsername, libs, "g_mount_operation_set_username") }