Class MountOperation
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
MountOperation
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 Mount
objects – for example it is also used in Drive.start(java.util.Set<org.gnome.gio.DriveStartFlags>, org.gnome.gio.MountOperation, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback) and
Drive.stop(java.util.Set<org.gnome.gio.MountUnmountFlags>, org.gnome.gio.MountOperation, org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback).
Users should instantiate a subclass of this that implements all the
various callbacks to show the required dialogs, such as
GtkMountOperation.
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 is a discontinued system for encrypting file containers, partitions or whole disks, typically used with Windows. VeraCrypt is a maintained fork of TrueCrypt with various improvements and auditing fixes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theAbortedCallbackcallback.static interfaceFunctional interface declaration of theAskPasswordCallbackcallback.static interfaceFunctional interface declaration of theAskQuestionCallbackcallback.static classMountOperation.Builder<B extends MountOperation.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classstatic interfaceFunctional interface declaration of theReplyCallbackcallback.static interfaceFunctional interface declaration of theShowProcessesCallbackcallback.static interfaceFunctional interface declaration of theShowUnmountProgressCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MountOperation.MountOperation(MemorySegment address) Create a MountOperation proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaborted()protected voidaskPassword(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) protected voidaskQuestion(String message, @Nullable String @Nullable [] choices) Virtual implementation ofGMountOperation::ask-question.protected MountOperationasParent()Returns this instance as if it were its parent type.static MountOperation.Builder<? extends MountOperation.Builder> builder()AMountOperation.Builderobject constructs aMountOperationwith the specified properties.voidEmits the "aborted" signal.voidemitAskPassword(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) Emits the "ask-password" signal.voidemitAskQuestion(String message, @Nullable String @Nullable [] choices) Emits the "ask-question" signal.voidemitReply(MountOperationResult result) Emits the "reply" signal.voidemitShowProcesses(String message, @Nullable Pid @Nullable [] processes, @Nullable String @Nullable [] choices) Emits the "show-processes" signal.voidemitShowUnmountProgress(String message, long timeLeft, long bytesLeft) Emits the "show-unmount-progress" signal.booleanCheck to see whether the mount operation is being used for an anonymous user.intGets a choice from the mount operation.@Nullable StringGets the domain of the mount operation.booleanCheck to see whether the mount operation is being used for a TCRYPT hidden volume.booleanCheck to see whether the mount operation is being used for a TCRYPT system volume.static MemoryLayoutThe memory layout of the native struct.@Nullable StringGets a password from the mount operation.Gets the state of saving passwords for the mount operation.intgetPim()Gets a PIM from the mount operation.static @Nullable TypegetType()Get the GType of the MountOperation class@Nullable StringGet the user name from the mount operation.onAborted(MountOperation.AbortedCallback handler) Emitted by the backend when e.g.Emitted when a mount operation asks the user for a password.Emitted when asking the user a question and gives a list of choices for the user to choose from.onReply(MountOperation.ReplyCallback handler) Emitted when the user has replied to the mount operation.Emitted when one or more processes are blocking an operation e.g.Emitted when an unmount operation has been busy for more than some time (typically 1.5 seconds).voidreply(MountOperationResult result) Emits theGMountOperation::reply signal.voidsetAnonymous(boolean anonymous) Sets the mount operation to use an anonymous user ifanonymousistrue.voidsetChoice(int choice) Sets a default choice for the mount operation.voidSets the mount operation's domain.voidsetIsTcryptHiddenVolume(boolean hiddenVolume) Sets the mount operation to use a hidden volume ifhiddenVolumeistrue.voidsetIsTcryptSystemVolume(boolean systemVolume) Sets the mount operation to use a system volume ifsystemVolumeistrue.voidsetPassword(@Nullable String password) Sets the mount operation's password topassword.voidsetPasswordSave(PasswordSave save) Sets the state of saving passwords for the mount operation.voidsetPim(int pim) Sets the mount operation's PIM topim.voidsetUsername(@Nullable String username) Sets the user name within this MountOperation tousername.protected voidshowProcesses(String message, @Nullable Pid @Nullable [] processes, @Nullable String @Nullable [] choices) Virtual implementation ofGMountOperation::show-processes.protected voidshowUnmountProgress(String message, long timeLeft, long bytesLeft) Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
MountOperation
Create a MountOperation proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
MountOperation
public MountOperation()Creates a new MountOperation.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getAnonymous
public boolean getAnonymous()Check to see whether the mount operation is being used for an anonymous user.- Returns:
trueif mount operation is anonymous.
-
getChoice
public int getChoice()Gets a choice from the mount operation.- Returns:
- an integer containing an index of the user's choice from
the choice's list, or
0.
-
getDomain
Gets the domain of the mount operation.- Returns:
- a string set to the domain.
-
getIsTcryptHiddenVolume
public boolean getIsTcryptHiddenVolume()Check to see whether the mount operation is being used for a TCRYPT hidden volume.- Returns:
trueif mount operation is for hidden volume.- Since:
- 2.58
-
getIsTcryptSystemVolume
public boolean getIsTcryptSystemVolume()Check to see whether the mount operation is being used for a TCRYPT system volume.- Returns:
trueif mount operation is for system volume.- Since:
- 2.58
-
getPassword
Gets a password from the mount operation.- Returns:
- a string containing the password within
op.
-
getPasswordSave
Gets the state of saving passwords for the mount operation.- Returns:
- a
GPasswordSaveflag.
-
getPim
public int getPim()Gets a PIM from the mount operation.- Returns:
- The VeraCrypt PIM within
op. - Since:
- 2.58
-
getUsername
Get the user name from the mount operation.- Returns:
- a string containing the user name.
-
reply
Emits theGMountOperation::reply signal.- Parameters:
result- aGMountOperationResult
-
setAnonymous
public void setAnonymous(boolean anonymous) Sets the mount operation to use an anonymous user ifanonymousistrue.- Parameters:
anonymous- boolean value.
-
setChoice
public void setChoice(int choice) Sets a default choice for the mount operation.- Parameters:
choice- an integer.
-
setDomain
Sets the mount operation's domain.- Parameters:
domain- the domain to set.
-
setIsTcryptHiddenVolume
public void setIsTcryptHiddenVolume(boolean hiddenVolume) Sets the mount operation to use a hidden volume ifhiddenVolumeistrue.- Parameters:
hiddenVolume- boolean value.- Since:
- 2.58
-
setIsTcryptSystemVolume
public void setIsTcryptSystemVolume(boolean systemVolume) Sets the mount operation to use a system volume ifsystemVolumeistrue.- Parameters:
systemVolume- boolean value.- Since:
- 2.58
-
setPassword
Sets the mount operation's password topassword.- Parameters:
password- password to set.
-
setPasswordSave
Sets the state of saving passwords for the mount operation.- Parameters:
save- a set ofGPasswordSaveflags.
-
setPim
public void setPim(int pim) Sets the mount operation's PIM topim.- Parameters:
pim- an unsigned integer.- Since:
- 2.58
-
setUsername
Sets the user name within this MountOperation tousername.- Parameters:
username- input username.
-
aborted
protected void aborted() -
askPassword
protected void askPassword(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) -
askQuestion
-
showProcesses
protected void showProcesses(String message, @Nullable Pid @Nullable [] processes, @Nullable String @Nullable [] choices) Virtual implementation ofGMountOperation::show-processes.- Parameters:
message- string containing a message to display to the userprocesses- an array ofGPidfor processes blocking the operationchoices- an array of strings for each possible choice- Since:
- 2.22
-
showUnmountProgress
-
onAborted
public SignalConnection<MountOperation.AbortedCallback> onAborted(MountOperation.AbortedCallback handler) 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.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.20
- See Also:
-
emitAborted
public void emitAborted()Emits the "aborted" signal. SeeonAborted(org.gnome.gio.MountOperation.AbortedCallback). -
onAskPassword
public SignalConnection<MountOperation.AskPasswordCallback> onAskPassword(MountOperation.AskPasswordCallback handler) 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.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAskPassword
public void emitAskPassword(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) Emits the "ask-password" signal. SeeonAskPassword(org.gnome.gio.MountOperation.AskPasswordCallback). -
onAskQuestion
public SignalConnection<MountOperation.AskQuestionCallback> onAskQuestion(MountOperation.AskQuestionCallback handler) 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.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAskQuestion
Emits the "ask-question" signal. SeeonAskQuestion(org.gnome.gio.MountOperation.AskQuestionCallback). -
onReply
Emitted when the user has replied to the mount operation.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitReply
Emits the "reply" signal. SeeonReply(org.gnome.gio.MountOperation.ReplyCallback). -
onShowProcesses
public SignalConnection<MountOperation.ShowProcessesCallback> onShowProcesses(MountOperation.ShowProcessesCallback handler) Emitted when one or more processes are blocking an operation e.g. unmounting/ejecting aGMountor stopping aGDrive.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.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.22
- See Also:
-
emitShowProcesses
public void emitShowProcesses(String message, @Nullable Pid @Nullable [] processes, @Nullable String @Nullable [] choices) Emits the "show-processes" signal. SeeonShowProcesses(org.gnome.gio.MountOperation.ShowProcessesCallback). -
onShowUnmountProgress
public SignalConnection<MountOperation.ShowUnmountProgressCallback> onShowUnmountProgress(MountOperation.ShowUnmountProgressCallback handler) 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
bytesLeftset 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
bytesLeftreaches 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.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.34
- See Also:
-
emitShowUnmountProgress
Emits the "show-unmount-progress" signal. SeeonShowUnmountProgress(org.gnome.gio.MountOperation.ShowUnmountProgressCallback). -
builder
AMountOperation.Builderobject constructs aMountOperationwith the specified properties. Use the variousset...()methods to set properties, and finish construction withMountOperation.Builder.build().- Returns:
- the builder object
-