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
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theAbortedCallback
callback.static interface
Functional interface declaration of theAskPasswordCallback
callback.static interface
Functional interface declaration of theAskQuestionCallback
callback.static class
MountOperation.Builder<B extends MountOperation.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static interface
Functional interface declaration of theReplyCallback
callback.static interface
Functional interface declaration of theShowProcessesCallback
callback.static interface
Functional interface declaration of theShowUnmountProgressCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreates a new mount operation.MountOperation
(MemorySegment address) Create a MountOperation proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
aborted()
protected void
askPassword
(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) protected void
askQuestion
(String message, String[] choices) Virtual implementation ofGMountOperation
::ask-question.protected MountOperation
asParent()
Returns this instance as if it were its parent type.static MountOperation.Builder
<? extends MountOperation.Builder> builder()
AMountOperation.Builder
object constructs aMountOperation
with the specified properties.void
Emits the "aborted" signal.void
emitAskPassword
(String message, String defaultUser, String defaultDomain, Set<AskPasswordFlags> flags) Emits the "ask-password" signal.void
emitAskQuestion
(String message, String[] choices) Emits the "ask-question" signal.void
emitReply
(MountOperationResult result) Emits the "reply" signal.void
emitShowProcesses
(String message, Pid[] processes, String[] choices) Emits the "show-processes" signal.void
emitShowUnmountProgress
(String message, long timeLeft, long bytesLeft) Emits the "show-unmount-progress" signal.boolean
Check to see whether the mount operation is being used for an anonymous user.int
Gets a choice from the mount operation.Gets the domain of the mount operation.boolean
Check to see whether the mount operation is being used for a TCRYPT hidden volume.boolean
Check to see whether the mount operation is being used for a TCRYPT system volume.static MemoryLayout
The memory layout of the native struct.Gets a password from the mount operation.Gets the state of saving passwords for the mount operation.int
getPim()
Gets a PIM from the mount operation.static Type
getType()
Get the GType of the MountOperation classGet 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).void
reply
(MountOperationResult result) Emits theGMountOperation
::reply signal.void
setAnonymous
(boolean anonymous) Sets the mount operation to use an anonymous user ifanonymous
istrue
.void
setChoice
(int choice) Sets a default choice for the mount operation.void
Sets the mount operation's domain.void
setIsTcryptHiddenVolume
(boolean hiddenVolume) Sets the mount operation to use a hidden volume ifhiddenVolume
istrue
.void
setIsTcryptSystemVolume
(boolean systemVolume) Sets the mount operation to use a system volume ifsystemVolume
istrue
.void
setPassword
(@Nullable String password) Sets the mount operation's password topassword
.void
setPasswordSave
(PasswordSave save) Sets the state of saving passwords for the mount operation.void
setPim
(int pim) Sets the mount operation's PIM topim
.void
setUsername
(@Nullable String username) Sets the user name within this MountOperation tousername
.protected void
showProcesses
(String message, Pid[] processes, String[] choices) Virtual implementation ofGMountOperation
::show-processes.protected void
showUnmountProgress
(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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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 mount operation.
-
-
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 Javasuper
keyword, 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:
true
if 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:
true
if mount operation is for hidden volume.
-
getIsTcryptSystemVolume
public boolean getIsTcryptSystemVolume()Check to see whether the mount operation is being used for a TCRYPT system volume.- Returns:
true
if mount operation is for system volume.
-
getPassword
Gets a password from the mount operation.- Returns:
- a string containing the password within this MountOperation.
-
getPasswordSave
Gets the state of saving passwords for the mount operation.- Returns:
- a
GPasswordSave
flag.
-
getPim
public int getPim()Gets a PIM from the mount operation.- Returns:
- The VeraCrypt PIM within this MountOperation.
-
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 ifanonymous
istrue
.- 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 ifhiddenVolume
istrue
.- Parameters:
hiddenVolume
- boolean value.
-
setIsTcryptSystemVolume
public void setIsTcryptSystemVolume(boolean systemVolume) Sets the mount operation to use a system volume ifsystemVolume
istrue
.- Parameters:
systemVolume
- boolean value.
-
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 ofGPasswordSave
flags.
-
setPim
public void setPim(int pim) Sets the mount operation's PIM topim
.- Parameters:
pim
- an unsigned integer.
-
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
Virtual implementation ofGMountOperation
::show-processes.- Parameters:
message
- string containing a message to display to the userprocesses
- an array ofGPid
for processes blocking the operationchoices
- an array of strings for each possible choice
-
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
- 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 aGMount
or 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
- See Also:
-
emitShowProcesses
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
bytesLeft
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
bytesLeft
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
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitShowUnmountProgress
Emits the "show-unmount-progress" signal. SeeonShowUnmountProgress(org.gnome.gio.MountOperation.ShowUnmountProgressCallback)
. -
builder
AMountOperation.Builder
object constructs aMountOperation
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withMountOperation.Builder.build()
.
-